Description
I'm trying to port Apiman to use BlazePersistence instead of the JPA Criteria API to avoid losing my mind with its bizarre syntax 😂.
However, I seem to have hit a blocker.
We use composite keys/ids in our model in a few places via @IdClass. This is something we can't change for compatibility reasons (unless there's a compatible workaround you are aware of).
It seems that the particular @Entity design we're using works fine with CriteriaAPI, standard Hibernate, etc, but trips up Blaze Persistence somehow. This may be related to #399, not sure?
The TL;DR is that it seems it can't traverse that ID properly, and the only thing I can think of is @IdClass.
Expected behaviour
Should be able to handle this @Entity sample's graph, as it works in Hibernate + Criteria API.
Actual behaviour
The error displayed is:
2022-01-25 16:02:15,899 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): org.hibernate.QueryException: could not resolve property: client.id of: io.apiman.manager.api.beans.clients.ClientVersionBean
at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:77)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:71)
at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyType(AbstractEntityPersister.java:5124)
at com.blazebit.persistence.integration.hibernate.base.HibernateJpaProvider.hasJoinCondition(HibernateJpaProvider.java:1414)
at com.blazebit.persistence.impl.EntityMetamodelImpl$AttributeEntry.<init>(EntityMetamodelImpl.java:1060)
at com.blazebit.persistence.impl.EntityMetamodelImpl.collectIdColumns(EntityMetamodelImpl.java:484)
at com.blazebit.persistence.impl.EntityMetamodelImpl.collectColumnNames(EntityMetamodelImpl.java:394)
at com.blazebit.persistence.impl.EntityMetamodelImpl.<init>(EntityMetamodelImpl.java:127)
at com.blazebit.persistence.impl.CriteriaBuilderFactoryImpl.<init>(CriteriaBuilderFactoryImpl.java:110)
at com.blazebit.persistence.impl.CriteriaBuilderConfigurationImpl.createCriteriaBuilderFactory(CriteriaBuilderConfigurationImpl.java:2018)
at com.blazebit.persistence.integration.quarkus.runtime.EntityViewRecorder.lambda$criteriaBuilderFactorySupplier$0(EntityViewRecorder.java:56)
at com.blazebit.persistence.CriteriaBuilderFactory_2f29ab4902e863bcf38a5a9ab37269748362ecdd_Synthetic_Bean.create(Unknown Source)
at com.blazebit.persistence.CriteriaBuilderFactory_2f29ab4902e863bcf38a5a9ab37269748362ecdd_Synthetic_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
at com.blazebit.persistence.CriteriaBuilderFactory_2f29ab4902e863bcf38a5a9ab37269748362ecdd_Synthetic_Bean.get(Unknown Source)
at com.blazebit.persistence.CriteriaBuilderFactory_2f29ab4902e863bcf38a5a9ab37269748362ecdd_Synthetic_Bean.get(Unknown Source)
at org.acme.Main_Bean.create(Unknown Source)
at org.acme.Main_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
at org.acme.Main_Observer_startup_f43ab41051de39ca1e534f6cd06115c3c9b219b8.notify(Unknown Source)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:320)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:302)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:128)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:97)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.Nati
Steps to reproduce
. https://www.github.com/msavy/reproducer-for-blazepersistence.git
. ./mvnw compile quarkus:dev (or whatever you prefer).
. First, see Main.java for bootstrapping, and then io.apiman.manager.api.beans.*
. @IdClass seems to work in some simpler setups, but not this one.
Environment
Please see reproducer for additional details, but:
Version: 1.6.5
JPA-Provider: Hibernate: 5.6.4
DBMS: com.h2database.h2-1.4.197.jar
Application Server: Quarkus
Description
I'm trying to port Apiman to use BlazePersistence instead of the JPA Criteria API to avoid losing my mind with its bizarre syntax 😂.
However, I seem to have hit a blocker.
We use composite keys/ids in our model in a few places via
@IdClass. This is something we can't change for compatibility reasons (unless there's a compatible workaround you are aware of).It seems that the particular
@Entitydesign we're using works fine with CriteriaAPI, standard Hibernate, etc, but trips up Blaze Persistence somehow. This may be related to #399, not sure?The TL;DR is that it seems it can't traverse that ID properly, and the only thing I can think of is
@IdClass.Expected behaviour
Should be able to handle this
@Entitysample's graph, as it works in Hibernate + Criteria API.Actual behaviour
The error displayed is:
Steps to reproduce
. https://www.github.com/msavy/reproducer-for-blazepersistence.git
.
./mvnw compile quarkus:dev(or whatever you prefer).. First, see
Main.javafor bootstrapping, and thenio.apiman.manager.api.beans.*.
@IdClassseems to work in some simpler setups, but not this one.Environment
Please see reproducer for additional details, but:
Version: 1.6.5
JPA-Provider: Hibernate: 5.6.4
DBMS: com.h2database.h2-1.4.197.jar
Application Server: Quarkus