日期:2014-05-17 浏览次数:20773 次
@Entity @Table(name = "TBUSER") @GenericGenerator(name = "user_increment", strategy = "increment") public class User { private int id; @Id @Column(name = "UID") @GeneratedValue(generator = "user_increment") public int getId() { return id; } public void setId(int id) { this.id = id; } }
public static void main(String[] args) { // TODO Auto-generated method stub Session session = HibernateSessionFactory.getSession(); session.beginTransaction(); User u = new User(); session.save(u); session.getTransaction().commit(); session.close(); }
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version). log4j:WARN Please initialize the log4j system properly. Hibernate: select max(UID) from TBUSER Hibernate: insert into TBUSER (UID) values (?) Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) at com.hib.entity.Test.main(Test.java:18) Caused by: java.sql.BatchUpdateException: ORA-00928: 缺失 SELECT 关键字 at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10070) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:213) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 8 more