【发布时间】:2017-02-01 08:20:01
【问题描述】:
我正在开发一个 Spring 应用程序,其中所有内容都使用 maven 进行配置(在 pom.xml 中)。我的应用程序使用 PostgreSQL 数据库,但单元测试使用内存中的 HSQLDB 数据库。
我刚刚遇到了 TEXT 列的问题,因为 HSQLDB 本身不支持它们。在我的实体类中,我有:
private @Column(columnDefinition = "text") String propertyName;
这适用于 Postgres,但 HSQLDB 生成以下错误:type not found or user lacks privilege: TEXT。该表没有创建,当然结果是我的大多数测试都失败了。
我发现我需要 activate PostgreSQL compatibility 才能通过将 sql.syntax_pgs 设置为 true 来实现此功能。
我的问题是:我应该把这个设置放在哪里?我想把它放在pom.xml,因为一切都在那里配置,但我不知道在哪里。
例如我有:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dspring.profiles.active=test</argLine>
</configuration>
</plugin>
我可以通过此设置添加<argLine> 吗?
【问题讨论】:
标签: java spring hibernate maven hsqldb