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

question on entity bean.  RSS feed

 
mustang india
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I have a question about entity bean. Can a entity bean represent data from multiple tables ? what i mean is if an entity bean has 6 variable, can 4 of them represent cols of a table and the other two represent cols of another table. Is this possible.
Thanks in advance.
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Yes you can do it with Bean Managed Persistence(BMP)
 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let us say that i have a customer object.
Address is part of that object.
A customer can have multiple credit cards.
With CMP, i believe, i can have the address as a serializable object and have it as part of the customer EJB.
How do i deal with the Collection of Credit card objects that are related to this customer.
Is it possible with EJB1.1
or
Is BMP the only way to deal with it?
 
Neil Goldsmith
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do multitable mappings with CMP.
 
Rajeev Gupta
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends
U can represent two tables in ur one CMP in ejb 1.1. All u need to do is make two EJBs and in your Customer Bean's ejbPostCreate() and ejbAcrtivate() you have to lookup for the specific primary key of your CreditCard bean which is associated with your particular customer. On the other way In ejbPassivate() and ejbRemove() u have to discards all the handles(References) to your CreditCard Bean. But this should not be done untill it is verry necessary, because this puts extra burdon on container.
Raajeev
 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it mean.... in this type of scenario, it is advisable to go for BMP instead of having three CMPs??
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!