aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes Mapping Entity Beans to Tables Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Mapping Entity Beans to Tables" Watch "Mapping Entity Beans to Tables" New topic
Author

Mapping Entity Beans to Tables

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 568
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

Joined: Aug 27, 2003
Posts: 1064
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Mapping Entity Beans to Tables
 
Similar Threads
J2EE Design Question -- Am I On The Right Track?
Beginner Problem: son & parent
My SCEA Part 1Study Notes
entity bean and multiple tables
Exception:Attempt to get a lock for a null object ?