首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用hibernate_sequence导入问题“Generation.type”表

使用hibernate_sequence导入问题“Generation.type”表
EN

Stack Overflow用户
提问于 2014-04-22 18:51:59
回答 1查看 4.3K关注 0票数 1

因此,我试图使用sql插件导入备份数据库。我在实体上使用了注释@GeneratedValue(strategy = GenerationType.TABLE ),所以我的备份数据库中有hibernate_sequence表。

如何避免这个错误,但仍然使用@Id @GeneratedValue

代码语言:javascript
复制
[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]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-22 19:10:06

这是清楚的。hibernate_sequence已经存在。您的数据已经加载,并且尝试再次加载数据。在这种情况下,您可以删除hibernate_sequence表或数据库以重新安装。

代码语言:javascript
复制
  <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>
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23227881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档