Skip to content
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

Quarkus 3.17.1+ does not like 'get' methods on Panache (Kotlin) Entities #44846

Open
pschyma opened this issue Nov 30, 2024 · 6 comments
Open
Assignees
Labels
area/hibernate-orm Hibernate ORM kind/bug-thirdparty Bugs that are caused by third-party components and not causing a major dysfunction of core Quarkus.

Comments

@pschyma
Copy link

pschyma commented Nov 30, 2024

Describe the bug

I updated a project from 3.17.0 to 3.17.2 and started receiving exceptions in building and testing related to Hibernate bytecode enhancing:

    java.lang.RuntimeException at QuarkusTestExtension.java:628
        Caused by: java.lang.RuntimeException at AugmentActionImpl.java:355
            Caused by: io.quarkus.builder.BuildException at Execution.java:124
                Caused by: java.lang.reflect.UndeclaredThrowableException at ExtensionLoader.java:862
                    Caused by: java.util.concurrent.ExecutionException at FutureTask.java:122
                        Caused by: org.hibernate.bytecode.enhance.spi.EnhancementException at EnhancerImpl.java:131
                            Caused by: java.lang.StringIndexOutOfBoundsException at Preconditions.java:55

I traced it down to Hibernates Enhancer [1]. Starting from Quarkus 3.17.1 the Hibernate version used does not seem to like entities like

@Entity
class Entity(@Id var id: Long, var year: Int, var january: Double, var february: Double, ...) : PanacheEntityBase {
  operator fun get(month: Month) = ...

  companion object : PanacheCompanionBase<Entity, Long> {
   fun get(year: Int): Entity = ...
  }
}

The enhancer does not like both get methods.

[1] https://github.com/hibernate/hibernate-orm/blob/e14ead0c0f0916cc8fdb8895e2cc481754a75583/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/EnhancerImpl.java#L463

Expected behavior

Quarkus builds the project without any issues.

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Linux

Output of java -version

21

Quarkus version or git rev

3.17.1+

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.11.1

Additional information

I'm not sure whether this is a Quarkus or Hibernate issue; but since it's also occurring on Quarkus/ Panache companion objects, I decided to start here.

@pschyma pschyma added the kind/bug Something isn't working label Nov 30, 2024
Copy link

quarkus-bot bot commented Nov 30, 2024

/cc @FroMage (panache), @geoand (kotlin), @loicmathieu (panache)

@gsmet
Copy link
Member

gsmet commented Nov 30, 2024

Could you provide a reproducer? Preferably in Java if it's reproducible in pure Java.

If it's a pure Hibernate ORM issue, probably a good idea to try to reproduce it with plain https://github.com/hibernate/hibernate-test-case-templates/tree/main/orm/hibernate-orm-6 . If you can't, a Quarkus reproducer is fine.

From what I can see, it looks like an Hibernate ORM issue but I will let @yrodiere confirm once we have a reproducer.

Thanks!

@gsmet gsmet added area/hibernate-orm Hibernate ORM and removed area/panache labels Nov 30, 2024
@pschyma
Copy link
Author

pschyma commented Dec 1, 2024

I could reproduce it with just Hibernate ORM: https://hibernate.atlassian.net/browse/HHH-18903

@geoand geoand added kind/bug-thirdparty Bugs that are caused by third-party components and not causing a major dysfunction of core Quarkus. and removed area/kotlin kind/bug Something isn't working labels Dec 1, 2024
@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

Is #44863 related in any way?

@mbladel
Copy link
Contributor

mbladel commented Dec 4, 2024

Yep @geoand, this is also caused by the new check - though a slightly different case (method simply named get()), causing a different exception. I've already linked the Hibernate issue created by @pschyma as related to https://hibernate.atlassian.net/browse/HHH-18904, we should address both when reviewing the check logic.

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

Thanks again @mbladel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM kind/bug-thirdparty Bugs that are caused by third-party components and not causing a major dysfunction of core Quarkus.
Projects
None yet
Development

No branches or pull requests

4 participants