users@glassfish.java.net

Entity Problem

From: <glassfish_at_javadesktop.org>
Date: Mon, 17 Sep 2007 04:19:09 PDT

Hi,

I have one class called Structure with a collection of StructureLeaf entities.

 @OneToMany(cascade=CascadeType.ALL, mappedBy="parentStructureEntity")
private Collection<StructureLeafEntity> structureLeafEntityList = new ArrayList<StructureLeafEntity>();

In the StructureLeafEntity class I have to Many-to-one relations to the Structure class and table.

 @JoinColumn(name = "child_structures_id", referencedColumnName = "structures_id", nullable=true)
    @ManyToOne
    private StructureEntity childStructureEntity;
    
    @JoinColumn(name = "parent_structures_id", referencedColumnName = "structures_id")
    @ManyToOne
    private StructureEntity parentStructureEntity;

The problem is the following: I can persist a StructureLeaf without problem, but the collection in the Structure class does not function. The persistence layer does not pick up the StructureLeaf entities eventhough they are present in the database.

Any ideas?

Greetings
Jan De Cooman
[Message sent by forum member 'ossaert' (ossaert)]

http://forums.java.net/jive/thread.jspa?messageID=235608