因此,我试图使用sql插件导入备份数据库。我在实体上使用了注释@GeneratedValue(strategy = GenerationType.TABLE ),所以我的备份数据库中有hibernate_sequence表。
如何避免这个错误,但仍然使用@Id @GeneratedValue?
[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (populate-database) on project app: ERROR: relation "hibernate_sequence" already exists -> [Help 1]发布于 2014-04-22 19:10:06
这是清楚的。hibernate_sequence已经存在。您的数据已经加载,并且尝试再次加载数据。在这种情况下,您可以删除hibernate_sequence表或数据库以重新安装。
<execution>
<id>create-db</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<url>jdbc:postgresql://localhost:5432:yourdb</url>
<!-- no transaction -->
<autocommit>true</autocommit>
<sqlCommand>DROP SEQUENCE hibernate_sequence</sqlCommand>
</configuration>
</execution>https://stackoverflow.com/questions/23227881
复制相似问题