[hibernate-dev] Re: FetchMode.SELECT

2021-01-07 Thread Christian Beikov
I agree that this should be supported. Specifying a fetch mode should 
IMO not change the fetch type to LAZY or EAGER.


Am 06.01.2021 um 04:50 schrieb Gail Badner:

Should it be possible to force an eager association to be loaded by a
separate query using @Fetch(FetchMode.SELECT)?

I thought that Hibernate supported that for an EAGER association, but I see
the documentation for FetchMode.SELECT

says:

"SELECT
The association is going to be fetched lazily using a secondary select for
each individual entity, collection, or join load. It’s equivalent to
JPA FetchType.LAZY fetching strategy."

The reason I ask is because I am trying to wrap up HHH-13085, which will
change derived IDs mapped as a one-to-one association, currently loaded by
a separate query, to instead be loaded in the same query that loads the
dependent entity. I want to ensure that it is possible to revert back to
loading that one-to-one association in a separate query after HHH-13085 is
fixed.

Currently, a StackOverflowError is thrown when loading an entity with an ID
that is an bidirectional eager one-to-one association has FetchMode.SELECT
mapped.

@Entity(name = "Foo")public class Foo implements Serializable {

 @Id
 @GeneratedValue
 private Long id;

 @OneToOne(mappedBy = "foo", cascade = CascadeType.ALL)
 private Bar bar;
}

@Entity(name = "Bar")public class Bar implements Serializable {
@Id
 @OneToOne(fetch = FetchType.EAGER)
 @Fetch(FetchMode.SELECT)
 @JoinColumn(name = "BAR_ID")
 private Foo foo;
}


According to the documentation, it sounds like @Fetch(FetchMode.SELECT)
should make the association lazy. Is that really correct?

Could someone please clarify the expected behavior?

I created HHH-14390  for
the StackOverflowError. I've pushed some FailureExpected tests

that reproduce this issue.

Thanks,
Gail
___
hibernate-dev mailing list -- hibernate-dev@lists.jboss.org
To unsubscribe send an email to hibernate-dev-le...@lists.jboss.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

___
hibernate-dev mailing list -- hibernate-dev@lists.jboss.org
To unsubscribe send an email to hibernate-dev-le...@lists.jboss.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[hibernate-dev] Hibernate Reactive : Beta2 now available

2021-01-07 Thread Sanne Grinovero
Hi all,

please see
 - https://in.relation.to/2021/01/07/hibernate-reactive-beta2/

Thanks!
___
hibernate-dev mailing list -- hibernate-dev@lists.jboss.org
To unsubscribe send an email to hibernate-dev-le...@lists.jboss.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s