Coder Social home page Coder Social logo

Hibernate bumps to leads to Hibernate Reactive NPE and Hibernate Validation constraint validation failures where it shouldn't about quarkus HOT 16 OPEN

michalvavrik avatar michalvavrik commented on June 12, 2024
Hibernate bumps to leads to Hibernate Reactive NPE and Hibernate Validation constraint validation failures where it shouldn't

from quarkus.

Comments (16)

fedinskiy avatar fedinskiy commented on June 12, 2024 2

@DavideD I prepared a minimalistic reproducer, which doesn't involve the TS.

  1. git clone https://github.com/fedinskiy/reproducer -b db-panache-no-update
  2. mvn quarkus:dev
  3. curl -X PUT http://localhost:8080/library/book/2/Around_the_World_in_Eighty_Days # fails
  4. mvn quarkus:dev -Dquarkus.platform.version=3.10.0
$ curl -X PUT http://localhost:8080/library/book/2/Around_the_World_in_Eighty_Days # succeeds
4
$ curl -XGET http://localhost:8080/library/book/4
Around_the_World_in_Eighty_Days

There is also a test, ResourceTest, which does the same. mvn clean test fails, mvn clean test -Dquarkus.platform.version=3.10.0 succeeds

UPD: It also looks like, that this error affects Postgres and Oracle, but not MariaDB, MySQL, or MSSQL

from quarkus.

DavideD avatar DavideD commented on June 12, 2024 1

I guess. I will check.

from quarkus.

DavideD avatar DavideD commented on June 12, 2024 1

I have some test failures, but I see a different error.
I'm working on it

from quarkus.

quarkus-bot avatar quarkus-bot commented on June 12, 2024

/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive)

from quarkus.

michalvavrik avatar michalvavrik commented on June 12, 2024

cc @yrodiere @Sanne

from quarkus.

yrodiere avatar yrodiere commented on June 12, 2024

Hey @DavideD , could this be a regression in Hibernate Reactive?

from quarkus.

DavideD avatar DavideD commented on June 12, 2024

@michalvavrik Not sure if this is related, but an association in Hibernate is supposed to be mapped in a different way than the one in the tests.

It should be:

@Entity
class Book {
   ...
    @ManyToOne
    Author author;
   ...
}

Is there a specific reason for the test to use just the id?

from quarkus.

michalvavrik avatar michalvavrik commented on June 12, 2024

I have some test failures, but I see a different error.

Sorry, it was late night, if you want adjustments to the reproduce, just shout!

Is there a specific reason for the test to use just the id?

Hey @DavideD ,

In general, we just try to identify legit cases, I don't think it is required for this particular test. So we can change this. Before we do so, I'd like to understand this is not supported / encouraged use case:

class Book {
@NotNull
private Integer author;
}

I'd think that mapping only id when I don't need to work with entity is logical. I suppose if an entity instance is lazy loaded but still contains PK (that is loaded eagerly) then I can use the entity data type instead. So people shouldn't do this but it worked (with quotes :-)) in past and now the validation is improved?

from quarkus.

DavideD avatar DavideD commented on June 12, 2024

It's supported in the sense that it should work for simple cases. Not encouraged.

But:

  • it's not mentioned in the official Hibernate documentation
  • Hibernate is not aware that that's an association, meaning that they are not covered by these tests
  • users might not understand that this approach is not encouraged and copy it

That said, I don't know the requirements for this project.
And I don't think it's related to this issue, so I will move on.

from quarkus.

DavideD avatar DavideD commented on June 12, 2024

Sorry, I couldn't figure out why it's not working in Quarkus.
I've created a test for Hibernate Reactive and it seems to work as expected.

I couldn't really launch the test suite, when I've tried manually the validation didn't seem to work.
I think an error is happening when Hibernate is trying to initialize Validator: https://github.com/hibernate/hibernate-orm/blob/9ba0dd7af03d63dc39ce0ac8acd6688803ea0af9/hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java#L139

In theory, it should call TypeSafeActivator, but something happens before reaching that point. But the debugger couldn't tell me anything.

It's worth mentioning, that if something goes wrong with the creation of the validator factory, Hibernate won't say anything about it.

I don't think I will have more time to work on this, if somebody wants to continue.

from quarkus.

michalvavrik avatar michalvavrik commented on June 12, 2024

Thank you for the time you put into the investigation @DavideD .

from quarkus.

DavideD avatar DavideD commented on June 12, 2024

Thanks a lot! I can finally see the nullpointer and I'm trying to figure out what's going on.

from quarkus.

DavideD avatar DavideD commented on June 12, 2024

Ooops...

from quarkus.

fedinskiy avatar fedinskiy commented on June 12, 2024

@DavideD "debugging is a murder mystery, there you are a detective, a culprit and a victim".

Can we expect a fix during this week, or we better disable the affected tests for a while?

from quarkus.

yrodiere avatar yrodiere commented on June 12, 2024

Can we expect a fix during this week, or we better disable the affected tests for a while?

The latter. Even if @DavideD is going to work during his PTO (bad!), there's little chance the fix makes its way to a Hibernate Reactive release and a Quarkus release by the end of the week.

from quarkus.

DavideD avatar DavideD commented on June 12, 2024

Yes, sorry. Like Yoann said. At the moment, I can't make any promises.

from quarkus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.