[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Entity modeling with duel references
do-not-reply at jboss.com
Fri Sep 21 15:24:34 EDT 2007
I've got an application where the persistent data can be thought of as a graph (nodes and connectors). I'm trying to model this in Entity beans where each node is a bean and so is each connector. I have two issues: first, I'm getting confused on the type of relationship (and type of annotation to use) to model this, and two is how can I get cascading deletes to work in this model. So from a high-level each connector has two references to nodes, node1 and node2. Each node could have any number of connectors terminating on it.
Looking at this problem from the whole objects' point of view I have a many-to-many relationship with each connector referring to exactly two nodes and each node having any number of connectors terminating on it. However, from an attribute point of view, I've got two many-to-one relationships in the connector object and a many-to-many relationship node (which I might be able to model as two one-to-many relationships). I do not need a node to know which connections terminate on it for the application's purposes, but have the understanding that it is necessary to make cascading deletes work correctly.
Ideally, I would like to have cascading cleanup any connectors that terminate on a node that is removed.
Help here would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087401#4087401
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087401
More information about the jboss-user