Details
-
Bug
-
Resolution: Done
-
Major
-
JBossAS-3.2.6 Final
-
None
Description
SourceForge Submitter: mikezzz .
If you use a IMAGE field on MS SQL Server 2000
(JDBCType=LONGVARBINARY), CMP will fail to create the
CMP entity with will the following exception:
16:28:31,597 ERROR [LogInterceptor] EJBException, causedBy:
java.sql.SQLException: Unable to load to deserialize
result: java.io.StreamCorruptedException: invalid
stream header
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.convertToObject(JDBCUtil.java:293)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.access$600(JDBCUtil.java:55)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil$7.readResult(JDBCUtil.java:645)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil$AbstractResultSetReader.get(JDBCUtil.java:402)
...
Simple work around is put an empty piece of data in the
offending IMAGE field within the ejbCreate method of
the entity bean (e.g. empty byte[] array).
Below is a patch that would possibly fix the issue (not
tested):
—
D:\cvs\jboss\jboss-3.2.5-src\server\src\main\org\jboss\ejb\plugins\cmp\jdbc\JDBCUtil.java
Mon Apr 05 10:32:20 2004
+++ JDBCUtil.java Tue Jul 13 16:40:18 2004
@@ -635,7 +635,7 @@
{
Object value = null;
InputStream binaryData =
rs.getBinaryStream(index);
- if(binaryData != null)
+ if(binaryData != null && !rs.wasNull())
{
try
{