users@glassfish.java.net

_at_OneToMany empty set

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Jul 2007 14:10:01 PDT

ok I have three classes
Staat <1---*> Land <1---*> Bezirk

If I make the following for a specific Land

[code]
                Land l=remoteLookupLand().findById(1L, false);
                System.out.println(l.getName());
                System.out.println(l.getStaat().getName());
                for (Bezirk b : l.getBezirks()) {
                        System.out.println(b.getName());
                }
[/code]
I get a Staat but no Bezirks.

Here my annotations:
//Staat
@OneToMany(mappedBy="staat", cascade=CascadeType.MERGE,fetch=FetchType.EAGER)
public Set< Land > getLands()
//Land
@OneToMany(mappedBy="land", cascade=CascadeType.MERGE,fetch=FetchType.EAGER)
public Set< Bezirk > getBezirks()
@ManyToOne(cascade=CascadeType.MERGE,fetch=FetchType.EAGER)
public Staat getStaat()
//Bezirk
@ManyToOne(cascade=CascadeType.MERGE,fetch=FetchType.EAGER)
public Land getLand()

Thanx Chris
[Message sent by forum member 'chris_lenz' (chris_lenz)]

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