When I persist an object that has a very long string (e.g. 5500 chars), I get this exception. It works fine with shorter strings (e.g. 3500 chars), and the table column is varchar(8000)
Hibernate version:
hibernate-3.2.0.CR1, hibernate-annotations-3.1beta9
Mapping documents:
Code:
@Entity
@PrimaryKeyJoinColumn(name = "eform_id")
public class Request extends EForm {
...
protected String additionalDetails;
...
}
Full stack trace of any exception that occurs:Code:
Caused by: java.sql.SQLException: Disallowed implicit conversion from data type ntext to data type varchar, table 'portletsDevDave.uportal_dev_dave_app.tblCAMP_eventreservation_Request', column 'additionalDetails'. Use the CONVERT function to run this query.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:421)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2123)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2483)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:47)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:506)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:498)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:494)
Name and version of the database you are using:
MSSQL 8
The generated SQL (show_sql=true):
Hibernate: insert into tblCAMP_eventreservation_Request (Responsible, eventName, estAttendance, Building, rooms, eventDate, startTime, endTime, repeatDates, altEventDate, roomStartTime, roomEndTime, avAssistance, comments, addToCal, additionalDetails, Eform_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)