Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Datatype of the id in Entity Bean  RSS feed

 
Cainiao Zou
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I found many example about Entity Bean, their id are type Long or Integer, I have tried in my test programm, long and int work too.
Is there anything bad about java primitiv datatype as Id in Entity Bean?

thanks
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An entity with wrapper types (like Integer, Long) for id, allow null values and have a different meaning than entities with primitive ids (int, long whose value gets initialized by default). Entities with a null value are most of the times used to indicate a new entity instance which needs an id to be generated while being persisted.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!