Full test case included, short description:
1)ObjectGraph has collection (@OneToMany) of nodes and one of these nodes is marked as root (@ManyToOne)
2)Each node can be connected to many nodes, so each node has incoming (@ManyToMany) and outgoing (@ManyToMany) nodes.
3)There are diffrent implementation of nodes so GraphNode is abstract (@Inheritance(strategy = InheritanceType.SINGLE_TABLE))
In first transaction I create new grap with one node. In second transaction I add new node to graph and connect with first node. When trying to merge object graps execption is thrown:
org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: dl.hibernate.GraphNode
Graph node is abstract.
|