Christoph Laudenbach (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZmZlOTc4MjU2...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16568?atlOrigin=eyJpIjoiZmZlOT...
) HHH-16568 (
https://hibernate.atlassian.net/browse/HHH-16568?atlOrigin=eyJpIjoiZmZlOT...
) Incorrect DDL with Postgres, @MappedSuperclass, Generics and UserType (
https://hibernate.atlassian.net/browse/HHH-16568?atlOrigin=eyJpIjoiZmZlOT...
)
Issue Type: Bug Affects Versions: 6.1.7 Assignee: Unassigned Created: 08/May/2023 02:32 AM
Environment: Hibernate 6.1.7, Java 17, Linux, Postgres Priority: Major Reporter: Christoph
Laudenbach (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
This problem is similar to HHH-15970 (
https://hibernate.atlassian.net/browse/HHH-15970 )
Closed , but still exists with Hibernate 6.1.7.
It occurs when you have a generic @MappedSuperclass with an enum field that is mapped via
a custom UserType. The databse field is generated as a bytea , where an integer type is
expected. When saving an object, there is of course a type conflict.
Please have a look at the attached test case. With Hibernate 6.1.7 and Postgres it fails
as follows:
Caused by: org.postgresql.util.PSQLException: ERROR: column "myenum" is of type
bytea but expression is of type integer
Hint: You will need to rewrite or cast the expression.
Position: 93
at
app//org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
at
app//org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
at app//org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
at app//org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
at app//org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
at
app//org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
at
app//org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:152)
at
app//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
With Hibernate 6.2, however, it is successful. I couldn't find a suitable JIRA issue
for it though.
I would like to ask for a fix for 6.1. Because we are currently limited to JakartaEE 9.1,
the use of Hibernate 6.2 is unfortunately not yet an option for us.
(
https://hibernate.atlassian.net/browse/HHH-16568#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16568#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:5ff5564 )