Try removing the default fetchgroup? Thanks, Rick
On Mon, Jul 25, 2011 at 4:49 AM, M. Walter <marc.wal...@sbb.ch> wrote: > It does not work as described in the documentation. Or am I missing > something? > > Here is my entity: > @Entity > @Table(name = "BP") > @FetchGroup(name = "short", attributes = { @FetchAttribute(name = "id"), > @FetchAttribute(name = "bezeichnung") }) > public class Bp extends BaseEntity implements Serializable { > > public static final long serialVersionUID = -8334035710155503058L; > > @Id > @SequenceGenerator(name = "SeqBp", sequenceName = "SEQ_BP") > @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SeqBp") > @Column(name = "ID") > private Long id; > @Column(name = "ABKUERZUNG") > private String abkuerzung; > @Column(name = "REGION") > private String region; > @Column(name = "BEZEICHNUNG") > private String bezeichnung; > // lots of other fields and relations here > } > > The code to load the entities with the named FetchGroup "short": > > final OpenJPAQuery ojpaQuery = > OpenJPAPersistence.cast(em.createNamedQuery( > StammdatenQueryNames.FIND_ALL_BP.name())); > ojpaQuery.getFetchPlan().addFetchGroup("short"); > final List<Bp> result = ojpaQuery.getResultList(); > > In the list I get the entities are loaded completely containing all fields > and relations. Why? > > -- > -- *Rick Curtis*