Weaver, Scott wrote:
Why you need to specify DListImpl as collection class?
I found this approach in the mailing list archive. If I don't specify it, OJB uses the RemovalAwareCollection instead. I would think, since I am using ODMG, this would be a better approach.
The real reason for this is that I have use cases that are failing. Example unit test case:
1:n automatic update use case:
A contains a collection of B. B has a reference back to its parent A. Calling A.addB(B) sets B's reference to A.
Create new A. Create new B. Add B to A.
Make A persistent.
A and B successfully persisted to the DB.
Clear the OJB cache
Retrieve A (using PB)
Start Tx (ODMG)
Lock A for writing (ODMG)
Create a new B2.
Add B2 to A.
Commit Tx.
Clear Cache.
Retrieve A (using PB)
Assert(A count Bs == 2) FAIL. B2 was never persisted.
ODMG's Persistence by reachability should have persisted B2, should it not?
I'm not a ODMG expert, but I guess you are right. I will add some new tests to reproduce your problem.
I made some quick test and it seems the problem is the reference (of B) back to its parent. When adding objects without an reference back to parent all works as expected.
Will try to fix this ASAP.
regars, Armin
I thought that using DList might fix this.
Regards,
*================================* | Scott T Weaver |
| <[EMAIL PROTECTED]> | | Apache Jetspeed Portal Project |
| Apache Pluto Portlet Container |
*================================*
-----Original Message----- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 9:37 AM To: OJB Users List Subject: Re: SQL exceptions when using DList
Hi Scott,
Weaver, Scott wrote:
Hi All,
I have never used the ODMG specific collection classes before. That
being
said, I just started using DList in some of my mappings.
Example:
<collection-descriptor name="portlets"
element-class-
ref="org.apache.jetspeed.om.common.portlet.PortletDefinitionCo
mposite" collection-class="org.apache.ojb.odmg.collections.DListImpl" > <inverse-foreignkey field-ref="appId"/> </collection-descriptor>
However, when I do specify the DListImpl, I get this error when updating
to
the DB:
Could not obtain next object: Can't build new sequence: Table not found: OJB_HL_SEQ in statement [SELECT A0.VERSION,A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDNAME,A0.TABLENAME FROM
OJB_HL_SEQ
A0 WHERE A0.TABLENAME LIKE 'SEQ_OJB_DLIST' ]
The DListImpl class request on creation time and for each entry an ID from the SequenceManager (DListImpl_2 a new implementation try to avoid this overhead) and it seems you don't have created the tables used by DListImpl.
Why you need to specify DListImpl as collection class?
regards, Armin
Thanks, *================================* | Scott T Weaver | | <[EMAIL PROTECTED]> | | Apache Jetspeed Portal Project | | Apache Pluto Portlet Container | *================================*
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
