History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-16400
Type: Bug Bug
Status: Open Open
Assignee: Gregory Shrago
Reporter: Markus Halttunen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Hibernate validation says "Cannot resolve attribute" for a Boolean object

Created: 16 Nov 07 17:36   Updated: 16 Nov 07 20:18
Component/s: Code Analysis. Inspection, Compiling Project, J2EE.Hibernate

Build: 7,549
Severity: Medium


 Description  « Hide
We have a class that has the following methods:

public void setMemberAdministrator(Boolean isAdministrator) { this.isMemberAdministrator = isAdministrator; }
public Boolean isMemberAdministrator() { return isMemberAdministrator; }

The hbm.xml file says:
<property name="memberAdministrator" column="is_member_admin" />

IDEA shows an error saying "Cannot resolve attribute memberAdministrator". If I change the type to boolean (i.e. primitive), IDEA stops complaining. Also if I change the method from isMemberAdministrator() to getMemberAdministrator(), IDEA stops complaining.

I don't know if it bad practice to combine Boolean and the "is" form for getters, but at least Hibernate does not seem to mind, even though IDEA does. If it is indeed bad practice, IDEA should simply warn about it and not show it as an error.



 All   Comments   Work Log   Change History      Sort Order:
Gregory Shrago - 16 Nov 07 20:18
While using "is" for Boolean properties is against JavaBeans spec and implementation (see java.beans.BeanInfo class) I couldn't disagree that Hibernate accepts this.