This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping Entity Beans to Tables  RSS feed

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If I am using RDBMS for persisting the CMP entity beans, is it a must to map one entity bean to one table (ie. one instance of the ebean to one row of that table)? I used to follow the 1 to 1 strategy to simpify the ebean to table mapping but encountered a situation that I would create a large unnormalized table if I stick to the 1 to 1 strategy. e.g. I have an ebean representing the Quotations issued to customer and it has these CMP fields:
1. Customer Name:String
2. Price1:int
3. Price2:int
...
...
20. Footer:String
"Footer" is a very long description like "Cash on Delivery required or we will kick your assh, blah blah blah" and almost every ebean instance (row of the table) has the same description. Now it is obvious to normalize the table so that "Footer" is in a separate table referenced by a foreign key.
But this would mean the *CMP* ebean need to access 2 tables to load the instance fields("Footer" from one and the rest from the other). How do I instruct the server to do this (is it server specific?) or is it possible at all according to the EJB spec?
Thanks
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please search this forum with the keyword "multiple tables", and U'll get plenty of old posts that contain this question.
http://www.coderanch.com/t/308792/EJB-JEE/java/CMP-Multiple-Tables
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!