Class H2Support
java.lang.Object
io.bloviate.ext.AbstractDatabaseSupport
io.bloviate.ext.H2Support
- All Implemented Interfaces:
DatabaseSupport
H2-specific
DatabaseSupport.
H2 is an embedded, in-process database widely used as a JVM test fixture. It is largely
standard-SQL, so most columns map through the cross-database defaults in
AbstractDatabaseSupport (including TIMESTAMP WITH TIME ZONE, CLOB,
and BLOB). This class customizes the few types where H2 diverges:
TINYINT— H2's is a signed 8-bit type (-128..127), whereas the cross-database default targets MySQL's unsigned0..255range and would overflow.UUID— the H2 driver reports it as JDBCJDBCType.BINARY(16 bytes) with type name"UUID"; a real UUID is generated rather than 16 random bytes.JSON— surfaces as JDBCJDBCType.OTHERwith type name"JSON"; H2 parses the value, so valid JSON is generated.
H2's first-class ARRAY and INTERVAL types and its non-standard ENUM
and GEOMETRY types are not yet supported and cause
AbstractDatabaseSupport.getDataGenerator(Column, RandomGenerator) to throw.
- Since:
- 2.18.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigure(Map<JDBCType, GeneratorFactory> registry) Hook for subclasses to add or replace generator factories for specific JDBC types.Methods inherited from class AbstractDatabaseSupport
getDataGeneratorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DatabaseSupport
batchRewriteUrlParameter, disableConstraints, enableConstraints, readConstraints, supportsBulkLoad
-
Constructor Details
-
H2Support
public H2Support()Creates the H2 support with its default configuration.
-
-
Method Details
-
configure
Description copied from class:AbstractDatabaseSupportHook for subclasses to add or replace generator factories for specific JDBC types. The supplied registry already holds the cross-database defaults; subclasses with no customizations need not override this method. Implementations must not retain a reference to the map beyond the call.- Overrides:
configurein classAbstractDatabaseSupport- Parameters:
registry- the mutable registry to customize, keyed byJDBCType
-