[
https://issues.apache.org/jira/browse/OPENJPA-2258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449652#comment-13449652
]
Rick Curtis commented on OPENJPA-2258:
--------------------------------------
Can you please post a unit test that shows this behavior?
> OpenJPA is firing separate query for embedded class in the entity though
> annotted at @EagerFetchMode(FetchMode.JOIN)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-2258
> URL: https://issues.apache.org/jira/browse/OPENJPA-2258
> Project: OpenJPA
> Issue Type: Bug
> Components: jpa
> Affects Versions: 2.1.2
> Environment: 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
> Reporter: Sandip Bhoi
> Priority: Minor
> Labels: OpenJPA, Performance
>
> 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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira