Hi again Oliver,

[EMAIL PROTECTED] wrote:
Hello,

I have not got any reply to this, so I just
want to ask again. I am pretty sure that this bug is due to an issuficient fix for OJB48.
That fix just applies to the PersistenceBroker API,
but when using the ODMG API, a different
assertFKAssignment() method is used. See below.

Shall I make a bug report a scarab?
yes!

Shall I write a test case?
that's always the best way to communicate bugs!

thanks for your patience,

cheers,
Thomas

Oliver



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 13, 2003 10:45 AM
To: [EMAIL PROTECTED]
Subject: 0.9.8, ODMG: primary key with FieldConversion


Hello,

I am using OJB 0.9.8 and I am comparing the PersistenceBroker API to the
ODMG API.

I think I have encountered a bug.
I have a class NodeOJB which has a reference to itsself. The primary key
field is of type long,
and I have written a FieldConversion to BigDecimal. (see code snipplets at
the bottom.)

I can store instances of this class with the PersistenceBroker API, but I
get the following
exception when I use the ODMG API:

java.lang.IllegalArgumentException
at
sun.reflect.UnsafeLongFieldAccessorImpl.set(UnsafeLongFieldAcc
essorImpl.java
:84)
at java.lang.reflect.Field.set(Field.java:519)
at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefa
ultImpl.set(Pe
rsistentFieldDefaultImpl.java:146)
at
org.apache.ojb.odmg.TransactionImpl.assertFkAssignment(Transac
tionImpl.java:
806)
at
org.apache.ojb.odmg.TransactionImpl.assignReferenceFKs(Transac
tionImpl.java:
831)
at
org.apache.ojb.odmg.TransactionImpl.lock(TransactionImpl.java:250)

I have debugged into the code and found out that the problem can be fixed
with the following two
modifications in Identity.<init> and TransactionImpl.lockCollections(),
respectively.

But I think this solution is sub-optimal. A better solution would be to
factor out
common code from the methods PersistenceBrokerImpl.assertFKAssignment() (which is used during
PersistenceProker.store()) and
odmg.TransactionImpl.assertFKAssignment() (which is used during
odmg.Transaction.lock())

What do you think?

Oliver

------------------
U:\or-mappers\ojb\jakarta-ojb-0.9.8>diff
src\java\org\apache\ojb\broker\Identity.java
..\ojb-0.9.8-orig\src\java\org\apache\ojb\broker\Identity.java
144c144
< this.pkValues = cld.getKeyValues(objectToIdentitify,
false); ---

this.pkValues =
cld.getKeyValues(objectToIdentitify);
405c405
< }
------------------
U:\or-mappers\ojb\jakarta-ojb-0.9.8>diff
src\java\org\apache\ojb\odmg\TransactionImpl.java
..\ojb-0.9.8-orig\src\java\org\apache\ojb\odmg\TransactionImpl.java
873c873
< Object[] objPkValues = cld.getKeyValues(newTxObject,
false); ---

Object[] objPkValues =
cld.getKeyValues(newTxObject);
------------------

class NodeOJB
{
long uid;
NodeOJB rootNode;
long rootNode_refid;
...
}

<class-descriptor class="de.ppi.neuwerk.repman.persistent.ojb.NodeOjb"
table="NODE">
...
<field-descriptor id="1" name="uid" column="UID" autoincrement="true"
primarykey="true" jdbc-type="NUMERIC"
conversion="LongToBigDecimalConversion" />
<field-descriptor id="5" name="rootNode_refid" column="ROOTNODE_FK" jdbc-type="NUMERIC"
conversion="LongToBigDecimalConversion"
/>
...
</class-descriptor>

--
Dr. Oliver Matz
ppi Media GmbH
Deliusstra�e 10
D-24114 Kiel
phone +49 (0) 43 1-53 53-422
fax +49 (0) 43 1-53 53-2 22
email mailto:[EMAIL PROTECTED]
web www.ppi.de



--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to