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?
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.