At 08:51 PM 12/30/2002 +0100, Armin Waibel wrote:
Hi again,----- Original Message ----- From: "David Forslund" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]>; "OJB Users List" <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 8:32 PM Subject: Re: problems with ojb 0.9.8 > At 08:18 PM 12/30/2002 +0100, Armin Waibel wrote: > >Hi Dave, > > > >----- Original Message ----- > >From: "David Forslund" <[EMAIL PROTECTED]> > >To: "OJB Users List" <[EMAIL PROTECTED]> > >Sent: Monday, December 30, 2002 7:53 PM > >Subject: Re: problems with ojb 0.9.8 > > > > > > > I see what the problem is, but am not sure what the solution is. > > > > > > I have a an abstract class that is implemented with a number of > >classes. > > > I'm trying to create a unique key for an instance class, but when I > > > check there are no field descriptors for the base class. > > > >Have you tried > >Class realClass = abstractBaseClass.getClass(); > >ClassDescriptor cld = broker.getClassDescriptor(realClass); > >to get the real class descriptor? Then it should possible to get the > >field. > > This doesn't help because I'm just calling the getUniqueId within OJB > and I don't have any control over what it does except through > the repository. I do not understand this. You declare your 'valueId' as a autoincrement field, but in your stack trace it seems you do a direct call PB.getUniqueId?
Well I did add this because 0.9.8 was complaining about this field being absent. I have removed it without any change in the behavior.
I'm not sure what you mean by a code snippet. When I call the class constructor,> > >>>org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getUniqueI > > > >>> > > >gov.lanl.Database.OJBDatabaseMgr.getNextSeq(OJBDatabaseMgr.java:582) > > > >>> > at > > > >>> > > > > > > >>>gov.lanl.COAS.AbstractObservationValue_.<init>(AbstractObservationVal Could you post a code snip to ease my understanding? But by the way this seems to be a bug.
I call getUniqueId with the class name and attribute:
This is the specific method I call .
/**
* return next number in a persistent sequence
*/
public long getNextSeq(Class clazz, String fieldName) {
cat.debug("getNextSeq: "+clazz.getName() + " "+fieldName);
// return sequenceManager.getUniqueId(clazz, fieldName);
try {
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;
}
}
thanks,
Dave
Armin
>
> >Or define your base class with all fields in the repository file and
> >declare
> >all extent-classes in the class-descriptor. Then the default sequence
> >manager implementations should be able to generate a id unique
> >across all extents.
> >Or define only the abstract class with all extent-classes, then you
> >should be
> >able to get one of the extent classes.
>
> This is how I have it defined in my repository_user.xml
>
> <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>
>
> and an example for one of the extent classes
>
> <class-descriptor
> isolation-level="read-uncommitted"
> class="gov.lanl.COAS.Empty_"
> table="OjbEmpty_"
> >
> <field-descriptor id="1"
> name="valueId"
> jdbc-type="INTEGER"
> column="valueId"
> primarykey="true"
> autoincrement="true"
> />
>
> </class-descriptor>
>
> there is no table for the ObservationValue_ class because it is an
Abstract
> Class.
> this is what I've been using for 0.9.7 and it works fine. this fails
under
> 0.9.8
> when trying to get a uniqueid for each of the extent classes. I think
this
> is what
> you are describing in your last suggestion.
>
> thanks,
> Dave
>
>
> >HTH
> >regards,
> >Armin
> >
> > >
> > > This all worked fine in 0.9.7, but perhaps there has been some
change
> > > in the semantics? We put the necessary table elements in each
> >instance
> > > of the class but not in the table for the base class (which
actually
> > > doesn't exist).
> > >
> > > Thanks,
> > >
> > > Dave
> > >
> > > At 11:35 AM 12/30/2002 -0700, David Forslund wrote:
> > > >When I put a check inside of the getFieldDescriptor, I find that
it
> >is
> > > >being called by HighLowSequence
> > > >with the argument ojbConcreteClass and is returning a null for
the
> > > >field. Is this what is expected?
> > > >
> > > >Dave
> > > >
> > > >At 10:43 AM 12/30/2002 -0700, David Forslund wrote:
> > > >>It wasn't null in my code that called the OJB code. This code
has
> >been
> > > >>working fine in 0.9.7. If the xml needed to change for some
> >reason,
> > > >>it might have caused this. I'm passing in a string of a
variable
> >that
> > > >>is defined in my table. Whether OJB properly connects a
"Field"
> > > >>to that table is where the problem may be. It did in the past
> >without
> > > >>any problem. I have a hard time telling exactly what changed
> >between
> > > >>these two versions.
> > > >>
> > > >>Thanks,
> > > >>
> > > >>Dave
> > > >>At 01:49 PM 12/30/2002 +0100, Armin Waibel wrote:
> > > >>>Hi David,
> > > >>>
> > > >>>the sequence generator implementation now only generate
> > > >>>id's for fields declared in the repository.
> > > >>>I think you got this NullPointerException, because SM get a
> > > >>>'null' field:
> > > >>>
> > > >>><snip SequenceManagerHelper>
> > > >>>public static String buildSequenceName(
> > > >>>PersistenceBroker brokerForClass, FieldDescriptor field)
> > > >>> {
> > > >>>48--->!!! ClassDescriptor cldTargetClass =
> >field.getClassDescriptor();
> > > >>> String seqName = field.getSequenceName();
> > > >>>.....
> > > >>></snip>
> > > >>>
> > > >>>So check your code if the given FiledDescriptor wasn't null.
> > > >>>
> > > >>>HTH
> > > >>>
> > > >>>regards,
> > > >>>Armin
> > > >>>
> > > >>>----- Original Message -----
> > > >>>From: "David Forslund" <[EMAIL PROTECTED]>
> > > >>>To: "OJB Users List" <[EMAIL PROTECTED]>
> > > >>>Sent: Monday, December 30, 2002 1:33 AM
> > > >>>Subject: Re: problems with ojb 0.9.8
> > > >>>
> > > >>>
> > > >>> > I'm trying to upgrade from 0.9.7 to 0.9.8 and am having some
> >problems
> > > >>>that
> > > >>> > I don't understand yet.
> > > >>> >
> > > >>> > I'm getting the warning about not finding an autoincrement
> >attribute
> > > >>>for a
> > > >>> > class. I'm not sure when
> > > >>> > I have to have an autoincrement attribute, but the
primarykey
> >for the
> > > >>>class
> > > >>> > I'm using is a varchar
> > > >>> > so that autoincrement doesn't seem appropriate.
> > > >>> >
> > > >>> > Subsequently, I get an null pointer exception error in the
> > > >>> > SequenceManagerHelper that I don't understand:
> > > >>> > java.lang.NullPointerException
> > > >>> > at
> > > >>> >
> > >
> >
>>>org.apache.ojb.broker.util.sequence.SequenceManagerHelper.buildSequen
> >ceN
> > > >>>ame(SequenceManagerHelper.java:48)
> > > >>> > at
> > > >>> >
> > >
> >
>>>org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl.getUnique
> >Id(
> > > >>>SequenceManagerHiLoImpl.java:49)
> > > >>> > at
> > > >>> >
> > >
> >
>>>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getUniqueId(Pers
> >ist
> > > >>>enceBrokerImpl.java:2258)
> > > >>> > at
> > > >>> >
> > >
> >
>>>org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getUniqueI
> >d(D
> > > >>>elegatingPersistenceBroker.java:242)
> > > >>> > at
> > > >>> >
> >gov.lanl.Database.OJBDatabaseMgr.getNextSeq(OJBDatabaseMgr.java:582)
> > > >>> > at
> > > >>> >
> > >
> >
>>>gov.lanl.COAS.AbstractObservationValue_.<init>(AbstractObservationVal
> >ue_
> > > >>>.java:54)
> > > >>> > at gov.lanl.COAS.Empty_.<init>(Empty_.java:31)
> > > >>> >
> > > >>> > I'm pretty sure that it is being called correctly from my
code
> >(which
> > > >>>works
> > > >>> > fine in 0.9.7), but it is failing now.
> > > >>> >
> > > >>> > An unrelated warning in a different application is that OJB
says
> >I
> > > >>>should
> > > >>> > use addLike() for using LIKE, but it
> > > >>> > seems to use the right code anyway. Is this just a
deprecation
> >issue?
> > > >>>I
> > > >>> > don't see why it bothers
> > > >>> > to tell me this, if it can figure what to do anyway.
> > > >>> >
> > > >>> > Thanks,
> > > >>> >
> > > >>> > Dave
> > > >>> >
> > > >>> >
> > > >>> > --
> > > >>> > 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]>
> > > >
> > > >
> > > >--
> > > >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]>
>
>
> --
> 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]>
