Skip to content

NH-4012 - ora-24816: expanded non LONG bind data supplied after actual LONG or LOB column #1373

Open
@nhibernate-bot

Description

@nhibernate-bot

anwer matter created an issue — 15th May 2017, 7:53:44:

While updating it throws the error:

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column
   at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution(OracleConnectionImpl connectionImpl, Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, OracleException& exceptionForArrayBindDML, Boolean isFromEF)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
ERROR 2017-04-09 08:59:58,272 461541 NHibernate.AdoNet.AbstractBatcher - p243438 - 10.1.24.110 - /Epolice/Incident/Edit/cb2f4794-545e-4b47-83dd-a748009fb20c - Could not execute command: UPDATE ep*Incident SET Completed = :p0, FollowupStatus = :p1, InactiveDate = :p2, ActionPlan = :p3, StatusChangedBy = :p4, StatusChangedBySignatureId = :p5, RegistrationTypeId = :p6, ComplaintMethodId = :p7, SecurityLevelId = :p8, IncidentDate = :p9, ReportedDate = :p10, LocationAroundCrimeId = :p11, VillageId = :p12, BuildingNo = :p13, WayNumber = :p14, Coordinates_North = :p15, Coordinates*East = :p16, IncidentSummary = :p17, IncidentDetails = :p18, BlockNumber = :p19, Square = :p20, RoadName = :p21, WayTypeId = :p22, ProcedureIncident = :p23, PoliceStationId = :p24, CreatedInPoliceStationId = :p25, TransactionId = :p26, ModifiedDate = :p27, ModifiedBy = :p28, IsDeleted = :p29, AccidentSceneDrawnUserId = :p30, AccidentSceneDrawnSignatureId = :p31, AccidentSceneDescription = :p32, WeatherConditionsId = :p33, AccidentTypeId = :p34, AccidentPrimaryReasonId = :p35, OtherReasons = :p36, TrafficAccidentLocationId = :p37, AccidentDetails = :p38, LocationDetails = :p39, AccidentLevel = :p40, BeforeAccident = :p41, DuringAccident = :p42, AfterAccident = :p43, CrashSeverityId = :p44, NoOfVehicleInvolved = :p45, NoOfCasualityKilled = :p46, NoOfCasualityInjured = :p47, RoadSpeed = :p48, JunctionTypeId = :p49, RoadWorks = :p50, RoadCategoryId = :p51, RoadTypeId = :p52, RoadFeaturesId = :p53, RoadShapesId = :p54, RoadLightingControlsId = :p55, PhysicalSurfaceConditionId = :p56, RoadSurfaceStatesId = :p57, ShoulderTypeId = :p58, ShoulderConditionId = :p59, IsCentralDividerPresent = :p60, LightConditionId = :p61, SurfaceTypeId = :p62, CarriagewayWidth = :p63, ShoulderWidth = :p64, NoOfLines = :p65, TrafficOffenceId = :p66, TrafficRestrictionId = :p67, RoadLengthKM = :p68, RoadLength100M = :p69 WHERE Id = :p70
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column
   at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution(OracleConnectionImpl connectionImpl, Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, OracleException& exceptionForArrayBindDML, Boolean isFromEF)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)

According to (https://community.oracle.com/message/1427951#1427951) the cause should be:

ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column
Cause: A Bind value of length potentially > 4000 bytes follows binding for LOB or LONG.
Action: Re-order the binds so that the LONG bind or LOB binds are all at the end of the bind list.

Any thoughts? I am not aware of NHibernate source code to provide a PR for this.


Frédéric Delaporte added a comment — 15th May 2017, 14:15:58:

If you wish to contribute a fix, the source code and guidelines are (https://github.com/nhibernate/nhibernate-core/blob/master/CONTRIBUTING.md).

If you wish this trouble to be fixed, since it looks quite specific and unheard of among NHibernate issues, a test case reproducing it will very likely be required. Can you please provide one? Previous link also covers how to provide a test case.


stanislav merovic added a comment — 20th September 2017, 6:35:33:

This has been fixed in Hibernate about 4 years ago i think (i read it somewhere when i was searching for the ORA-24816, so dont quote me on that), but did never make it to NHibernate (isLob attribute) .
We use a customized version of NHibernate where we added the isLob attribute and sort the PropertyIterator of PersistentClass so that the lob columns are at the end of the insert/update statements.
But that doesn't work for components and that really hurts, having to work around that every time. We already tried to achieve the same with components but that would need a lot more refactoring due to the way the command/parameter order is currently generated.

The issue is, that oracle throws this error whenever a long column (clob,blob,nclob...) is followed by a varchar column and the size of these fields exceed a certain value.

insert into testtable 10000charactersnclob, 1350varchar2 for example will cause this error and as far as i am aware that's not a bug from oracle side, although I don't know the reason why this "has to break".

It would really be nice to have an option to mark columns that should be at the end of the field list of a query/statement.


stanislav merovic added a comment — 20th September 2017, 7:52:27:

I attached a simple test case for the issue, it doesnt contain joinedsubclasses, components or the like but it shows the issue.
Of course you could argue, that one could rearange the properties in the mapping but that doesn't help for joined subclasses, components etc. and as far as i am aware the id column is always appended to the end.

Sorry i forgot to remove the manual call on "TestFixtureSetUp();" since i was running the test with the integrated visual studio testing tools instead of nunit and I can't find a way to delete the attachment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions