• Post Reply Bookmark Topic Watch Topic
  • New Topic

About Multiple Tables involved in a single CMP Bean  RSS feed

 
Anavel Gato
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Would anybody please tell me, whether I can use CMP Entity bean to refer multiple fields in more than one table. For example, I have a UserEJB which will refer to a table named USER_PROFILE, USER_ADDRESS, ACCOUNT_INFO and ORDER_TABLE. I want to make those fields under the UserEJB and keep persisted by the Container.
Can I do so? THX a LOT
 
Karl Laird
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a single EJB may represent multiple tables, however it can be more difficult to create and deploy these EJB's. In particular if you are using 3rd party DB mapping tools to create your EJB definitions, alot of these do not support multiple table beans meaning you have to understand alot more about using the xml deployment descriptors and EJB mapping
 
Anavel Gato
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So Does it mean it is better to have a view of those tables instead of using the Entity Bean to create such a relationship among those tables.
As I am so confused, from some posts many recommend we should make entity bean as a coast grain instead of a fine grained one and also they will say this is a bad practice to have an entity bean for a single table. So it implies me that I should do the entity bean to include all the tables related to the entity logic. But now that it is said that it is hard to do so...
I would think that having a view of those will be suitable. Am I correct?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!