Java EE? -insert record into database only if it does not exist : I have a table in a database called MYUSER, I am trying to create a method that will check if the Myuser object I pass into it already exists as a row within the database, and then insert that object as a row if it does not exist.

[I have very little experience in java, especially in regards to writing code that interacts with a dataBase which is why I'm struggling with this simple task] 

My attempt at creating said method is below however I just cannot wrap my head around how to implement this correctly

    public boolean createRecord(Myuser myuser) 
    {
        Connection cnnct = null;
        PreparedStatement pStmnt = null;
        try
        {
            cnnct = getConnection();
            String preQueryStatement
            = "SELECT * FROM MYUSER WHERE MYUSER.USERID = ?;";
            pStmnt = cnnct.prepareStatement(preQueryStatement);
            
            if (pStmnt.getResultSet() == null)
            {
                String insertStatement
                = "INSERT INTO MYUSER VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
                PreparedStatement ps = cnnct.prepareStatement(insertStatement);
                
                ps.setString(1, myuser.getUserid());
                ps.setString(2, myuser.getName());
                ps.setString(3, myuser.getPassword());
                ps.setString(4, myuser.getEmail());
                ps.setString(5, myuser.getPhone());
                ps.setString(6, myuser.getAddress());
                ps.setString(7, myuser.getSecQn());
                ps.setString(8, myuser.getSecAns());
                
                System.out.println("new user inserted");
                return true;
            } 
            else
            {
                System.out.println("user already in data base");
                return false;
            }
            
        } 
        
        catch (SQLException ex) 
        {
            while (ex != null) 
            {
                ex.printStackTrace();
                ex = ex.getNextException();
            }
        } 
        
        catch (IOException ex) 
        {
            ex.printStackTrace();
        }
        
        finally 
        {
            if (pStmnt != null) 
            {
                try 
                {

                    pStmnt.close();
                } 
                catch (SQLException e)
                {

                }
            }
        
            if (cnnct!= null) 
            {

                try 
                {
                    cnnct.close();

                } 
                catch (SQLException sqlEx) 
                {

                }
            }
        }
    }