Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Datatatypes in EJB  RSS feed

 
pradeep anandan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I would like to know if u want to store a numeric field in database the attribute for Entity bean should be primitive int or a wrapper Integer.
Thanks
Regards,
Pradeep
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use primitives in CMP Entity beans. See the EJB spec or Richard Monson-Haefel's book for detailed examples of this.
Kyle
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the primitive numeric type is good because there's less overhead. However, if the field may have a null value in the database, use the wrapper, since there's no such thing as a null number.
Personally, I try to avoid null DBMS fields, but others have different opions, and sometimes there are compelling reasons why a field SHOULD be null.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!