openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar" <ppod...@bea.com>
Subject RE: Regarding Fetch groups in OpenJPA
Date Thu, 18 Oct 2007 15:36:03 GMT
Hi,
You can define a fetch group named 'X' in Employee as well as
Department. 
Include fields of Employee and Department in Fetch Groups 'X' in
respective classes.
Now activating 'X' will result in fetching the fields of both the
classes. 
Primary key fields are fetched always.
  

Pinaki Poddar
972.834.2865
 

>-----Original Message-----
>From: vivek [mailto:vivekmv@geojit.com] 
>Sent: Thursday, October 18, 2007 1:30 AM
>To: dev@openjpa.apache.org
>Subject: Regarding Fetch groups in OpenJPA
>
>Problem :Regarding Fetch groups in OpenJPA.
>
> 
>
>public class EmployeePK {
>
> 
>
>@Column(name = "EmployeeID", nullable = false)
>
> 
>
>private long employeeID;
>
> 
>
>@Column(name = "SerialNo", nullable = false)
>
> 
>
>private int serialNo;
>
> 
>
>}
>
> 
>
>public class Employee {
>
> 
>
>@EmbeddedId
>
> 
>
>protected EmployeePK employeePK;
>
> 
>
>private String firstName;
>
> 
>
>private String lastName;
>
> 
>
>@ManyToOne private Department dept;
>
> 
>
>}
>
> 
>
>public class Department {
>
> 
>
>@Id private int id;
>
> 
>
>private String departmentName;
>
> 
>
>}
>
> 
>
> 
>
>This is the sample scenario.
>
>There are 3 entity classes, one is the primary key class.
>
>Here normally if i am not using fetch group feature in 
>OpenJPA, during retrieval all fields will retrieved from 
>employee and department tables.
>
>But i need some fields from both the tables to be fetched first.
>
>By seeing fetch group documentation, i couldnt get a full idea 
>of how to configure fetch groups for related entities.
>
>So please give a sample configuration for the above scenario.
>
>

Notice:  This email message, together with any attachments, may contain information  of  BEA
Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,
 copyrighted  and/or legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by email and then delete it.

Mime
View raw message