Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Annotation @Lob - Trying to save files on Oracle DB(Oracle Error Code: 17070 while storing object)
Annotation @Lob - Trying to save files on Oracle DB [message #909807] Fri, 07 September 2012 20:57 Go to next message
Lars Drießnack is currently offline Lars DrießnackFriend
Messages: 9
Registered: August 2012
Junior Member
Hello,

I'm trying to store/load images on Oracle 10g database with JPA/EclipseLink.

Code:
@Entity
@Table(name = "MYPICTURE")
public class Picture extends BaseObject {

	private static final long serialVersionUID = -1094665703939324532L;

	public static final int SIZE_1MB = 1000000;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PICTURE_SEQ")
	@SequenceGenerator(name = "PICTURE_SEQ", sequenceName = "PICTURE_SEQUENCE", initialValue = 1, allocationSize = 1)
	@Column
	@NotNull
	private Long id;

	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "content", length = SIZE_1MB)
	@NotNull
	private byte[] content;

	@Column(name = "type")
	@Converter(name = "mimeTypeConverter", converterClass = ...MimeTypeConverter.class)
	@Convert("mimeTypeConverter")
	@NotNull
	private MimeType type;

...

getter / setter


I wrote a UnitTest and tried to store a 6kb (very small) image. It should be possible to store a image with a size up to 1MB. The test produces the following exception:
javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Datengröße größer als max. Größe für diesen Typ: 5911
Error Code: 17070
Call: INSERT INTO MYPICTURE (ID, content, INSERTEDAT, INSERTEDBY, type, UPDATEDAT, UPDATEDBY) VALUES (?, ?, ?, ?, ?, ?, ?)
	bind => [1, [B@75f07729, 2012-09-07T22:49:58.594+02:00, todo, image/png, null, null]
Query: InsertObjectQuery(...picture.Picture@55a86b8d)


The exception is german so it says something like: File size is to large max. size for this type 5911.

I've searched a very long time for a solution. Any suggestions? DB Version is Oracle 10g, EclipseLink 2.3.2 Indigo.

kind regards
Lars

[Updated on: Fri, 07 September 2012 21:02]

Report message to a moderator

Re: Annotation @Lob - Trying to save files on Oracle DB [message #911344 is a reply to message #909807] Tue, 11 September 2012 12:25 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Oracle 10g requires usage of a locate for large lobs. Ensure you are using the Oracle10Platform as your target-database.


James : Wiki : Book : Blog : Twitter
Re: Annotation @Lob - Trying to save files on Oracle DB [message #915372 is a reply to message #911344] Mon, 17 September 2012 06:48 Go to previous messageGo to next message
Lars Drießnack is currently offline Lars DrießnackFriend
Messages: 9
Registered: August 2012
Junior Member
Hi,

I changed the eclipselink.target-database property to Oracle10g, now I get the following exception:

[[b]EL Fine]: Connection(42932808)--INSERT INTO PICTURE (ID, content, INSERTEDAT, INSERTEDBY, mimetype, UPDATEDAT, UPDATEDBY) VALUES (?, ?, ?, ?, ?, ?, ?)
	bind => [1, [B@3a8c4b43, 2012-09-17T08:38:03.158+02:00, todo, image/png, null, null]
[EL Fine]: Connection(42932808)--SELECT content FROM PICTURE WHERE (ID = ?) FOR UPDATE
	bind => [1]
[EL Fine]: SELECT 1 FROM DUAL
[EL Warning]: Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Nicht unterstützte Funktion
Error Code: 17023
Call: SELECT content FROM PICTURE WHERE (ID = ?) FOR UPDATE
	bind => [1][/b]
Query: InsertObjectQuery(...picture.Picture@33a90fd9)
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
	at org.eclipse.persistence.internal.helper.LOBValueWriter.buildAndExecuteCall(LOBValueWriter.java:77)
	at org.eclipse.persistence.internal.helper.LOBValueWriter.buildAndExecuteSelectCalls(LOBValueWriter.java:188)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.flushSelectCalls(DatabaseAccessor.java:156)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:367)
	at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
	at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
	at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:472)
	at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
	at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
	at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
	at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
	at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
	at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
	at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
	at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:224)
	at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:123)
	at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3799)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1415)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:636)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1505)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:267)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1143)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
 ...
Caused by: java.sql.SQLException: Nicht unterstützte Funktion
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
	at [b]oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:689)
	at oracle.sql.BLOB.setBytes(BLOB.java:954)
	at org.eclipse.persistence.platform.database.oracle.Oracle10Platform.writeLOB(Oracle10Platform.java:72)
	at org.eclipse.persistence.internal.helper.LOBValueWriter.fetchLocatorAndWriteValue(LOBValueWriter.java:92)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processResultSet(DatabaseAccessor.java:695)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:621)[/b]
	... 56 more



kind regards,
Lars

[Updated on: Mon, 17 September 2012 06:49]

Report message to a moderator

Re: Annotation @Lob - Trying to save files on Oracle DB [message #916061 is a reply to message #915372] Tue, 18 September 2012 13:21 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

What JDBC driver version are you using? Does it match your database version? Are you using the thin driver?

James : Wiki : Book : Blog : Twitter
Re: Annotation @Lob - Trying to save files on Oracle DB [message #931730 is a reply to message #916061] Wed, 03 October 2012 13:23 Go to previous messageGo to next message
Lars Drießnack is currently offline Lars DrießnackFriend
Messages: 9
Registered: August 2012
Junior Member
<property name="eclipselink.target-database" value="Oracle10g" />
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" />


the jar file is ojdbc14.jar, the database is Oracle10g XE (64bit)

kind regards,
Lars
Re: Annotation @Lob - Trying to save files on Oracle DB [message #939151 is a reply to message #931730] Wed, 10 October 2012 13:25 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Is the jar from the database installation? If you enable logging when EclipseLink connects it will print the database version, and the JDBC driver version. What are these?


James : Wiki : Book : Blog : Twitter
Re: Annotation @Lob - Trying to save files on Oracle DB [message #939479 is a reply to message #939151] Wed, 10 October 2012 19:57 Go to previous messageGo to next message
Gerardo Arroyo is currently offline Gerardo ArroyoFriend
Messages: 5
Registered: October 2012
Junior Member
Which is the column datatype?
Re: Annotation @Lob - Trying to save files on Oracle DB [message #941323 is a reply to message #909807] Fri, 12 October 2012 12:02 Go to previous message
Lars Drießnack is currently offline Lars DrießnackFriend
Messages: 9
Registered: August 2012
Junior Member
Hello,

DB-Version:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

EclipseLink Version:
Eclipse Persistence Services - 2.3.2.v20111125-r10461

The datatype of the column is:
...
DATA_TYPE 1111
TYPE_NAME BLOB
COLUMN_SIZE 4000
...

kind regards,
Lars
Previous Topic:Moxy JPA+JAXB mapping issue with list unwrapping
Next Topic:[SOLVED] misunderstanding annotations
Goto Forum:
  


Current Time: Tue Mar 19 08:41:11 GMT 2024

Powered by FUDForum. Page generated in 0.03211 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top