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 David Forslund <dw...@lanl.gov> on 2003/06/05 06:21:40 UTC

Re: SequenceManager trouble with rc3

I'm having some problems moving from 0.9.8 in the SequenceManager.   I have 
a polymorphic class ObservationValue_ that
has multiple <extent-class>.   I have a primary key "valueId" which I try 
to increment with the call 
broker.serviceSequenceManager().getUniqueValue(field);
This call fails with a NullPointerExdeption.  It works in another case 
where the class isn't polymorphic.  I had a work around
in 0.9.8 to handle this case:
        /**
         try {
         // work around problem in OJB 0.9.8
             ClassDescriptor cld = broker.getClassDescriptor(clazz);
             if ( (cld.isAbstract() || cld.isInterface()) && cld.isExtent())
                clazz = (Class)cld.getExtentClasses().get(0);
             return broker.getUniqueId(clazz, fieldName);
         } catch (org.apache.ojb.broker.PersistenceBrokerException e) {
             cat.error("Can't get ID from broker: " + clazz.getName() + " " 
+ fieldName, e);

             // System.exit(1);
             return 0;
         }
          */
but I thought this should have been fixed.  The method getUniqueId isn't 
any more.
I did make a change along the lines above to redefine clazz and it seems to 
work.
Is this the way I should do it, or am I missing a new call somewhere?

Here is a segment of my repository_user.xml file:

  <!-- Class description for all classes implementing 
gov.lanl.COAS.ObservationValue_

  <class-descriptor class="gov.lanl.COAS.ObservationValue_">
    <extent-class class-ref="gov.lanl.COAS.Multimedia_"/>
    <extent-class class-ref="gov.lanl.COAS.NoInformation_"/>
    <extent-class class-ref="gov.lanl.COAS.Numeric_"/>
    <extent-class class-ref="gov.lanl.COAS.ObservationId_"/>
    <extent-class class-ref="gov.lanl.COAS.QualifiedCodeInfo_"/>
    <extent-class class-ref="gov.lanl.COAS.QualifiedPersonId_"/>
    <extent-class class-ref="gov.lanl.COAS.Range_"/>
    <extent-class class-ref="gov.lanl.COAS.String_"/>
    <extent-class class-ref="gov.lanl.COAS.TimeSpan_"/>
    <extent-class class-ref="gov.lanl.COAS.UniversalResourceIdentifier_"/>
    <extent-class class-ref="gov.lanl.COAS.Empty_"/>
  </class-descriptor>

  <class-descriptor
        class="gov.lanl.COAS.String_"
        table="OjbString_"
        isolation-level="read-uncommitted"
  >
    <field-descriptor   id="1"
        name="valueId"
        jdbc-type="INTEGER"
        column="valueId"
        primarykey="true"
    />
    <field-descriptor   id="2"
        name="string"
        jdbc-type="LONGVARCHAR"
        column="String"
    />
  </class-descriptor>

David W. Forslund                               dwf@lanl.gov
Computer and Computational Sciences             http://www.acl.lanl.gov/~dwf
Los Alamos National Laboratory          Los Alamos, NM 87545
505-663-5218                                    FAX: 505-663-5225