新手请教Hibernate问题。
wwhui 2008-11-25 11:46:20 刚开始学习Hibernate,搞不懂为什么出错,请知道的说下,谢拉。
错误信息:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: insert into PERSON (NAME, PASSWORD, ID) values (?, ?, ?)
Exception in thread "main" org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at tt.TableOperate.insert(TableOperate.java:24)
at tt.TestHiberate.main(TestHiberate.java:21)
Caused by: java.sql.BatchUpdateException: ORA-01401: 列に挿入した値が大きすぎます。
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 9 more
Person.hbm.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd>
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="tt.Person" table="PERSON">
<id name="id" column="ID" type="string">
<generator class="uuid.hex"/>
</id>
<property name="name" column="NAME" type="string" />
<property name="password" column="PASSWORD" type="string"/>
</class>
</hibernate-mapping>
hibernate.cfg.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="connection.username">TEST2</property>
<property name="connection.url">
</property>
<property name="dialect">
</property>
<property name="myeclipse.connection.profile">
</property>
<property name="connection.password">TEST2</property>
<property name="connection.driver_class">
</property>
<property name="show_sql">true</property>
<mapping resource="tt/Person.hbm.xml" />
</session-factory>
</hibernate-configuration>