This is my first post in a forum, so I apologize if I make a mistake.
This is the following, I need to register a book in the bank, but before that, I would need to know if the author is already registered in the bank, or if not, I must register first. So I thought I'd create an "Authenticator" method that would query the Author table in the database, and if there was no user-entered name, I would be directed to the login screen. I thought about giving a select in the bank, and if I did not find anything, return null, type one
if (RESULTADODOBANCO = null)
cadastroAutor.setVisible(true);
But I have no idea how to do this, I made a
String sql="SELECT nome FROM autor WHERE nome=?";
try {
PreparedStatement stmt = c.prepareStatement(sql);
stmt.setString (5, livro.getAutor());
In my method it checks for an author, but I do not know how to know if it returned null
FORGIVE ME IF YOU ARE VERY CONFUSED