From eaa0fbb022447a7f4d76e44a78451ea822cb2e65 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Thu, 30 May 2019 18:21:32 +0200 Subject: [PATCH 1/2] Upgrade Hibernate ORM to 5.4.3 Fixes #2634 Fixes #2223 --- bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/pom.xml b/bom/pom.xml index 08bbe283bab76..104af4f08d41c 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -92,7 +92,7 @@ 1.3.4 3.0.1.b11 6.1.0.Alpha4 - 5.4.2.Final + 5.4.3.Final 6.0.0.Alpha6 5.9.3.Final 1.1.1.Final From 6fef5e5b78a35e67a73b3efa29c942667d3649e9 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Mon, 3 Jun 2019 15:02:08 +1000 Subject: [PATCH 2/2] Generate correct signatures for panache entities --- .../hibernate/orm/panache/deployment/EntityField.java | 1 + .../orm/panache/deployment/PanacheJpaEntityEnhancer.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/EntityField.java b/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/EntityField.java index 1845c79b95dce..833665fcbe617 100644 --- a/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/EntityField.java +++ b/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/EntityField.java @@ -4,6 +4,7 @@ public class EntityField { final String name; final String descriptor; + String signature; public EntityField(String name, String descriptor) { this.name = name; diff --git a/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheJpaEntityEnhancer.java b/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheJpaEntityEnhancer.java index fde9bb84927f3..8c505a79b4624 100644 --- a/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheJpaEntityEnhancer.java +++ b/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheJpaEntityEnhancer.java @@ -79,8 +79,10 @@ public ModelEnhancingClassVisitor(String className, ClassVisitor outputClassVisi @Override public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) { FieldVisitor superVisitor = super.visitField(access, name, descriptor, signature, value); - if (fields == null || !fields.containsKey(name)) + EntityField ef = fields.get(name); + if (fields == null || ef == null) return superVisitor; + ef.signature = signature; // if we have a mapped field, let's add some annotations return new FieldVisitor(Opcodes.ASM6, superVisitor) { private Set descriptors = new HashSet<>(); @@ -340,7 +342,7 @@ private void generateAccessors() { String getterDescriptor = "()" + field.descriptor; if (!methods.contains(getterName + "/" + getterDescriptor)) { MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, - getterName, getterDescriptor, null, null); + getterName, getterDescriptor, field.signature == null ? null : "()" + field.signature, null); mv.visitCode(); mv.visitIntInsn(Opcodes.ALOAD, 0); // Due to https://github.com/quarkusio/quarkus/issues/1376 we generate Hibernate read/write calls @@ -385,7 +387,7 @@ private void generateAccessors() { String setterDescriptor = "(" + field.descriptor + ")V"; if (!methods.contains(setterName + "/" + setterDescriptor)) { MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, - setterName, setterDescriptor, null, null); + setterName, setterDescriptor, field.signature == null ? null : "(" + field.signature + ")V", null); mv.visitCode(); mv.visitIntInsn(Opcodes.ALOAD, 0); int loadCode;