How to use the PostgreSQLEnumType with both PostgreSQL and H2?
See original GitHub issueIs there any way to allow PostgreSQLEnumType
to work with a h2 database as well?
I use h2 in testing, where the regular @Enumerated(EnumType.STRING)
works fine, however, it doesn’t work for the postgres database I use in production.
Your PostgreSQLEnumType
works great for postgres, but doesn’t work for h2.
Is there anything you suggest for this use case?
Many thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
H2Database:MODE=PostgreSQL: doesn't support ENUM type
I want to use H2 with PostgreSQL dialect. My H2 version: "com.h2database" % "h2" ... create type myEnum as enum ('one', 'two', 'three');....
Read more >Enum Mappings with Hibernate - The Complete Guide
Let me show you how to use Hibernate's standard enum mappings, create a flexible, custom mapping and map db-specific enum types.
Read more >getting H2/Hibernate to recognize the Postgresql "text" type as ...
I'm having trouble getting H2/Hibernate to recognize the Postgresql "text" type. I have defined a column in Java as an enumerated type,
Read more >The best way to map an Enum Type with JPA and Hibernate
To map the Enum to a String database column type, you need to specify the EnumType.STRING value when using the @Enumerated annotation. 1....
Read more >Documentation: 15: 8.7. Enumerated Types - PostgreSQL
Enum types are created using the CREATE TYPE command, for example: ... 8.7.2. Ordering. The ordering of the values in an enum type...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Better with :
Have fun
Schema validation happens in Hibernate ORM. This library provides extra Types. It does not change Hibernate ORM source code.
Anyway, if you use Hibernate column definition or hbm2ddl, you are doing it all wrong as you should have used something like Flyway instead.