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.
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.

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]>

Reply via email to