79376451

Date: 2025-01-22 03:21:33
Score: 1
Natty:
Report link

In HQL, the column name is derived from the get method name by dropping the 'get' prefix, and changing the first letter of the remaining portion to lower case. Therefore, when the column is declared as '@Column(name = "Fullname") public String getFullname()', the HQL column name would be 'fullname'.

On the other hand, if the column is declared as '@Column(name = "Fullname") private String Fullname;', the member name is used as column name. Because of that, the HQL column name would be 'Fullname' and your query is going to be correct.

Please note that Java Naming Convention states that the variable names should start with the lower case letter. For this reason, using the latter declaration to force first letter of the column name to be in upper case is strongly discouraged.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Michael Gorovoy