Sybase - Test "BatchTest" fails due to "unexpected row count from update"

Description

The test "BatchTest" fails due to "org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1". The database server seems configured properly, as the "BatchUpdates" sample from jConnect 6 works correctly.

The problem specifically occurs with a table that has a numeric column with precision (e.g. numeric(10,4))
Sybase does not thrown any SQLException when you try and persist a numeric value whose scale exceeds that defined on the column. Instead, it returns an updateCount of zero

Environment

Sybase

Activity

Show:
Strong Liu
November 12, 2009, 3:53 AM
Strong Liu
November 12, 2009, 10:55 AM

actually Sybase throws an SQLWarning with a message "Truncation error occurred." and a nest SQLWarning with a message "Command has been aborted.", so the object does not be stored into DB, but hibernate does not aware of that and assumes the storing is successful.
and then in the NonBatchingBatcher.addToBatch(), expectation.verifyOutcome(rowCount, statement, 0) will throw an org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

Strong Liu
November 12, 2009, 11:00 AM

actually Sybase throws an SQLWarning with a message "Truncation error occurred." and a nest SQLWarning with a message "Command has been aborted.", so the object does not be stored into DB, but hibernate does not aware of that and assumes the storing is successful.
and then in the NonBatchingBatcher.addToBatch(), expectation.verifyOutcome(rowCount, statement, 0) will throw an org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

Strong Liu
November 12, 2009, 11:01 AM

this is can also be reproduced by org.hibernate.test.batch.BatchTest, with change
<column name="xval" not-null="true" length="4" unique-key="xy"/>
to
<column name="xval" not-null="true" precision="4" scale="0" unique-key="xy"/>
(DataPoint.hbm.xml)

Strong Liu
June 24, 2010, 11:53 AM

apply workaround in

Assignee

Strong Liu

Reporter

Strong Liu

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure