You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Robert Coup <rc...@ec.auckland.ac.nz> on 2003/12/04 05:57:53 UTC

ODMG DList Removal left-overs

Hi all,

I'm trying to solve a small problem with the ODMG DList - we have created a
class called TypedSet inherited from the OJB DListImpl. That's all fine and
good, except when we have cleaned up all our objects there are a large number of
entries still in the  OJB_DLIST and OJB_DLIST_ENTRIES tables. 

For our cleanup, generally its of the form:
  Iterator iter = <<TypedSetInstance>>.iterator();
  while (iter.hasNext()) {
    Object o = iter.next();
    db.deletePersistent(o);  <<< only if appropriate
    iter.remove();
  }
Which is my understanding of the 'correct' way after trawling through the list
archives :)

Does DList automatically persist itself in the database on creation? TypedSet's
are sometimes used for other non-persistent things in our application as well...
could this be the cause of the left-overs?

I tried inheriting TypedSet from DListImpl_2 and got the error as below - I'm
not sure whether it is a bug or not since the tests it was running passed using
DListImpl and changing nothing else... the exception occured when trying to
persist the first object in the test...

Thanks for your help,

Rob :)

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

Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:
nz.ac.auckland.markit.core.TypedSet not found in OJB Repository
        at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source)
        at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Unknown Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getClassDescriptor(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getClassDescriptor(Unknown
Source)
        at org.apache.ojb.odmg.TransactionImpl.lock(Unknown Source)
        at org.apache.ojb.odmg.collections.DListImpl_2.add(Unknown Source)
        at nz.ac.auckland.markit.core.TypedSet.add(TypedSet.java:47)
        at java.util.AbstractList.add(AbstractList.java:88)
        at nz.ac.auckland.markit.core.PaperFactory.createPaper(PaperFactory.java:87)




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ODMG DList Removal left-overs

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,

 > Does DList automatically persist itself in the database on creation?

If you use DListImpl within a tx and you commit tx, then I think the 
list will be persist itself. DListImpl_2 does not lock(persist) itself 
while a tx is running. You have explicitly lock DListImpl_2 instances to 
them persistent in DB.


 > I tried inheriting TypedSet from DListImpl_2 and got the error as 
below - I'm
...
 > Caused by: 
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:
 > nz.ac.auckland.markit.core.TypedSet not found in OJB Repository
 >         at
 > 
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown 
Source)
 >         at

Did you define a class-descriptor for TypedSet in your repository file?


regards,
Armin

Robert Coup wrote:
> Hi all,
> 
> I'm trying to solve a small problem with the ODMG DList - we have created a
> class called TypedSet inherited from the OJB DListImpl. That's all fine and
> good, except when we have cleaned up all our objects there are a large number of
> entries still in the  OJB_DLIST and OJB_DLIST_ENTRIES tables. 
> 
> For our cleanup, generally its of the form:
>   Iterator iter = <<TypedSetInstance>>.iterator();
>   while (iter.hasNext()) {
>     Object o = iter.next();
>     db.deletePersistent(o);  <<< only if appropriate
>     iter.remove();
>   }
> Which is my understanding of the 'correct' way after trawling through the list
> archives :)
> 
> Does DList automatically persist itself in the database on creation? TypedSet's
> are sometimes used for other non-persistent things in our application as well...
> could this be the cause of the left-overs?
> 
> I tried inheriting TypedSet from DListImpl_2 and got the error as below - I'm
> not sure whether it is a bug or not since the tests it was running passed using
> DListImpl and changing nothing else... the exception occured when trying to
> persist the first object in the test...
> 
> Thanks for your help,
> 
> Rob :)
> 
> ----------------------------
> 
> Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:
> nz.ac.auckland.markit.core.TypedSet not found in OJB Repository
>         at
> org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source)
>         at
> org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Unknown Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getClassDescriptor(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getClassDescriptor(Unknown
> Source)
>         at org.apache.ojb.odmg.TransactionImpl.lock(Unknown Source)
>         at org.apache.ojb.odmg.collections.DListImpl_2.add(Unknown Source)
>         at nz.ac.auckland.markit.core.TypedSet.add(TypedSet.java:47)
>         at java.util.AbstractList.add(AbstractList.java:88)
>         at nz.ac.auckland.markit.core.PaperFactory.createPaper(PaperFactory.java:87)
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org