Caused by: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
Said it's because of charset, but first, there is no LONG column in the table, second, I just use the thin driver, which was works normal in get data from db, including the unicode chars, third, I tried both jdbc in hibernate.cfg.xml and just jndi in hibernate.cfg.xml, the same.
Hibernate version: 3.0.4 and 3.1.3
Mapping documents:
Code:
<?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">
<hibernate-mapping>
<class name="com.ccti.user.User" table="users" dynamic-update="true" optimistic-lock="version">
<id unsaved-value="null" name="userID" column="F_UserID" type="long">
<generator class="sequence">
<param name="sequence">SEQ_USERID</param>
</generator>
</id>
<property name="userName" column="F_UserName" type="string" not-null="true" update="false" />
<property name="userPass" column="F_UserPass" type="string" not-null="true" />
<property name="realName" column="F_RealName" type="string" not-null="true" />
<property name="sex" column="F_Sex" type="string" />
<property name="lastvisit" column="F_Lastvisit" type="timestamp" />
<many-to-one name="department" class="com.ccti.department.Department" column="F_DepartID" />
<many-to-one name="role" class="com.ccti.role.Role" column="F_RoleID" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
try {
beginTransaction();
session.update(user);
endTransaction(true);
} catch (Exception err) {
return false;
}
Full stack trace of any exception that occurs:
Quote:
org.hibernate.util.JDBCExceptionReporter 2006-05-29 12:06:57,337 -- ERROR -- ORA-01461: can bind a LONG value only for insert into a LONG column
org.hibernate.event.def.AbstractFlushingEventListener 2006-05-29 12:06:57,337 -- ERROR -- Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [com.ccti.user.User#1]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2222)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
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.JTATransaction.commit(JTATransaction.java:135)
at com.ccti.base.HibernateBase.endTransaction(HibernateBase.java:54)
at com.ccti.user.UserHibernate.updateUser(UserHibernate.java:57)
at com.ccti.user.UserImpl.updateUser(UserImpl.java:56)
at com.ccti.web.LoginController.handleRequest(LoginController.java:97)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:386)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:355)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:507)
at com.caucho.util.ThreadPool.run(ThreadPool.java:433)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:158)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:685)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1138)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3018)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3090)
at com.caucho.sql.UserPreparedStatement.executeUpdate(UserPreparedStatement.java:117)
at com.caucho.sql.UserPreparedStatement.executeUpdate(UserPreparedStatement.java:117)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2204)
... 31 more
Name and version of the database you are using:Oracle 9.0.1 & 9.2.0
The generated SQL (show_sql=true):update users set F_UserPass=?, F_RealName=?, F_Sex=?, F_Lastvisit=?, F_DepartID=?, F_RoleID=? where F_UserID=?
Debug level Hibernate log excerpt:Quote:
org.hibernate.persister.entity.AbstractEntityPersister 2006-05-29 12:06:57,287 -- DEBUG -- Updating entity: [com.ccti.user.User#1]
org.hibernate.jdbc.AbstractBatcher 2006-05-29 12:06:57,287 -- DEBUG -- about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
org.hibernate.jdbc.ConnectionManager 2006-05-29 12:06:57,287 -- DEBUG -- opening JDBC connection
org.hibernate.SQL 2006-05-29 12:06:57,287 -- DEBUG -- update users set F_UserPass=?, F_RealName=?, F_Sex=?, F_Lastvisit=?, F_DepartID=?, F_RoleID=? where F_UserID=?
org.hibernate.jdbc.AbstractBatcher 2006-05-29 12:06:57,287 -- DEBUG -- preparing statement
org.hibernate.persister.entity.AbstractEntityPersister 2006-05-29 12:06:57,287 -- DEBUG -- Dehydrating entity: [com.ccti.user.User#1]
org.hibernate.type.StringType 2006-05-29 12:06:57,287 -- DEBUG -- binding '418EF1B3EB9B3AB2' to parameter: 1
org.hibernate.type.StringType 2006-05-29 12:06:57,287 -- DEBUG -- binding '系统管理员' to parameter: 2
org.hibernate.type.StringType 2006-05-29 12:06:57,287 -- DEBUG -- binding '男' to parameter: 3
org.hibernate.type.TimestampType 2006-05-29 12:06:57,287 -- DEBUG -- binding '2006-05-29 12:06:57' to parameter: 4
org.hibernate.engine.IdentifierValue 2006-05-29 12:06:57,287 -- DEBUG -- id unsaved-value strategy NULL
org.hibernate.type.LongType 2006-05-29 12:06:57,287 -- DEBUG -- binding '1' to parameter: 5
org.hibernate.engine.IdentifierValue 2006-05-29 12:06:57,287 -- DEBUG -- id unsaved-value strategy NULL
org.hibernate.type.LongType 2006-05-29 12:06:57,287 -- DEBUG -- binding '1' to parameter: 6
org.hibernate.type.LongType 2006-05-29 12:06:57,287 -- DEBUG -- binding '1' to parameter: 7
org.hibernate.jdbc.AbstractBatcher 2006-05-29 12:06:57,307 -- DEBUG -- about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
org.hibernate.jdbc.AbstractBatcher 2006-05-29 12:06:57,307 -- DEBUG -- closing statement
org.hibernate.jdbc.ConnectionManager 2006-05-29 12:06:57,307 -- DEBUG -- skipping aggressive-release due to flush cycle
org.hibernate.util.JDBCExceptionReporter 2006-05-29 12:06:57,327 -- DEBUG -- could not update: [com.ccti.user.User#1] [update users set F_UserPass=?, F_RealName=?, F_Sex=?, F_Lastvisit=?, F_DepartID=?, F_RoleID=? where F_UserID=?]
java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column