Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311985

Summary: error in insert into a clob field
Product: z_Archived Reporter: keithchen2005
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: guy.pelletier
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description keithchen2005 CLA 2010-05-06 18:08:15 EDT
Build Identifier: 2.0.2 official release

I attached the exception below. The insertion happens fine with eclipselink 2.0.0 and 1.1.1, but when I upgraded to 2.0.2, I got such exception. 

JPA tries to insert a row into a table. The table has a clob field (annotated as @Lob in Java class). The insertion failed when eclipselink 2.0.2 tries to insert into the clob field. I don't understand why it tries to shrink the clob field to 256 character wide.
 
by the way, I am using Derby 10.4.2.0 as underlying database. IDE is eclipse 3.4, and runs on windows xp.



Internal Exception: java.sql.SQLException: A truncation error was encountered trying to shrink CLOB 'opRun:PERMIT;opRunDef:PERMIT;opOpen:PERMIT;opList:PERMIT;opV&' to length 255.
Error Code: -1
Call: INSERT INTO UOA_PSETS (ID, PERMISSIONS, DESCRIPTION, NAME) VALUES (?, ?, ?, ?)
	bind => [10392, opRun:PERMIT;opRunDef:PERMIT;opOpen:PERMIT;opList:PERMIT;opViewProps:PERMIT;opRepSrvProps:PERMIT;opInfoAssist:PERMIT;opAGA:PERMIT;opEditor:PERMIT;opCreateFL:PERMIT;opCreateItem:PERMIT;opWrite:PERMIT;opMakeManaged:PERMIT;opMakePrivate:PERMIT;opUpdateOwnership:PERMIT;opShareItem:PERMIT;opSaveDef:PERMIT;opDelete:PERMIT;opViewRulesOn:PERMIT;, Legacy ContentManager Permissions, WF_ContentManager]
Query: InsertObjectQuery(com.ibi.ibss.dbdriver.IBSSPermissionSetDB[id=10392])
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
	at com.ibi.sqlscriptswithjpa.core.DBLoader.loadData(DBLoader.java:103)

Reproducible: Always

Steps to Reproduce:
1. create a java entity class with a lob field in it
2. try to insert a wider-than-256-char data into that field.  
3. running on a derby database. expect a sql exception of truncation error was encountered trying to shrink CLOB
Comment 1 Guy Pelletier CLA 2010-05-14 14:51:34 EDT

*** This bug has been marked as a duplicate of bug 307774 ***
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:27:27 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink