• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB composite entities - why not use a DB view?

 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've been reading about "entity beans - composite entity".
That's when you have a single java class, whose storage is split between several DB tables.
E.g:
- Logically you want a single class "Book", with 3 attributes: (ISBN, price, author)
- But for some reason (that's a given), you need it stored in 2 DB tables (ISBN-price), (ISBN-author). So that you'll need a "Join" to get a whole book info.

My question: I've seen various recommendations for handling this (BMP, CMR, BMP that's composed of 2 CMP's...). But for some reason, I haven't seen a recommendation to just use a CMP over a database VIEW.
What am I missing ? Won't VIEW be a simple and easy solution ?
Or is there some performance problem with views ?

Thanks a lot.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


What am I missing ? Won't VIEW be a simple and easy solution ?
Or is there some performance problem with views ?


There is absolutely no problem with views, they are great actually. Simple, efficient, optimized, reliable; one cannot ask for more. However they have their own limitation though: they are very good tools for reading not updating the data. Now if your BMP entity bean maps to a view, how would you suggest to handle the database updates?
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Views can be updated, i belive, the problem, would be what to do with the values in the tables outside the view. I guess if the view contained all the columns that would be ok.

With EJB u will have to fight with the DBA designer. To hell with his experience and logical design of databases. The entity bean suplies the data to the client so u have to impose your design on him. So what if it's not optimal and by that he loses 100MB of hard disk space. Get another harddisk.
 
reply
    Bookmark Topic Watch Topic
  • New Topic