Here's what to do when trying to set up data using DbUnit on a table with a PostgreSQL inet type defined.
OSS | Version |
---|---|
Java | 7 |
postgresql | 9.5 |
mybatis | 3.4.2 |
dbunit | 2.5.3 |
org.dbunit.dataset.NoSuchColumnException: users.ADDR - (Non-uppercase input column: addr) The ADDR column of the table called users is inet type.
Use the PostgresqlDataTypeFactory class The usage is as follows. I will add a class that provides Postgresql's own type to DatabaseConnection. For the implementation of getDBConnection (), refer to "I tried using Spring + Mybatis + DbUnit".
sample.java
DatabaseConnection connection = getDBConnection();
connection
.getConfig()
.setProperty(
DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
new PostgresqlDataTypeFactory()
);
Recommended Posts