2009-11-25 33 views
1

下面是我的實體ID的定義,我使用hibernate作爲jpa的實現JPA(hibernate)@Id錯誤:導致:com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:表'DbName.system_sequences'不存在

@Id 
@TableGenerator(name="customer_generator", 
    table="system_sequences",pkColumnName="sequence_name", 
    valueColumnName="sequence_next_hi_value",initialValue=1,allocationSize=20) 
@GeneratedValue(strategy = GenerationType.TABLE, generator = "customer_generator") 
@Column(name="custid", unique=true, nullable=false) 
private Long id; 

我正在使用Mysql。下面是錯誤跟蹤

Caused by: 
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'databrowser.system_sequences' doesn't exist 
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026) 
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) 
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558) 
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490) 
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) 
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) 
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) 
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) 
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) 
at org.hibernate.id.MultipleHiLoPerTableGenerator.doWorkInCurrentTransaction(MultipleHiLoPerTableGenerator.java:135) 
at org.hibernate.engine.TransactionHelper$1Work.doWork(TransactionHelper.java:38) 
    ... 53 more 
+0

您是否指定了正確的模式名稱? – 2009-11-25 01:51:58

回答

1

表「system_sequences」不存在於數據庫中的一部分! 該表存在於名爲「information_schema」的MySQL模式中。 直接到。