• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Boolean or boolean for hibernate mapping

 
ayan sevi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any significant factor why would I use Boolean over boolean for mapping fields in hibernate and the other way around, boolean over Boolean?

Or why would I use Wrapper types instead of primitives for mapping, and the other way around?

I got this post from javaranch Primitive vs. Wrapper mapping. Any other thoughts???

Thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope not extra thoughts.

Whichever you like. I like wrapper classes, and with Java5 boxing and unboxing, it really doesn't matter to me anymore.

Mark
 
ayan sevi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is wrapper type overhead (creating the object) negligible, even if you're working for let's say hundreds of thousand of data? Quite not sure on this.
 
H Blogg
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might if you use jstl
isBoolean() is not supported. It only fully supports primitives. Of course you could always just use getBoolean() but it doesn't read as well in the code
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ayan sevi wrote:Is wrapper type overhead (creating the object) negligible, even if you're working for let's say hundreds of thousand of data? Quite not sure on this.


Probably not. You can test this and see easily enough.

A bigger concern for me would be whether the field is nullable or not (though it doesn't usually make sense to have a nullable boolean field).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic