Community
Participate
Working Groups
Hi, Simple use case : TcRoot (Entity) -> TcEmbeddable (Embeddable) -> TcSubEntity (Entity) @Entity @Table(name = "TCEMB_ROOT") @SequenceGenerator(name = "SEQ_TCEMB_ROOT") public class TcRoot implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_TCEMB_ROOT") @Column(name = "TCEMB_ROOT_ID") private int id; @Embedded TcEmbeddable emb; } @Embeddable public class TcEmbeddable implements Serializable { @OneToOne @JoinColumn(name = "SUBE_ID", referencedColumnName = "TCEMB_SUBE_ID") @JoinFetch(JoinFetchType.INNER) TcSubEntity tcSE; } @Entity @Table(name = "TCEMB_SUBE") @SequenceGenerator(name = "SEQ_TCEMB_SUBE", sequenceName = "SEQ_TCEMB_SUBE") public class TcSubEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_TCEMB_SUBE") @Column(name = "TCEMB_SUBE_ID") private int id; } A find on TcRoot by Id results in 2 SQL Queries : - 1 retrieving TcRoot and TcEmbeddable attributes (deleted from the sample code for lisibility) - 1 retrieving TcSubEntity It should produce only one query. (Think this issue is extendable to @BatchFetch) Issue verified with 2.3.3 and 2.4.0
Any idea of where to search in eclipselink code ?
Created attachment 228984 [details] Patch on ObjectBuilder methods : getMappingForAttributeName and initializeJoinedAttributes
The attached Patch resolves the issue.
Why are you closing this bug? Is the patch somehow checked into the code stream?
Patch is not fully functional.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink