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?

--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Best-practice-Using-fetch-groups-or-a-simple-DTO-tp6598057p6617686.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to