I'm working on integration tests for a JPA project. The tests run on an embedded h2 database. However, I'm getting an error from h2 during hibernate schema generation when I use
@Column(columnDefinition = "INTERVAL HOUR TO MINUTE")
The error is org.h2.jdbc.JdbcSQLException: Unknown data type: "INTERVAL";
The h2 documentation indicates that INTERVAL is supported:
http://www.h2database.com/html/datatypes.html#interval_type
I am using h2 version 1.4.197
Stepping away from JPA and working directly in the h2 console, I have tried the following script which also generates the Unknown data type error:
CREATE TABLE test_interval (id INTEGER, test_hours INTERVAL HOUR TO MINUTE);
I have tried other variations of the INTERVAL type, all of which generate the same error
I can not find any discussion of this issue anywhere.
You need to use a more recent version of H2. H2 supports the standard INTERVAL data type since 1.4.198, but 1.4.198 is a beta-quality version, use a more recent one, such as 1.4.199 or 1.4.200.
The online documentation is actual only for the latest release, currently it is 1.4.200. If you use some older version, you have to use the documentation from its distribution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With