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.

Reply via email to