Comments (8)
I created a hibernate bug (though I'm not 100% sure it's not originating from Quarkus integration yet): https://hibernate.atlassian.net/browse/HHH-17750
Thanks for taking a closer look. I have reproduced a similar error with just ORM; let's track the progress of this in the issue you've created in ORM JIRA.
from quarkus.
/cc @gsmet (hibernate-orm), @yrodiere (hibernate-orm)
from quarkus.
I created a hibernate bug (though I'm not 100% sure it's not originating from Quarkus integration yet): https://hibernate.atlassian.net/browse/HHH-17750
from quarkus.
Stack trace when GreetingResource:37 is uncommented in the reproducer:
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:4168)
at org.hibernate.engine.internal.ForeignKeys.isTransient(ForeignKeys.java:293)
at org.hibernate.type.EntityType.replace(EntityType.java:315)
at org.hibernate.type.TypeHelper.replace(TypeHelper.java:88)
at org.hibernate.event.internal.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:576)
at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:427)
at org.hibernate.event.internal.DefaultMergeEventListener.merge(DefaultMergeEventListener.java:208)
at org.hibernate.event.internal.DefaultMergeEventListener.doMerge(DefaultMergeEventListener.java:146)
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:126)
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:847)
at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:833)
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.merge(TransactionScopedSession.java:156)
at org.hibernate.engine.spi.SessionLazyDelegator.merge(SessionLazyDelegator.java:271)
at org.hibernate.Session_OpdLahisOZ9nWRPXMsEFQmQU03A_Synthetic_ClientProxy.merge(Unknown Source)
at org.acme.services.ServiceB.doSomething(ServiceB.java:36)
at org.acme.services.ServiceB_Subclass.doSomething$$superforward(Unknown Source)
at org.acme.services.ServiceB_Subclass$$function$$4.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:136)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:107)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:61)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
at org.acme.services.ServiceB_Subclass.doSomething(Unknown Source)
at org.acme.services.ServiceB_ClientProxy.doSomething(Unknown Source)
at org.acme.GreetingResource.hello(GreetingResource.java:37)
at org.acme.GreetingResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:582)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1583)```
from quarkus.
Note: We noticed this error only occurs when the entity behind the lazy relation has a @Version
field. I edited original post accordingly. The reproducer will be updated as well.
from quarkus.
@marko-bekhta I think this issue is typically mitigated in various frameworks:
- Spring has "Open session in view".
- Wildfly seems to have a similar mechanism by default (our application is migrating from Wildfly and the problem wasn't present).
- Eclipselink (JPA RI) also allows to access lazy properties of detached entities by default (not even sure you can disable that).
enable_lazy_load_no_trans
is mentioned in multiple sources, although I tried to activate it withquarkus.hibernate-orm.unsupported-properties."hibernate.enable_lazy_load_no_trans"=true
, which is actually being read, but I couldn't find any usage besides configuration in Hibernate 6.4.
So I'm wondering: shouldn't Quarkus provide a similar mechanism?
from quarkus.
@ymajoros Feel free to open a feature request (or, more likely, link to an existing one), we can discuss that there.
Though I need to mention that "Open session in view" is widely considered as an anti-pattern, so the discussion (and eventual solution) will have to address that.
from quarkus.
Good idea, I'll check out how to open a feature request if it's the way to go.
It's considered an antipattern by Vlad, which doesn't make it widely accepted. It's the default in Spring, Wildfly and equivalently in the reference implementation (Eclipselink does it by default). It's an endless discussion, I'm well aware of the pro's and con's, but truth is: if you have more than 1 transaction and lazy relations, you will end up with the need to fetch them outside of the first transaction. Projections our (which basically comes down to eager fetching) isn't always the right solution for that.
from quarkus.
Related Issues (20)
- Quarkus 3.8.1: Use GraalVM sdk 23.1.2 over 23.0.1 HOT 10
- JPA find and locking a lazy referenced entity fails HOT 6
- Support programmatically created OidcClients in custom OIDC Client filters HOT 1
- ./mvnw --file $(pwd)/./pom.xml broken since quarkus 3.7.1 HOT 1
- Simplify configuration based mapping of token roles to deployment-specific SecurityIdentity HOT 8
- Update the title of dev-ui.adoc HOT 1
- Quarkus Kogito code generator plugin still using javax HOT 2
- Quarkus can't see my Clojure classes. HOT 1
- Renaming reactive messaging to Quarkus messaging HOT 3
- Binding error in azure app functions HOT 1
- Invalid channel configuration - the `connector` attribute must be set for channel `news$1` when setting the concurrency attribute HOT 2
- `SQLException: Unable to enlist connection to existing transaction` when accessing multiple persistence units in the same transaction since 3.8.2 HOT 115
- Bump grpc.version from 1.59.1 to 1.61.0 for Quarkus 3.8 as well HOT 6
- Rest client doesn't get generated when interface annotations are inherited HOT 16
- Validate that http and https are not on the same port HOT 3
- Quarkus OIDC Client: Lazy OIDC Discovery HOT 3
- Complete OIDC Request and Response logging support HOT 1
- Extend OidcClient to support UserInfo, token introspection and token revocation for all token types HOT 2
- Hibernate ORM: package-info is ignored when specifying scan packages HOT 2
- Remove kubernetes client split package check HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quarkus.