Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Mapping Entity Beans to Tables

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
https://coderanch.com/t/308792/EJB-JEE/java/CMP-Multiple-Tables
 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic