hibernate-reactive
hibernate-reactive copied to clipboard
Example session-example doesn't work in jakarta/main
We are already using the latest ORM that should have fixed the issue.
The session-example module is currently disabled: a9027ad22e0af642a05ace4912421d151ee713fd
I've tested again with ORM 5.6.9.Final and it's still not working
This is the exception running session-example:
Exception in thread "main" java.lang.ClassCastException: class org.hibernate.reactive.example.session.Book cannot be cast to class org.hibernate.engine.spi.PersistentAttributeInterceptable (org.hibernate.reactive.example.session.Book and org.hibernate.engine.spi.PersistentAttributeInterceptable are in unnamed module of loader 'app')
at org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyProperty(AbstractEntityPersister.java:1112)
at org.hibernate.reactive.persister.entity.impl.ReactiveAbstractEntityPersister.reactiveInitializeLazyProperty(ReactiveAbstractEntityPersister.java:1141)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.reactiveFetch(ReactiveSessionImpl.java:277)
at org.hibernate.reactive.mutiny.impl.MutinySessionImpl.lambda$fetch$1(MutinySessionImpl.java:73)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage.subscribe(UniCreateFromCompletionStage.java:24)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniRunSubscribeOn.lambda$subscribe$0(UniRunSubscribeOn.java:27)
at org.hibernate.reactive.context.impl.VertxContext.execute(VertxContext.java:90)
at io.smallrye.mutiny.operators.uni.UniRunSubscribeOn.subscribe(UniRunSubscribeOn.java:25)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemConsume.subscribe(UniOnItemConsume.java:30)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onItem(UniOperatorProcessor.java:46)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at io.vertx.core.Future.lambda$toCompletionStage$2(Future.java:360)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:102)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:35)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.Promise.handle(Promise.java:51)
at io.vertx.core.Promise.handle(Promise.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:81)
at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:173)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49)
at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:41)
at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.command.CommandResponse.fire(CommandResponse.java:46)
at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:287)
at io.vertx.pgclient.impl.PgSocketConnection.handleMessage(PgSocketConnection.java:96)
at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:100)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:50)
at io.vertx.core.impl.ContextImpl.emit(ContextImpl.java:274)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:22)
at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:394)
at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:155)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.vertx.pgclient.impl.codec.PgEncoder.lambda$write$0(PgEncoder.java:98)
at io.vertx.pgclient.impl.codec.PgCommandCodec.handleReadyForQuery(PgCommandCodec.java:139)
at io.vertx.pgclient.impl.codec.PgDecoder.decodeReadyForQuery(PgDecoder.java:237)
at io.vertx.pgclient.impl.codec.PgDecoder.channelRead(PgDecoder.java:96)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
Nevermind, this was an issue with the example. I was using the wrong fetch after I've remove the gradle plugin
I will reopen this one becaus eI need to update the examples
I think this is a bug in ORM, I've converted the example to work with ORM here: https://github.com/DavideD/jakarta-lazy-fields
I'm waiting for the ORM team to confirm this
What's the current status of this?
The project that only uses ORM seems to work as expected now (with ORM 5.6.11.Final). I think it's just something wrong with dependencies we use for the examples.
I will double check them later.
@blafond Do you have time to look into this? It's about reverting this commit and double checking the dependencies on the jakarta/main branch.
sure.
I'll pull the branch and start on it.
I have to leave for a couple hours in a bit to take my wife to a Dr. appmnt but will continue when I get back
On Thu, Sep 29, 2022 at 7:31 AM DavideD @.***> wrote:
@blafond https://github.com/blafond Do you have time to look into this? It's about reverting this commit https://github.com/hibernate/hibernate-reactive/commit/a9027ad22e0af642a05ace4912421d151ee713fd and double checking the dependencies on the jakarta/main branch.
— Reply to this email directly, view it on GitHub https://github.com/hibernate/hibernate-reactive/issues/1273#issuecomment-1262209929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEI4DXOB7V3SHYLWKKQRXLWAWD2NANCNFSM5T3XGPDA . You are receiving this because you were mentioned.Message ID: @.***>
Sure
I gotta leave...
Pulled the branch, added back in the session-example and the build succeeded.
On Thu, Sep 29, 2022 at 7:58 AM DavideD @.***> wrote:
Sure
— Reply to this email directly, view it on GitHub https://github.com/hibernate/hibernate-reactive/issues/1273#issuecomment-1262241131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEI4DQF272W62G7WVFNWPDWAWG6RANCNFSM5T3XGPDA . You are receiving this because you were mentioned.Message ID: @.***>
The build doesn't run the examples and doesn't start the db (maybe it should do both).
You need to start the database manually and then use the following command:
./gradlew :session-example:runAllExamplesOnPostgreSQL
Anyway, there's no hurry. You can check when you have time and let me know.
I ran main (succeeded) jakarta/main with session-example enabled I get:
Caused by: java.lang.ClassCastException: class org.hibernate.reactive.example.session.Book cannot be cast to class org.hibernate.engine.spi.PersistentAttributeInterceptable (org.hibernate.reactive.example.session.Book and org.hibernate.engine.spi.PersistentAttributeInterceptable are in unnamed module of loader 'app')
at org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyProperty(AbstractEntityPersister.java:1112)
at org.hibernate.reactive.persister.entity.impl.ReactiveAbstractEntityPersister.reactiveInitializeLazyProperty(ReactiveAbstractEntityPersister.java:1141)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.reactiveFetch(ReactiveSessionImpl.java:277)
at org.hibernate.reactive.stage.impl.StageSessionImpl.lambda$fetch$2(StageSessionImpl.java:72)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
... 67 more
Seems to work now: https://github.com/hibernate/hibernate-reactive/pull/1536