Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Unnecessary join-table

Hey,

I am new to eclipselink and I am sure it is an easy problem, but I just
can't find a solution.

The situation is: I have an entity called node, which can have up to 2
parent of the same kind.
The problem is: even if I design the entity for only one parent, eclipselink
always creates a kind of join-table named node-node, which contains the keys
of the child node and the parent node. I dont know why that's necessary,
because there is a field for the parentkey in the node-entity.
If it would work I would ignore that table, but the real problem is when I
add the fields for the second parent.
Then eclipselink adds a third field for the second parent into the
node-node-Table. So when I add one child eclipselink try to add an entry
into the node-node-Table. That fails because there is always a null-value
for the second parent. 
I think the problem is that unnecessary node-node-Table which shouldnt
exist. So I think there's something wrong with my annotations.


    @ManyToOne
    @JoinColumn(name="PARENTNODE_ID1")
	Node parentNode1;
    @OneToMany(cascade=CascadeType.ALL)
	List<Node> subNodes1 = new ArrayList<Node>();
    @ManyToOne
    @JoinColumn(name="PARENTNODE_ID2")
	Node parentNode2;
    @OneToMany(cascade=CascadeType.ALL)
	List<Node> subNodes2 = new ArrayList<Node>

It would be very kind if someone could give me a hint!

-- 
View this message in context: http://old.nabble.com/Unnecessary-join-table-tp26968942p26968942.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top