• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we keep Entity bean in Session  RSS feed

 
Alka S.
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have entity bean which is connected to database table.
This entity bean holds data of logged in user. Can we keep this entity bean in sesson?
Thanks.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can store a handle for the entity bean into HttpSession.
 
Alka S.
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read some where that session become heavy b'coz of entity bean in the session.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't do it. It won't help. If you store the handle or the reference in the session you will STILL incur the same database lookup penalty whenever you access any of the fields because each lookup will be a new transaction!
Instead, create a ValueObject from the Entity data and store that in the HttpSession.
Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!