quarkus: panache does not find UUID fields
Describe the bug
@Entity
public class Session extends PanacheEntity {
public UUID uuid;
public static Session findByUuid(UUID uuid){
return find("uuid", uuid).firstResult();
}
}
Expected behavior
the above findByUuid method returns a Session object when searched for a previously persisted Session
Actual behavior always returns null
To Reproduce Steps to reproduce the behavior:
- persist session object
- try to retrieve it by uuid
- no object could be retrieved, it returns null
Configuration
# datasource configuration
quarkus.datasource.url = jdbc:mariadb://localhost:3306/mydatabase
quarkus.datasource.driver = org.mariadb.jdbc.Driver
quarkus.datasource.username = myuser
quarkus.datasource.password = mypassword
# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.database.generation=drop-and-create
#quarkus.hibernate-orm.database.generation=update
quarkus.hibernate-orm.dialect=org.hibernate.dialect.MariaDB102Dialect
quarkus.hibernate-orm.log.sql=true
Environment (please complete the following information):
- Output of
uname -aorver: Linux tp-yp2-sl 4.19.72-gentoo #1 SMP Sun Oct 6 02:44:06 CEST 2019 x86_64 Intel® Core™ i7-4500U CPU @ 1.80GHz GenuineIntel GNU/Linux - Output of
java -version: openjdk version “1.8.0_232” OpenJDK Runtime Environment (IcedTea 3.14.0) (Gentoo icedtea-3.14.0) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode) - GraalVM version (if different from Java): not used, only jar version tested so far
- Quarkus version or git rev: 1.1.0.Final
Additional context I’m using MariaDB 10.2.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (9 by maintainers)
Ok, thanks @beikov , this confirms what I suspected.
So, this is a problem in Hibernate ORM 5, and it has been fixed in ORM 6. It will be solved in Quarkus 3 as we upgrade to ORM 6.
In the meantime, various workarounds have been suggested above (
@Column(columnDefinition="uuid")or@Column(length = 16)). Feel free to have a look at https://hibernate.atlassian.net/browse/HHH-15101 (h2) or https://hibernate.atlassian.net/browse/HHH-10564 (mysql/mariadb) for more information.I will close this as not planned, since the problem is not specific to Quarkus.