openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject Re: Regarding Fetch groups in OpenJPA
Date Thu, 18 Oct 2007 12:48:13 GMT
Vivek,
There are a couple of examples in the OpenJPA test bucket:

org.apache.openjpa.persistence.fetchgroups.FGEmployee.java
org.apache.openjpa.persistence.fetchgroupsFGManager.java

If you don't have the source downloaded, you can view it via the svn viewer:

http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fetchgroups/FGEmployee.java?view=markup
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fetchgroups/FGManager.java?view=markup

Kevin

On 10/18/07, vivek <vivekmv@geojit.com> wrote:
>
> 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.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message