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

mixed persistence

 
Ranch Hand
Posts: 1419
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming we are using EJB 2.0 or 2.1 -- what are the rules for mixing persistence types in an application. Can we have some entity bean classes using container managed persistence (CMP), while other entity bean clases use bean managed persistence (BMP) -- or do we have to use all one or the other?

If an application can mix entity beans of each kind of persistence, suppose an entity bean with container managed persistence (CMP) needs relations to both CMP entity beans and BMP entity beans. Could it use container managed relations (CMR) to CMP entity beans, and DAO objects to implement relations to BMP entity beans?
 
Ranch Hand
Posts: 872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to figure out whether it is a good design practice to mix CMP with BMP in the same application and is it ok to break those rules. As fare as I can tell, there are no rule on how to implement EJB.

Breaking rules is ok so long as it is justified. Example At local Collage, I completed a java assignment. My code had plenty of functions (static method) in one big god class. My tutor said using static method is a sign that I am using functional not object oriented programming. I agreed, but I told him I did this to promote code reuse - java language uses plenty of static methods.

In addition, I used the dreaded Goto statement in my code. This was one of the 1 out of 99 situations where the Goto statement helps not hinders. The reason why it was taken out of the java language is not that it is evil, but because to many programmers did not know how to use it appropriately. If I did not document the reasons why I used the Goto statement, he might have failed me.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gerald,

Where did you use the GoTo statement? How could you use it if it's not part of the Java language?

Regards,
Dan
 
Gerald Davis
Ranch Hand
Posts: 872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I written the program in C# (a much better language) then converted it to java. Anyway I was speaking metaphorically dude.
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic