• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

boolean "is" method

 
andy hardy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a boolean attribute e.g.

boolean isAttribute;

For some reason hibernate expects a getter for this i.e.

public boolean getIsAttribute() {
return isAttribute;
}


Id really like to just use an "is" method i.e.

public boolean isAttribute() {
return isAttribute;
}


Any ideas why there is this restriction? I'm guessing it's to do with something like hibernate using BeanUtils under the covers and thats the default pattern. Even so I;d expect this to be a recognised and preferred pattern.

Thanks
Andy
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try just making the var

boolean attribute;

public boolean isAttribute()
{ return attribute; }

And make sure you map it as a boolean.

It should look for an is method.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic