Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mixed persistence

 
Frank Silbermann
Ranch Hand
Posts: 1408
  • Mark post as helpful
  • send pies
  • 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?
 
Gerald Davis
Ranch Hand
Posts: 872
  • Mark post as helpful
  • send pies
  • 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.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic