Hi.
I am using NHibernate 1.0.1.0 with Oracle 8, dialect: NHibernate.Dialect.OracleDialect and driver NHibernate.Driver.OracleClientDriver.
I have a mapping which includes this line:
<property name="Description" column="DESCRIPTION" type="AnsiString" length="400"/>
which maps to this table field:
DESCRIPTION NVARCHAR2 (400),
which accepts null values.
When I SaveOrUpdate an object with an empty 'description' string the next exception throws:
{"Parameter ':p5': No size set for variable length data type: String." }
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)\r\n at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)\r\n at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor)\r\n at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle& rowidDescriptor)\r\n at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()\r\n at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)\r\n at NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)\r\n at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
And this is the SQL generated:
INSERT INTO GEPWF_GEN_PARAMETER (LAST_UPDATED_BY, LAST_UPDATE_DATE, PARAMETER_TYPE_ID, DELETE_MARK, CREATED_BY, DESCRIPTION, ACTION_ID, CREATION_DATE, NAME, PARAMETER_LENGTH, ID) VALUES (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10)
Details:
Hibernate version:
NHibernate 1.0.1.0
Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="GEP.Exides.Workflow.Model.Parameter, GEP.Exides.Workflow" table="GEPWF_GEN_PARAMETER">
<id name="Id" column="ID" type="Decimal" unsaved-value="-1">
<generator class="sequence">
<param name="sequence">GEPWF_GEN_PARAMETER_SEQ</param>
</generator>
</id>
<property name="Name" column= "NAME" type="string" length="1"/>
<property name="Description" column="DESCRIPTION" type="string" length="400" not-null="false"/>
<property name="ParameterLength" column="PARAMETER_LENGTH" type="Decimal"/>
<property name="LastUpdateDate" column="LAST_UPDATE_DATE" type="DateTime"/>
<property name="LastUpdatedBy" column="LAST_UPDATED_BY" type="AnsiString" length="9"/>
<property name="CreationDate" column="CREATION_DATE" type="DateTime"/>
<property name="CreatedBy" column="CREATED_BY" type="AnsiString" length="2"/>
<property name="DeleteMark" column="DELETE_MARK" type="Decimal"/>
<many-to-one name="ActionObj" class="GEP.Exides.Workflow.Model.Action, GEP.Exides.Workflow" column="ACTION_ID" not-null="true"/>
<many-to-one name="ParameterTypeObj" class="GEP.Exides.Workflow.Model.ParameterType, GEP.Exides.Workflow" column="PARAMETER_TYPE_ID" not-null="true"/>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
{"Parameter ':p5': No size set for variable length data type: String." }
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)\r\n at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)\r\n at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor)\r\n at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle& rowidDescriptor)\r\n at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()\r\n at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)\r\n at NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)\r\n at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
Name and version of the database you are using:
Oracle 8
The generated SQL (show_sql=true):
INSERT INTO GEPWF_GEN_PARAMETER (LAST_UPDATED_BY, LAST_UPDATE_DATE, PARAMETER_TYPE_ID, DELETE_MARK, CREATED_BY, DESCRIPTION, ACTION_ID, CREATION_DATE, NAME, PARAMETER_LENGTH, ID) VALUES (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10)
Debug level Hibernate log excerpt:
2006-01-04 16:05:37,059 [2556] DEBUG NHibernate.SQL [(null)] <(null)> - INSERT INTO GEPWF_GEN_PARAMETER (LAST_UPDATED_BY, LAST_UPDATE_DATE, PARAMETER_TYPE_ID, DELETE_MARK, CREATED_BY, DESCRIPTION, ACTION_ID, CREATION_DATE, NAME, PARAMETER_LENGTH, ID) VALUES (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10)
2006-01-04 16:05:37,090 [2556] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Closed IDbCommand, open IDbCommands :0
2006-01-04 16:05:37,106 [2556] DEBUG NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - could not insert: [GEP.Exides.Workflow.Model.Parameter#10]
System.Exception: Parameter ':p5': No size set for variable length data type: String.
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)
at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
2006-01-04 16:05:37,106 [2556] WARN NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - System.Exception: Parameter ':p5': No size set for variable length data type: String.
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)
at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
2006-01-04 16:05:37,106 [2556] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Parameter ':p5': No size set for variable length data type: String.
2006-01-04 16:05:37,106 [2556] ERROR NHibernate.ADOException [(null)] <(null)> - could not insert: [GEP.Exides.Workflow.Model.Parameter#10]
System.Exception: Parameter ':p5': No size set for variable length data type: String.
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)
at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
2006-01-04 16:05:37,106 [2556] ERROR NHibernate.Impl.SessionImpl [(null)] <(null)> - could not synchronize database state with session
NHibernate.ADOException: could not insert: [GEP.Exides.Workflow.Model.Parameter#10] ---> System.Exception: Parameter ':p5': No size set for variable length data type: String.
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount)
at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.EntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Impl.ScheduledInsertion.Execute()
at NHibernate.Impl.SessionImpl.Execute(IExecutable executable)
at NHibernate.Impl.SessionImpl.ExecuteAll(IList list)
at NHibernate.Impl.SessionImpl.Execute()
|