New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JPA meta model generation fails in 3.7.0.CR1 #38378
Comments
A workaround would be to change the version of the hibernate-jpamodelgen annotation processor to an earlier version, like |
/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive), @gsmet (hibernate-orm), @mswatosh (db2), @yrodiere (hibernate-orm) |
Thanks for reporting. I checked that upgrading to maven-compiler-plugin Hey @gavinking , this looks like a bug in jpamodelgen, or at least a side effect: For some reason the generated code of @StaticMetamodel(PanacheEntity.class)
public abstract class PanacheEntity_ {
public static volatile SingularAttribute<PanacheEntity, Long> id;
@Nonnull
private final EntityManager entityManager;
public static volatile MappedSuperclassType<PanacheEntity> class_;
public static final String ID = "id";
@Inject
public PanacheEntity_(@Nonnull EntityManager entityManager) {
this.entityManager = entityManager;
}
@Nonnull
public EntityManager getEntityManager() {
return this.entityManager;
}
} And the generated code for @StaticMetamodel(MyEntity.class)
@Generated("org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
public abstract class MyEntity_ extends io.quarkus.hibernate.orm.panache.PanacheEntity_ {
/**
* @see org.acme.MyEntity#field
**/
public static volatile SingularAttribute<MyEntity, String> field;
/**
* @see org.acme.MyEntity
**/
public static volatile EntityType<MyEntity> class_;
public static final String FIELD = "field";
} FWIW the code of @Entity
public class MyEntity extends PanacheEntity {
public String field;
} |
I suspect this is a bug in how Hibernate ORM 6.4's jpamodelgen handles inheritance, at least when inheriting classes from external JARs. I'll mark this as |
I'm working on adding integration tests in Quarkus in the meantime -- and I might have an ugly workaround, too. We'll still need a fix upstream at some point though. |
FWIW I reported the problem upstream: https://hibernate.atlassian.net/browse/HHH-17683 And created an issue about reverting our workaround: #38451 |
Describe the bug
Using the
hibernate-jpamodelgen
annotation processor with Quarkus 3.7.0.CR1 fails in the compile stage with an odd error about a mapped superclass constructor needing the EntityManager as a parameter. This is a new error with 3.7.0.CR1; changing the attached reproducer to use 3.6.7 compiles without error.Expected behavior
The project will compile without error and generate a meta model class.
Actual behavior
Compilation error:
How to Reproduce?
jpamodelgen-with-quarkus.zip
Output of
uname -a
orver
Linux ---- 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.9" 2023-10-17
Quarkus version or git rev
3.7.0.CR1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Additional information
No response
The text was updated successfully, but these errors were encountered: