Hibernate-reactive: Id of type UUID cannot be retrieved with MariaDB and MySQL

Created on 19 Mar 2021  ·  17Comments  ·  Source: hibernate/hibernate-reactive

The entity is in the db but a find will return null

bug

All 17 comments

I think this is a problem with the Vert.x SQL client but I need to check with a test

I've found the problem.
The table has a column defined as binary(255) but the UUID is created as a binary(16). This work for the other dialect but not for MySQL/MariaDB with vert.x SQL client

Hrm, yeah, looks this is a bug I fixed in H6, by fixing the broken default column length for UUIDBinaryType. I set it to 16 by default. In H5, the column length defaults to something stupid (255 apparently).

I've created an issue for the Vert.x SQL client: https://github.com/eclipse-vertx/vertx-sql-client/issues/922
This seems a bug considering that it works for all the other databases.

I guess a workaround at the moment is to define the type of the column:

        @Column(columnDefinition = "binary(16)")
        UUID id;

Honestly I'm not sure if it's a driver bug because I feel like I've run into the same issue with JDBC.

But I might be misremembering.

Something motivated me to go and fix the issue in H6.

I guess a workaround at the moment is to define the type of the column

Yes, of course, exactly.

Maybe I can change the UUIDType when using reactive

No because in H5 a type can't determine the column length.

I had to build a whole infrastructure for that in H6. And IIRC it wasn't that trivial.

Honestly I'm not sure if it's a driver bug because I feel like I've run into the same issue with JDBC.

I've tested it and it seems to work when I use Hibernate ORM and JDBC

I had to build a whole infrastructure for that in H6. And IIRC it wasn't that trivial.

It seems there is not much more I can do about this at the moment.
I will wait to see what they think on the Vert.x SQL client side and, in the meanwhile, send a PR with a test case for the other dbs.

Honestly I'm not sure if it's a driver bug because I feel like I've run into the same issue with JDBC.

I've tested it and it seems to work when I use Hibernate ORM and JDBC

OK, fine, so I must have misremembered.

I've added a test case (UUIDAsBinaryType) but I'm not going to close this issue for now: https://github.com/hibernate/hibernate-reactive/pull/680

Wating to see if the VErt.x team is going to do something about it

OK, fine, so I must have misremembered.

No, you were right. I've just double checked and it doesn't work for MySQL nor MariaDB with ORM and JDBC
I messed up somewhere when I checked the first time.

So, in the end it's not a problem with the driver.

I'm wondering if we should mention this in the documentation before closing this issue.
It's not very intuitive

I'm wondering if we should mention this in the documentation before closing this issue.

You could put it in the FAQ, I suppose, but really this would belong in the ORM documentation if anywhere. I don't think we need to mention it in the HR docs.

I think we should close this issue.

OK, let's close it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yaakov-berkovitch picture yaakov-berkovitch  ·  7Comments

aguibert picture aguibert  ·  28Comments

tsegismont picture tsegismont  ·  9Comments

gavinking picture gavinking  ·  23Comments

akoufa picture akoufa  ·  30Comments