hey all,
Forums are down, so I'm posting this here.
Using JBoss 2.4.4, with PostgreSQL 7.1.3 on linux.
I have an entity bean, that has one field that is of type java.lang.Object. The
relevant section of the jaws.xml file is:
<cmp-field>
<field-name>payload</field-name>
<column-name>payload</column-name>
<sql-type>OID</sql-type>
<jdbc-type>JAVA_OBJECT</jdbc-type>
</cmp-field>
which I think is right. The field is an object because I dont know what type it will
be, and am looking for the easy option of just
serializing it into a blob.
Now if I create an instance of the entity, everything works fine. and because the
entity instance is in the cache (I assume) and
I'm using commit-option A, everything works fine. I can create the instance with the
payload of type MySerializableType and it is
inserted into the db. I can verify this by pulling it out and unwrapping it from the
MarshalledObject.
However, if I change to multiple JBoss instances using DB-level locking
(select-for-update true, and commit-option B), then I have
problems. When the entity instance is loaded from the db, the field is loaded as a
java.lang.Integer, instead of
MySerializableType. I've tracked this down to JDBCCommand, where getResultObject (I
think thats the name of the method) is called.
It calls ResultSet.getObject(int), which returns an instance of java.lang.Integer.
This is then returned, and so my payload field
is then the Integer value of the OID, rather than the java object that is serialized
into the blob identified by the OID.
I've had a fair look through the source, and feel pretty comfortable with changing
things, but I cant think of a solution that wont
break other requirements.
My options so far are:
(a) Store the object as some specific type so that it cant be loaded into an integer
(b) Store the object as a MarshalledObject, and unwrap it myself in the entity bean.
I dont particularly like either of these options, (b) is probably marginally better.
I cant see what I could do to change the JAWS
code to make it work. If anyone could offer any suggestions I'd be greatful.
cheers
dim
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user