Indeed. It worked with with MySQL and I upgraded the hsqldb and it works with it, too!

Thanks,

Dave
At 10:56 PM 12/30/2002 +0100, Armin Waibel wrote:
Damned! A hard nut to crack ;-)
Now it seems to be a field configuration or a database problem.
In both cases I'm not a expert.

<snip>
/*
     * @see Platform#setObject(PreparedStatement, int, Object, int)
     */
    public void setObjectForStatement(PreparedStatement ps, int index,
Object value, int sqlType)
            throws SQLException
    {
        if ((value instanceof String) && (sqlType == Types.LONGVARCHAR))
        {
            String s = (String) value;
            ps.setCharacterStream(index, new StringReader(s),
s.length());
        }
        else
        {
            ps.setObject(index, value, sqlType);
        }
    }

setCharacterStream was called when LONGVARCHAR was used.
Did you use the latest version of hsql? I think in current version there
should be LONGVARCHAR fields supported.
Maybe take a look in the repository_junit.xml for alternatives field
type.
Sorry, I couldn't help more.

regards,
Armin

----- Original Message -----
From: "David Forslund" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Monday, December 30, 2002 10:25 PM
Subject: Re: problems with ojb 0.9.8


> At 09:25 PM 12/30/2002 +0100, Armin Waibel wrote:
> >Hi again,
> >
> > > > > >
> > > > > > > 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.
> > >
> > >
> > > > > >
> > > >
> >
>>>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'm not sure what you mean by a code snippet.  When I call the
class
> > > constructor,
> > > 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 {
> >                 // get the CLD for the base class
> >                 ClassDescriptor cld =
broker.getClassDescriptor(clazz);
> >                 if( (cld.isAbstract || cld.isInterface()) &&
> >cld.isExtent())
> >                 {
> >                     // get the first found extent class
> >                       clazz = cld.getExtentClasses().get(0) // we
grap
> >the first
> >                 }
> >
> > >              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;
> > >          }
> > >      }
> > >
> >Maybe this could be a workaround for your problem.
> >Keep in mind that getUniqueId(clazz, fieldName) was deprecated
> >and will be replaced by getUniqueId(FieldDescriptor field).
> >
> >What I don't understand is, why you need a getNextSeq method,
> >when you define autoincrement fields? OJB does all sequence key
> >generation automatic for you.
>
> It didn't use to.  Plus we allow for other OR mapping tools and
> need some level of control of ids, independent of the tool.
>
> OK.  I made this change and that problem went away, but another
> one came up.  I now get an error from hsqldb that the requested
function
> is not supported:
>
> [org.apache.ojb.broker.accesslayer.JdbcAccess] ERROR: SQLException
during
> the ex
> ecution of the insert (for a gov.lanl.COAS.String_): This function is
not
> supported
> This function is not supported
> java.sql.SQLException: This function is not supported
>          at org.hsqldb.Trace.getError(Trace.java:180)
>          at org.hsqldb.Trace.getError(Trace.java:144)
>          at org.hsqldb.Trace.error(Trace.java:192)
>          at
> org.hsqldb.jdbcPreparedStatement.getNotSupported(jdbcPreparedStatemen
> t.java:1602)
>          at
>
org.hsqldb.jdbcPreparedStatement.setCharacterStream(jdbcPreparedStatemen
t.java:1375)
>          at
>
org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatemen
t(PlatformDefaultImpl.java:216)
>          at
>
org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(StatementM
anager.java:487)
>          at
>
org.apache.ojb.broker.accesslayer.JdbcAccess.executeInsert(JdbcAccess.ja
va:194)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeToDb(Persisten
ceBrokerImpl.java:1966)
>          at
> org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(Persistence
BrokerImpl.java:1905)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBr
okerImpl.java:614)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeReferences(Per
sistenceBrokerImpl.java:641)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeToDb(Persisten
ceBrokerImpl.java:1938)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBr
okerImpl.java:1905)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBr
okerImpl.java:614)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeCollectionObje
ct(PersistenceBrokerImpl.java:789)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeCollections(Pe
rsistenceBrokerImpl.java:769)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeToDb(Persisten
ceBrokerImpl.java:1989)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBr
okerImpl.java:1905)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBr
okerImpl.java:614)
>          at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBr
okerImpl.java:588)
>          at
>
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.store(Delegat
ingPersistenceBroker.java:123)
>          at
> gov.lanl.Database.OJBDatabaseMgr.insertElement(OJBDatabaseMgr.java:30
>
> Thanks,
>
> Dave
>
> >HTH
> >regards,
> >Armin
> >
> > > 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]>
> > >
> > >
> > >
> >
> >
> >--
> >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