Bug 1031442

Summary: HHH-8705 - Unable to persist entity with MappedSuperclass and @Lob in Oracle.
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: dstephan
Component: HibernateAssignee: Brett Meyer <brmeyer>
Status: CLOSED WONTFIX QA Contact: Zbyněk Roubalík <zroubali>
Severity: unspecified Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.1.1CC: dstephan, theute
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-20 01:06:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Entities to reproduce none

Description dstephan 2013-11-17 23:13:00 UTC
Issue is very similar to https://hibernate.atlassian.net/browse/HHH-4635.

The difference is that they have a MappedSuperclass (containing the @Lob)
This results in the Lob column appearing somewhere in the middle of the columns in the insert clause, however the Clob parameter is last in the bindings.

Comment 1 dstephan 2013-11-17 23:14:08 UTC
Hibernate Issue: https://hibernate.atlassian.net/browse/HHH-8705

Comment 2 dstephan 2013-11-19 06:44:38 UTC
Created attachment 825911 [details]
Entities to reproduce

Create and persist a SubEntity should reproduce the issue.

Comment 3 Brett Meyer 2013-11-19 13:27:03 UTC
Dave, still not able to reproduce on oracle11gR2 and ORM 4.2.0.SP1 (EAP 6.1.1) -- can you post your insertion code?  Not sure what else is missing.

Comment 4 dstephan 2013-11-19 23:36:11 UTC
Hi Brett,

My insertion code is simply:

SubEntity b = new SubEntity("TestClob", new BigInteger("1"));
b.setCode("code");
em.persist(b);

Which results in this insert statement and parameters, and the following exception:

09:32:17,433 DEBUG [org.hibernate.SQL] (http-localhost/127.0.0.1:8080-2) insert into SubEntity (SUBENTITYID, MYCLOB, UFLAGS, CODE, FLAGS, VERSION) values (MMSSEQ.nextval, ?, ?, ?, ?, ?)

09:32:26,757 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (http-localhost/127.0.0.1:8080-2) binding parameter [1] as [NUMERIC] - 1
09:32:26,758 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (http-localhost/127.0.0.1:8080-2) binding parameter [2] as [VARCHAR] - code
09:32:26,758 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (http-localhost/127.0.0.1:8080-2) binding parameter [3] as [NUMERIC] - <null>
09:32:26,759 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (http-localhost/127.0.0.1:8080-2) binding parameter [4] as [BIGINT] - 0
09:32:26,759 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (http-localhost/127.0.0.1:8080-2) binding parameter [5] as [CLOB] - TestClob


09:34:22,168 DEBUG [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost/127.0.0.1:8080-2) could not execute statement [n/a]: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number

Comment 5 Brett Meyer 2013-11-20 01:06:35 UTC
The real issue ended up as a duplicate of https://hibernate.atlassian.net/browse/HHH-8103 which was fixed in ORM 4.2.1 and therefore already in EAP 6.2.0.  Closing.