db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dies Koper <di...@fast.au.fujitsu.com>
Subject setNull with BLOB column
Date Fri, 26 Jun 2009 02:40:37 GMT
Hi,

I have a JPA application and use Toplink as persistence provider.
Toplink has a table creation option. It maps persistence fields of Java
type byte[] (without @Lob annotation) to BLOB when using Derby.
(LONGVARBINARY on Oracle DB).

Is BLOB the recommended mapping for fields of type byte[]?

I'm seeing the following issue with this because of the changes made in
DERBY-1610:

If I do not initialize the byte[] field (i.e. leave it null) and persist
the entity object, Toplink calls setNull(n,
java.sql.Types.LONGVARBINARY), leading to the following exception:

Caused by: java.sql.SQLException: An attempt was made to get a data
value of type 'LONGVARBINARY' from a data value of type 'BLOB'.
	at
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown
Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.client.am.PreparedStatement.setNull(Unknown Source)
	at
oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform.setComplexParameterValue(DatabasePlatform.java:1438)


>From a google search I found a lot of discussions on the Derby mailing
lists/issue tracker about adding such error checks and making them
consistent, but I also had the idea some issues were left unresolved.

Are there any plans to make changes to allow the above combination?
Or would your opinion be that Toplink should change its default column
type for byte[]?

Thanks,
Dies
This is an email from Fujitsu Australia Software Technology Pty Ltd, ABN 27 003 693 481. It
is confidential to the ordinary user of the email address to which it was addressed and may
contain copyright and/or legally privileged information. No one else may read, print, store,
copy or forward all or any of it or its attachments. If you receive this email in error, please
return to sender. Thank you.

If you do not wish to receive commercial email messages from Fujitsu Australia Software Technology
Pty Ltd, please email unsubscribe@fast.fujitsu.com.au


Mime
View raw message