[英]hibernate annotations
iam executing hibernate anotation example in eclipse galileo iam getting the following error. 我在eclipse中执行hibernate anotation示例galileo我收到以下错误。
Hibernate: insert into employee1 (Name, ID) values (?, ?) Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at net.roseindia.Example1.main(Example1.java:22) Caused by: java.sql.BatchUpdateException: Table 'test.employee1' doesn't exist at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1566) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246) ... 8 more
Caused by: java.sql.BatchUpdateException: Table 'test.employee1' doesn't exist
引起:java.sql.BatchUpdateException:表'test.employee1'不存在
That means that the table doesn't exist :-) If you want Hibernate to automatically create and drop the tables, set the property hibernate.hbm2ddl.auto
to create-drop
. 这意味着该表不存在:-)如果您希望Hibernate自动创建和删除表,请将属性
hibernate.hbm2ddl.auto
设置为create-drop
。 Also, I'd recommend reading Hibernate documentation, as it's one of the best sources for beginners. 另外,我建议阅读Hibernate文档,因为它是初学者的最佳来源之一。
http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/configuration.html#setup-configuration http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/configuration.html#setup-configuration
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.