Khurelkhuyag M. (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-11275 (
https://hibernate.atlassian.net/browse/HHH-11275?atlOrigin=eyJpIjoiNjE0Nz...
)
Re: Support SUBSELECT or SELECT FetchMode on @FetchProfile (
https://hibernate.atlassian.net/browse/HHH-11275?atlOrigin=eyJpIjoiNjE0Nz...
)
As a workaround, In the previous project, I decided to map multiple entities to a single
table. In this way, I can choose what attributes are eagerly loaded.
For listing purposes, I can use OrderSummary `. Because the list usually doesn’t require
much. But on the detailed page, I can use OrderDetailed ` It will load attributes via
additional select.
@Entity
@Table(name = "order" )
@Immutable
class OrderSummary {
@Id
private Long id;
private BigDecimal total;
}
@Entity
@Table(name = "order" )
class OrderDetailed {
@Id
private Long id;
private BigDecimal total;
@Fetch(FetchMode.SUBSELECT)
@OneToMany(fetch = FetchType.EAGER)
private List<OrderItem> items;
@OrderBy( "createdAt DESC" )
@Fetch(FetchMode.SUBSELECT)
@OneToMany(fetch = FetchType.EAGER)
private List<OrderHistoryRecord> history;
}
I know I could load attributes via Hibernate.initialize(). But initialization is better to
happen at the persistence layer.
I don’t understand why no one is interested that configuration controlled sub select
fetching is can be useful.
(
https://hibernate.atlassian.net/browse/HHH-11275#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-11275#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100210- sha1:a877796 )