Open beikov opened 4 years ago
@sranjha Perhaps something for you 😄
Perhaps 😄
So far it works, but I haven't tried the main feature of interest - Entity Views.
https://github.com/soberich/marvel
It produces
13:51:45.363 [main] DEBUG o.h.p.entity.AbstractEntityPersister - Static SQL for entity: com.blazebit.persistence.impl.function.entity.ValuesEntity
13:51:45.364 [main] DEBUG o.h.p.entity.AbstractEntityPersister - Version select: /* get version com.blazebit.persistence.impl.function.entity.ValuesEntity */ select value from ( select * from ValuesEntity ) where value =?
13:51:45.364 [main] DEBUG o.h.p.entity.AbstractEntityPersister - Snapshot select: /* get current state com.blazebit.persistence.impl.function.entity.ValuesEntity */ select valuesenti_.value from ( select * from ValuesEntity ) valuesenti_ where valuesenti_.value=?
13:51:45.364 [main] DEBUG o.h.p.entity.AbstractEntityPersister - Insert 0: /* insert com.blazebit.persistence.impl.function.entity.ValuesEntity */ insert into ( select * from ValuesEntity ) (value) values (?)
13:51:45.364 [main] DEBUG o.h.p.entity.AbstractEntityPersister - Update 0: null
13:51:45.364 [main] DEBUG o.h.p.entity.AbstractEntityPersister - Delete 0: /* delete com.blazebit.persistence.impl.function.entity.ValuesEntity */ delete from ( select * from ValuesEntity ) where value=?
13:51:45.400 [main] DEBUG o.h.l.p.b.spi.LoadPlanTreePrinter - LoadPlan(entity=com.blazebit.persistence.impl.function.entity.ValuesEntity)
- Returns
- EntityReturnImpl(entity=com.blazebit.persistence.impl.function.entity.ValuesEntity, querySpaceUid=<gen:0>, path=com.blazebit.persistence.impl.function.entity.ValuesEntity)
- QuerySpaces
- EntityQuerySpaceImpl(uid=<gen:0>, entity=com.blazebit.persistence.impl.function.entity.ValuesEntity)
- SQL table alias mapping - valuesenti0_
- alias suffix - 0_
- suffixed key columns - {value1_4_0_}
13:51:45.403 [main] DEBUG o.h.l.p.b.spi.LoadPlanTreePrinter - LoadPlan(entity=com.blazebit.persistence.impl.function.entity.ValuesEntity)
- Returns
- EntityReturnImpl(entity=com.blazebit.persistence.impl.function.entity.ValuesEntity, querySpaceUid=<gen:0>, path=com.blazebit.persistence.impl.function.entity.ValuesEntity)
- QuerySpaces
- EntityQuerySpaceImpl(uid=<gen:0>, entity=com.blazebit.persistence.impl.function.entity.ValuesEntity)
- SQL table alias mapping - valuesenti0_
- alias suffix - 0_
- suffixed key columns - {value1_4_0_}
So integration works with stack
having JAVA_HOME
set to Java 14 installation you can launch with
git clone -b micronaut-template git@github.com:soberich/marvel.git micronaut-template && cd $_ && ./gradlew runShadow
Next I'll be adding entity views and make it more "examplish" more simple.
I am getting this
Caused by: java.lang.ClassNotFoundException: com.blazebit.persistence.spi.JpqlFunctionKind
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 71 common frames omitted
quarkus-bom
depends on Blaze of earlier version, so I had to use enforcedPlatform
.It launches fine now.
@beikov I got it working, I think Blaze Persistence is really a cherry on a pie. It's a great library. There is a bug. If entity class extends generic mappedsuperclass type
class RecordEntity : AbstractAuditingEntity<RecordEntity.RecordId>()
with NPE
context.getElementUtils().getTypeElement(entityElement.getSuperclass().toString()); // returns null!!
returns null
.
A workaround I did is to just to "mask" it.
class RecordEntity : GenericTypeMask()
Then it works.
Thanks for the report @soberich, I will look into this issue. Are you saying that there is no need for a micronaut integration because everything just works when using the annotation processor?
The PR https://github.com/Blazebit/blaze-persistence/pull/1149 will come with a fix for the issue that you found @soberich
The PR #1149 will come with a fix for the issue that you found @soberich
Thanks for letting me know.
Thanks for the report @soberich, I will look into this issue. Are you saying that there is no need for a micronaut integration because everything just works when using the annotation processor?
So far, yes. I will continue trying more edge cases. Hence, it's not valid to say "everything" until I'll finally write tests. I might be slow to report, I am trying to marry a lot of technologies in that playground, so there are some side effects when I introduce something new. Annotation processor is a great solution, I think. I remember we talked ByteBuddy vs. Javassist, I am am happy with annotation processor much more. I'll report whatever I find.
Would be cool if Blaze-Persistence could be used in a Micronaut application. Maybe it's already possible, but we should create a sample project and if we need something special, we should write an integration.