Answer the question
In order to leave comments, you need to log in
How to fix an error when generating a Hibernate query?
I'm learning how hibernate works. If I display a list of authors, then everything is collected and displayed (only memory addresses)
for (Author author:new AuthorHelper().getAuthorList()) {
System.out.println(<b>author</b>);
}
for (Author author:new AuthorHelper().getAuthorList()
) {
System.out.println(<b>author.getSecondName()</b>);
}
error: cannot find symbol System.out.println(author.getSecondName());
^
symbol: method getSecondName()
location: variable author of type Author
Answer the question
In order to leave comments, you need to log in
Doesn't look like a Hibernate bug.
symbol: method getSecondName()
Please check if you have a secondName
field
Do you have a getter for this field getSecondName()
?
Are you using the lombok library? If so, did you forget to add @Data
or @Getter @Setter
to your entities.
If added, is the annotaion processor included?
Thanks!!!! Yes you are right!!! the problem was in lombok, removed these annotations, registered the usual getter-setters and it worked!!!!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question