From what I can tell, I may have designed a recursive call and caused a stackoverflow. For example:
1. Purchased items will have a warranty(A).
2. A warranty make have several types of Warranty Support (E)
2. A computer (B) has a one-to-many relationship with warranty (A).
3. A server (C) has a one-to-many relationship with warranty (A).
4. A Peripheral (D) has a one-to-many relationship with warranty (A), computer (B), and server (C).
When I define each relationship within the entity, I place the @ONETOMANY annotation in the owning entity. In the subordinate entity I place the @MANYTOONE annotation.
Here is where it gets a little fuzzy for me. I have tried to follow some good books on EJB 3.0, such as "EJB3 in Action" by Panda, et al. However it lacks clear examples for the scenario I am facing.
What happens when I have a server (C) with many peripherals (D) and each has the same type of warranties (A), such as manufacturer warranty and extended warranty (with some basic info like expiration date, etc)? The EJB Beans gets a request to update C. Updating the single fields and one-to-one relations are straightforward. Now working through the peripherals (D) I am confused. The normal way would be walk through each peripheral and "persist" each item separately because you do not know which has been updated. Action involving new entries would be obvious because each would not have a PK field populated.
While my scenario is easily depicted/created in the database, the implementation of this type of relation is confusing to me in JPA. Could anyone please explain or throw me a link that explains this operation in JPA?
Thank you for taking the time to read my post! I appreciate you taking the time out to assist me.
Russ
[Message sent by forum member 'russ205' (russ205)]
http://forums.java.net/jive/thread.jspa?messageID=260576