Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.1.2
-
None
-
WebSphere Platform 8.0.0.2 [BASE 8.0.0.2 cf021148.03]
Host Operating System is Windows XP, version 5.1
Java version = 1.6.0, Java Compiler = j9jit26, Java VM name = IBM J9 VM
Orb Version = IBM Java ORB build orb626-20111107.00
Description
I have a Embedded class in my entity which has some common similar columns for all the tables.
e.g
@Entity
@Table(name = "MY_TABLE")
public class MyTable implements Serializable {
//... some specific fields here
@Embedded
@EagerFetchMode(FetchMode.JOIN)
private CommonRowDetails commonRowDetails;
//...getters and setter below
}
And the class CommonRowDetails contains some audit columns as
@Embeddable
public class CommonRowDetails implements Serializable {
@Column(name = "ROW_ADD_STP", updatable = false)
private Date rowAddStp;
@Column(name = "ROW_ADD_USER_ID", updatable = false)
private String rowAddUserId;
@Column(name = "ROW_UPDATE_USER_ID")
private String rowUpdateUserId;
@Column(name = "ROW_UPDATE_STP")
private Date rowUpdateStp;
//...getters and setter below
}
All above columns are part of same table "MY_TABLE"
So when I select the entity MyTable, I can see a separate query is getting executed for selecting (ROW_ADD_STP, ROW_ADD_USER_ID, ...) which is definitely not required. I also added the annotation @EagerFetchMode(FetchMode.JOIN) on field CommonRowDetails to select those with join/in same query.
Please help me to know, how to avoid OpenJPA firing a separate query.