Bugs item #573192, was opened at 2002-06-24 11:12
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=573192&group_id=22866

Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Christian Riege (lqd)
Assigned to: Dain Sundstrom (dsundstrom)
Summary: CMP mapping broken

Initial Comment:
Dain,

something broke between JDBCUtil.java 1.9 and 1.9.2.1
in relation to persisting java.math.BigDecimal (and
quite likely other types).

I have a CMP bean with a mapping of a
java.math.BigDecimal <-> NUMERIC in the DB ( PostgreSQL
7.1 w/ PostgreSQL type mapping). With JBoss 3.0.1RC1
from 06-13 my Bean successfully persisted the value in
the DB and read it back correctly:

--< snip >--
2002-06-24 16:56:44,789 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.actualWeight]
Get result: index=3, javaType=java.math.BigDecimal,
Object, value=1234.567
--< /snip >--

after upgrading to newest 3.0.1 CVS version I get an
exception:

--< snip >--2002-06-24 17:33:20,154 ERROR
[org.jboss.ejb.plugins.LogInterceptor]
TransactionRolledbackException, causedBy:
java.sql.SQLException: Unable to load to deserialize
result: java.io.StreamCorruptedException: InputStream
does not contain a serialized object
»···at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.convertByteArrayToObject(JDBCUtil.java:603)
»···at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.getResult(JDBCUtil.java:310)

(more follows but is not relevant IMHO)
--< /snip >--

downgrading JDBCUtil 1.9.2.1 to JDBCUtil 1.9 solves the
problem (i.e. the BigDecimal is stored / restored
correctly).

If you need more info pls. drop me a note. Sorry for
the high priority level but I think this is urgent.

----------------------------------------------------------------------

>Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-06-25 11:58

Message:
Logged In: YES 
user_id=251431

I was just about to suggest upgrading to the new driver.  In
the future there is a test which tries all of the basic types.

./build.sh
-Dtest=org.jboss.test.cmp2.simple.SimpleUnitTestCase one-test 

The exception is a desired result for some databases, as
they need to call getObject as a fallback.

----------------------------------------------------------------------

Comment By: Christian Riege (lqd)
Date: 2002-06-25 11:55

Message:
Logged In: YES 
user_id=176671

damn. it was a bug in the postgres JDBC Driver. upgrading
the driver did the job. sorry for the trouble.

the InvocationTargetException should be handled cleaner
though in the code instead of falling through to trying to
read the data as binary.

----------------------------------------------------------------------

Comment By: Christian Riege (lqd)
Date: 2002-06-25 11:47

Message:
Logged In: YES 
user_id=176671

it *is* coming from the JDBC Driver:

18:43:40,564 ERROR [STDERR] Bad BigDecimal 1234.567
18:43:40,567 ERROR [STDERR]     at
org.postgresql.jdbc2.ResultSet.getBigDecimal(ResultSet.java:373)
18:43:40,569 ERROR [STDERR]     at
org.postgresql.jdbc2.ResultSet.getBigDecimal(ResultSet.java:949)
18:43:40,571 ERROR [STDERR]     at
java.lang.reflect.Method.invoke(Native Method)
18:43:40,573 ERROR [STDERR]     at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.getResult(JDBCUtil.java:275)


so it's apparently the JDBC Drivers fault. The question is:
why does this work when I revert to JDBCUtil 1.9?

Plus the code needs to be fixed so that when an Exception is
caught it doesn't try to load the value as a binary stream ...

----------------------------------------------------------------------

Comment By: Christian Riege (lqd)
Date: 2002-06-25 11:39

Message:
Logged In: YES 
user_id=176671

OK still more info:

2002-06-25 18:36:07,877 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.actualWeight]
Caught InvocationTargetException: null
2002-06-25 18:36:07,877 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.actualWeight]
Inner Exception: Bad BigDecimal 1234.567

where is this coming from?! The JDBC driver?!

----------------------------------------------------------------------

Comment By: Christian Riege (lqd)
Date: 2002-06-25 11:29

Message:
Logged In: YES 
user_id=176671

I did that, I already added two log.trace statements to
JDBCUtil.java to show more of the error (patch is attached);
it seems that we're falling into an
InvocationTargetException, here is the log:

2002-06-25 18:22:06,349 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.volumeUnit]
Get result: index=1, javaType=java.lang.String, Simple, value=
2002-06-25 18:22:06,350 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.consigneeReference]
Got method public abstract java.lang.String
java.sql.ResultSet.getString(int) throws
java.sql.SQLException for java.lang.String
2002-06-25 18:22:06,350 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.consigneeReference]
Get result: index=2, javaType=java.lang.String, Simple,
value=Consignee Reference
2002-06-25 18:22:06,350 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.actualWeight]
Got method public abstract java.math.BigDecimal
java.sql.ResultSet.getBigDecimal(int) throws
java.sql.SQLException for java.math.BigDecimal
2002-06-25 18:22:06,563 TRACE
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.Shipment.actualWeight]
Caught InvocationTargetException: null
2002-06-25 18:22:06,570 ERROR
[org.jboss.ejb.plugins.LogInterceptor]
TransactionRolledbackException, causedBy:
java.sql.SQLException: Unable to load to deserialize result:
java.io.StreamCorruptedException: InputStream does not
contain a serialized object


----------------------------------------------------------------------

Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-06-24 18:48

Message:
Logged In: YES 
user_id=251431

I rewrote most of the JDBCUtil class.  Can you increace the
log level to trace for the org.jboss.ejb.plugins.cmp
category and post the log lines that immedately preceed the
exception?  You can find directions in the log4j.xml file in
the server/default/conf directory.

I am specifically looking for the results of this code:

log.trace("Get result: index=" + index +
      ", javaType=" + destination.getName() +
      ", Simple, value=" + value);

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=573192&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members! 
JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to