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 Jin Bal <ji...@hotmail.com> on 2004/07/06 18:05:20 UTC
sequencemanagernative and mysql
I'm finding that the PK field with autoincrement are negative numbers - is this normal behaviour or is somehting up?
TIA
Jin
Re: sequencemanagernative and mysql
Posted by Armin Waibel <ar...@apache.org>.
Jin Bal wrote:
> Hi Armin
>
> I'm not using the ODMG API so I can't confirm this for you, I'm using PB
> only. The only object that the app CRUD's (via OJB) is the User object.
>
> We did notice that this issue is intermittent and stopped for a while but
> then started up again.
>
In test suite is a test called ...broker.sequence.NativeIdentifierTest.
This test use SequenceManagerNativeImpl and run against hsql and mysql.
You can easy run this test in your IDE. Maybe you can reproduce your
problem with this test or you can add a new test to show your problem.
regards,
Armins
>
> ----- Original Message -----
> From: "Armin Waibel" <ar...@apache.org>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Wednesday, July 07, 2004 10:53 AM
> Subject: Re: sequencemanagernative and mysql
>
>
>
>>Hi Jin,
>>
>>Jin Bal wrote:
>>
>>>At the moment it is not causing side effects as there is no key
>
> collision
>
>>>(yet) - I was wondering whether this was expected behaviour.
>>>
>>>My understanding is that OJB uses a temp negative PK before insert.
>
> does it
>
>>>then lookup the db generated one and set it in the persistent object
>
> durign
>
>>>the afterStore() operation?
>>>
>>
>>yep! I made some tests with PB-api and ODMG-api and it seems that when
>>using the odmg api + SequenceManagerNativeImpl + main object with single
>>reference, the FK set in the main object be wrong (negative value). Is
>>this your problem too?
>>
>>
>>
>>>Haven't got any code to post right now (will follow shortly) could
>
> there be
>
>>>an issue with the cache (i.e not flushing after insert)?
>>>
>>
>>normally the object will be stored to cache after the afterStore() call.
>>
>>regards,
>>Armin
>>
>>
>>
>>>Thanks
>>>Jin
>>>
>>>
>>>----- Original Message -----
>>>From: "Armin Waibel" <ar...@apache.org>
>>>To: "OJB Users List" <oj...@db.apache.org>
>>>Sent: Tuesday, July 06, 2004 5:57 PM
>>>Subject: Re: sequencemanagernative and mysql
>>>
>>>
>>>
>>>
>>>>Hi Jin,
>>>>
>>>>Jin Bal wrote:
>>>>
>>>>
>>>>>I'm finding that the PK field with autoincrement are negative numbers -
>>>
>>>is this normal behaviour or is somehting up?
>>>
>>>
>>>>hmm, the negative values are temporary used before the object was
>>>>written to DB.
>>>>See here
>>>>
>>>
>>>
> http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+seq
>
>>>uence+manager
>>>
>>>
>>>>Does it cause side-effects in your environment? Could you post some
>>>>pseudo code to show the problem?
>>>>
>>>>regards,
>>>>Armin
>>>>
>>>>
>>>>
>>>>>TIA
>>>>>Jin
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: sequencemanagernative and mysql
Posted by Jin Bal <ji...@hotmail.com>.
Hi Armin
I'm not using the ODMG API so I can't confirm this for you, I'm using PB
only. The only object that the app CRUD's (via OJB) is the User object.
We did notice that this issue is intermittent and stopped for a while but
then started up again.
----- Original Message -----
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Wednesday, July 07, 2004 10:53 AM
Subject: Re: sequencemanagernative and mysql
> Hi Jin,
>
> Jin Bal wrote:
> > At the moment it is not causing side effects as there is no key
collision
> > (yet) - I was wondering whether this was expected behaviour.
> >
> > My understanding is that OJB uses a temp negative PK before insert.
does it
> > then lookup the db generated one and set it in the persistent object
durign
> > the afterStore() operation?
> >
>
> yep! I made some tests with PB-api and ODMG-api and it seems that when
> using the odmg api + SequenceManagerNativeImpl + main object with single
> reference, the FK set in the main object be wrong (negative value). Is
> this your problem too?
>
>
> > Haven't got any code to post right now (will follow shortly) could
there be
> > an issue with the cache (i.e not flushing after insert)?
> >
>
> normally the object will be stored to cache after the afterStore() call.
>
> regards,
> Armin
>
>
> > Thanks
> > Jin
> >
> >
> > ----- Original Message -----
> > From: "Armin Waibel" <ar...@apache.org>
> > To: "OJB Users List" <oj...@db.apache.org>
> > Sent: Tuesday, July 06, 2004 5:57 PM
> > Subject: Re: sequencemanagernative and mysql
> >
> >
> >
> >>Hi Jin,
> >>
> >>Jin Bal wrote:
> >>
> >>>I'm finding that the PK field with autoincrement are negative numbers -
> >
> > is this normal behaviour or is somehting up?
> >
> >>hmm, the negative values are temporary used before the object was
> >>written to DB.
> >>See here
> >>
> >
> >
http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+seq
> > uence+manager
> >
> >>Does it cause side-effects in your environment? Could you post some
> >>pseudo code to show the problem?
> >>
> >>regards,
> >>Armin
> >>
> >>
> >>>TIA
> >>>Jin
> >>
> >>---------------------------------------------------------------------
> >>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
> >
> >
> >
>
> ---------------------------------------------------------------------
> 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
Re: sequencemanagernative and mysql
Posted by Armin Waibel <ar...@apache.org>.
Hi Jin,
Jin Bal wrote:
> At the moment it is not causing side effects as there is no key collision
> (yet) - I was wondering whether this was expected behaviour.
>
> My understanding is that OJB uses a temp negative PK before insert. does it
> then lookup the db generated one and set it in the persistent object durign
> the afterStore() operation?
>
yep! I made some tests with PB-api and ODMG-api and it seems that when
using the odmg api + SequenceManagerNativeImpl + main object with single
reference, the FK set in the main object be wrong (negative value). Is
this your problem too?
> Haven't got any code to post right now (will follow shortly) could there be
> an issue with the cache (i.e not flushing after insert)?
>
normally the object will be stored to cache after the afterStore() call.
regards,
Armin
> Thanks
> Jin
>
>
> ----- Original Message -----
> From: "Armin Waibel" <ar...@apache.org>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Tuesday, July 06, 2004 5:57 PM
> Subject: Re: sequencemanagernative and mysql
>
>
>
>>Hi Jin,
>>
>>Jin Bal wrote:
>>
>>>I'm finding that the PK field with autoincrement are negative numbers -
>
> is this normal behaviour or is somehting up?
>
>>hmm, the negative values are temporary used before the object was
>>written to DB.
>>See here
>>
>
> http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+seq
> uence+manager
>
>>Does it cause side-effects in your environment? Could you post some
>>pseudo code to show the problem?
>>
>>regards,
>>Armin
>>
>>
>>>TIA
>>>Jin
>>
>>---------------------------------------------------------------------
>>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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: sequencemanagernative and mysql
Posted by Jin Bal <ji...@hotmail.com>.
The code that saves the object is simply
broker.store(object);
thats it.
BTW i'm still using RC5.
Jin
----- Original Message -----
From: "Jin Bal" <ji...@hotmail.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Wednesday, July 07, 2004 8:25 AM
Subject: Re: sequencemanagernative and mysql
> At the moment it is not causing side effects as there is no key collision
> (yet) - I was wondering whether this was expected behaviour.
>
> My understanding is that OJB uses a temp negative PK before insert. does
it
> then lookup the db generated one and set it in the persistent object
durign
> the afterStore() operation?
>
> Haven't got any code to post right now (will follow shortly) could there
be
> an issue with the cache (i.e not flushing after insert)?
>
> Thanks
> Jin
>
>
> ----- Original Message -----
> From: "Armin Waibel" <ar...@apache.org>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Tuesday, July 06, 2004 5:57 PM
> Subject: Re: sequencemanagernative and mysql
>
>
> > Hi Jin,
> >
> > Jin Bal wrote:
> > > I'm finding that the PK field with autoincrement are negative
numbers -
> is this normal behaviour or is somehting up?
> > >
> >
> > hmm, the negative values are temporary used before the object was
> > written to DB.
> > See here
> >
>
http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+seq
> uence+manager
> >
> > Does it cause side-effects in your environment? Could you post some
> > pseudo code to show the problem?
> >
> > regards,
> > Armin
> >
> > > TIA
> > > Jin
> >
> > ---------------------------------------------------------------------
> > 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: sequencemanagernative and mysql
Posted by Jin Bal <ji...@hotmail.com>.
At the moment it is not causing side effects as there is no key collision
(yet) - I was wondering whether this was expected behaviour.
My understanding is that OJB uses a temp negative PK before insert. does it
then lookup the db generated one and set it in the persistent object durign
the afterStore() operation?
Haven't got any code to post right now (will follow shortly) could there be
an issue with the cache (i.e not flushing after insert)?
Thanks
Jin
----- Original Message -----
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Tuesday, July 06, 2004 5:57 PM
Subject: Re: sequencemanagernative and mysql
> Hi Jin,
>
> Jin Bal wrote:
> > I'm finding that the PK field with autoincrement are negative numbers -
is this normal behaviour or is somehting up?
> >
>
> hmm, the negative values are temporary used before the object was
> written to DB.
> See here
>
http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+seq
uence+manager
>
> Does it cause side-effects in your environment? Could you post some
> pseudo code to show the problem?
>
> regards,
> Armin
>
> > TIA
> > Jin
>
> ---------------------------------------------------------------------
> 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
Re: recursive maps
Posted by Thomas Dudziak <to...@first.fhg.de>.
Marcus Young wrote:
> Thanks Tom - the test cases against role and group now function
> correclty. The record id's appear to be unique across the extent set?
Depends on how you get their values. A simple MySQL-style autoincrement
in the database won't work, but if you're letting OJB create the values,
or if you have a database sequence defined for it, then you should be fine.
> Interestingly however, no data is actually written to the
> 'permission_holder' table - this includes the permisison holder id and
> any test attributes that are added to the permission holder class. This
> started me thinking about the possibility of a class-descriptor that
> defines a class that has no direct map to a database table. This
> descriptor would only contain information detailing relationships
> between other class-descriptors. I'm fairly new to this, so I not sure
> if this makes sense?!
Mapping an inheritance hierarchy to multiple tables is a somewhat
involved topic. If you haven't checked already, you should look here for
some details:
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Classes+on+Multiple+Joined+Tables
Basically you need references that use the special keyword 'super' to
referer to the base instance.
It would be a lot easier if you were able to map all subclass of
PermissionHolder to the same table, because in this case you'll only
need an additional field 'ojbConcreteClass' that tells OJB which class
to instantiate when reading a row from the table.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: recursive maps
Posted by Marcus Young <ma...@redcentre.com>.
Thanks Tom - the test cases against role and group now function
correclty. The record id's appear to be unique across the extent set?
Interestingly however, no data is actually written to the
'permission_holder' table - this includes the permisison holder id and
any test attributes that are added to the permission holder class. This
started me thinking about the possibility of a class-descriptor that
defines a class that has no direct map to a database table. This
descriptor would only contain information detailing relationships
between other class-descriptors. I'm fairly new to this, so I not sure
if this makes sense?!
Marcus
Thomas Dudziak wrote:
> Your m:n collection points to PermissionHolder, however this 'class'
> has no declared primary key field. Try adding the primary key field
> descriptor to it. Note that the primary key must be unique across
> RoleTO and GroupTO to make this work. You might also run into problems
> if you map RoleTO and GroupTO to different tables because in this case
> OJB currently has no way to determine which class to instantiate
> (there are plans to add support for a field containing the concrete
> class name to the referee side, e.g. the indirection table in your
> case, but they ain't implemented yet).
>
> Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: recursive maps
Posted by Thomas Dudziak <to...@first.fhg.de>.
Marcus Young wrote:
> Hi,
>
> I have two classes 'Role' and 'Group' that extend 'PermissionHolder".
> PermissionHolder includes as an attribute a collection of
> PermissionHolders. I am able to store a Role or a Group with contained
> permission holders successfully. However, I am having difficulties with
> retrevial. Exception as follows:
>
> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery:
> com.mysql.jdbc.PreparedStatement@15bdc50: SELECT
> A0.NAME,A0.DESCRIPTION,A0.ID FROM roles A0 WHERE A0.ID = 1584
> [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG:
> RsIterator[org.apache.ojb.broker.accesslayer.RsQueryObject[query:
> QueryByCriteria from class com.eclipsej.user.RoleTO where [_id = 1584],
> class descriptor: com.eclipsej.user.RoleTO]] initialized
> [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> true
> java.lang.NullPointerException
> at
> org.apache.ojb.broker.metadata.ClassDescriptor.getPkFields(ClassDescriptor.java:1016)
>
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getFKQueryMtoN(QueryReferenceBroker.java:660)
>
> at
> org.apache.ojb.broker.core.Que[org.apache.ojb.broker.core.PersistenceBrokerImpl]
> DEBUG: PB.close was called:
> org.apache.ojb.broker.core.PersistenceBrokerImpl@1a5f739
> [org.apache.ojb.broker.cache.InternalCache] WARN: Found 1 abandoned
> objects in local cache, check code to force push to real ObjectCache
> ryReferenceBroker.getFKQuery(QueryReferenceBroker.java:608)
>
>
> In this case role (id=1584) has a single group in its collection.
> I have also attached a copy of the repository. I'm sure I'm missing
> something simple - any help would be appreciated....
>
>
> <!-- Definitions for com.eclipsej.permissions.PermissionHolder -->
> <class-descriptor class="com.eclipsej.permission.PermissionHolder"
> table="permission_holders"> <extent-class
> class-ref="com.eclipsej.user.RoleTO" />
> <extent-class class-ref="com.eclipsej.user.GroupTO" />
> </class-descriptor>
> <!-- Defnitions for com.eclipsej.user.RoleTO -->
> <class-descriptor class="com.eclipsej.user.RoleTO" table="roles">
> <field-descriptor name="_id" column="ID" jdbc-type="BIGINT"
> primarykey="true" autoincrement="true"/>
> <field-descriptor name="_name" column="NAME" jdbc-type="VARCHAR"/>
> <field-descriptor name="_description" column="DESCRIPTION"
> jdbc-type="VARCHAR"/> <collection-descriptor
> name="_permissionHolders"
> element-class-ref="com.eclipsej.permission.PermissionHolder"
> auto-retreive="true"
> auto-update="true"
> auto-delete="false"
> indirection-table="permission_holder_map"
> >
> <fk-pointing-to-this-class column="permission_holder_host_id"/>
> <fk-pointing-to-element-class
> column="permission_holder_client_id"/>
> </collection-descriptor> </class-descriptor>
Your m:n collection points to PermissionHolder, however this 'class' has
no declared primary key field. Try adding the primary key field
descriptor to it. Note that the primary key must be unique across RoleTO
and GroupTO to make this work. You might also run into problems if you
map RoleTO and GroupTO to different tables because in this case OJB
currently has no way to determine which class to instantiate (there are
plans to add support for a field containing the concrete class name to
the referee side, e.g. the indirection table in your case, but they
ain't implemented yet).
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
recursive maps
Posted by Marcus Young <ma...@redcentre.com>.
Hi,
I have two classes 'Role' and 'Group' that extend 'PermissionHolder".
PermissionHolder includes as an attribute a collection of
PermissionHolders. I am able to store a Role or a Group with contained
permission holders successfully. However, I am having difficulties with
retrevial. Exception as follows:
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery:
com.mysql.jdbc.PreparedStatement@15bdc50: SELECT
A0.NAME,A0.DESCRIPTION,A0.ID FROM roles A0 WHERE A0.ID = 1584
[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG:
RsIterator[org.apache.ojb.broker.accesslayer.RsQueryObject[query:
QueryByCriteria from class com.eclipsej.user.RoleTO where [_id = 1584],
class descriptor: com.eclipsej.user.RoleTO]] initialized
[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> true
java.lang.NullPointerException
at
org.apache.ojb.broker.metadata.ClassDescriptor.getPkFields(ClassDescriptor.java:1016)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getFKQueryMtoN(QueryReferenceBroker.java:660)
at
org.apache.ojb.broker.core.Que[org.apache.ojb.broker.core.PersistenceBrokerImpl]
DEBUG: PB.close was called:
org.apache.ojb.broker.core.PersistenceBrokerImpl@1a5f739
[org.apache.ojb.broker.cache.InternalCache] WARN: Found 1 abandoned
objects in local cache, check code to force push to real ObjectCache
ryReferenceBroker.getFKQuery(QueryReferenceBroker.java:608)
In this case role (id=1584) has a single group in its collection.
I have also attached a copy of the repository. I'm sure I'm missing
something simple - any help would be appreciated....
<!-- Definitions for com.eclipsej.permissions.PermissionHolder -->
<class-descriptor class="com.eclipsej.permission.PermissionHolder"
table="permission_holders">
<extent-class class-ref="com.eclipsej.user.RoleTO" />
<extent-class class-ref="com.eclipsej.user.GroupTO" />
</class-descriptor>
<!-- Defnitions for com.eclipsej.user.RoleTO -->
<class-descriptor class="com.eclipsej.user.RoleTO" table="roles">
<field-descriptor name="_id" column="ID" jdbc-type="BIGINT"
primarykey="true" autoincrement="true"/>
<field-descriptor name="_name" column="NAME" jdbc-type="VARCHAR"/>
<field-descriptor name="_description" column="DESCRIPTION"
jdbc-type="VARCHAR"/>
<collection-descriptor name="_permissionHolders"
element-class-ref="com.eclipsej.permission.PermissionHolder"
auto-retreive="true"
auto-update="true"
auto-delete="false"
indirection-table="permission_holder_map"
>
<fk-pointing-to-this-class column="permission_holder_host_id"/>
<fk-pointing-to-element-class
column="permission_holder_client_id"/>
</collection-descriptor>
</class-descriptor>
Marcus
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: n <-> m relations on 1r7
Posted by Armin Waibel <ar...@apache.org>.
Hi Jim,
> java.lang.NullPointerException
> at
>
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatched(Unknown
> Source)
this stack trace didn't help much. Please compile the OJB jar with
'ant jar-debug' to get the line number of the NPE.
There is a test case (M2NTest.java) in OJB test-suite query objects with
m:n relation and this test pass.
By the way, did you tried to use OJB 1.0?
regards,
Armin
Jim Theodoridis wrote:
> Hi
>
> I am using ojb 1r7 struts and tomcat 5.0
> the following declarations works fine on ojb 0.7
>
> I am having n<->m relation Author <-> Document in the database i use
> table writes like this
> Author ----> Writes <------ Document
> the repository_user.xml about class Document is:
>
> <!-- Definitions for gr.tera.encyclopedia.bo.DocumentBO -->
> <class-descriptor
> class="gr.tera.encyclopedia.bo.DocumentBO"
> table="DOCUMENT"
> >
> <field-descriptor
> name="id"
> column="DOCUMENTID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
> <field-descriptor
> name="year"
> column="DOCUMENTYEAR"
> jdbc-type="INTEGER"
> />
> <field-descriptor
> name="categoryID"
> column="DOCUMENTCATEGORYID"
> jdbc-type="INTEGER"
> />
> <field-descriptor
> name="kindID"
> column="DOCUMENTKINDID"
> jdbc-type="INTEGER"
> />
> <field-descriptor
> name="name"
> column="DOCUMENTTITLE"
> jdbc-type="VARCHAR"
> />
>
> <!-- Relation n-m with AUTHOR thru WRITES -->
> <collection-descriptor
> name="authors"
> element-class-ref="gr.tera.encyclopedia.bo.AuthorBO"
> auto-retrieve="true"
> auto-update="true"
> indirection-table="WRITES"
> orderby="AUTHORNAME"
> >
> <fk-pointing-to-this-class column="DOCUMENTID"/>
> <fk-pointing-to-element-class column="AUTHORID"/>
> </collection-descriptor>
>
> </class-descriptor>
>
> ......
>
> When i am trying to get a collection of documents i am taking the
> following error
>
> java.lang.NullPointerException
> at
> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatched(Unknown
> Source)
> at
> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelationship(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> gr.tera.encyclopedia.service.EncyclopediaServiceImpl.getDocuments(EncyclopediaServiceImpl.java:104)
>
> at
> org.apache.jsp.showDocuments$jsp._jspService(showDocuments$jsp.java:71)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
>
> at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
>
> at java.lang.Thread.run(Thread.java:536)
> org.apache.ojb.broker.PersistenceBrokerException:
> java.lang.NullPointerException
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> Source)
> at
> gr.tera.encyclopedia.service.EncyclopediaServiceImpl.getDocuments(EncyclopediaServiceImpl.java:104)
>
> at
> org.apache.jsp.showDocuments$jsp._jspService(showDocuments$jsp.java:71)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>
> at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> at
> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
>
> at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
>
> at java.lang.Thread.run(Thread.java:536)
> Caused by: java.lang.NullPointerException
> at
> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatched(Unknown
> Source)
> at
> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelationship(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown
> Source)
> at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> ... 41 more
>
>
> ---------------------------------------------------------------------
> 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
n <-> m relations on 1r7
Posted by Jim Theodoridis <oj...@tera.gr>.
Hi
I am using ojb 1r7 struts and tomcat 5.0
the following declarations works fine on ojb 0.7
I am having n<->m relation Author <-> Document in the database i use
table writes like this
Author ----> Writes <------ Document
the repository_user.xml about class Document is:
<!-- Definitions for gr.tera.encyclopedia.bo.DocumentBO -->
<class-descriptor
class="gr.tera.encyclopedia.bo.DocumentBO"
table="DOCUMENT"
>
<field-descriptor
name="id"
column="DOCUMENTID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="year"
column="DOCUMENTYEAR"
jdbc-type="INTEGER"
/>
<field-descriptor
name="categoryID"
column="DOCUMENTCATEGORYID"
jdbc-type="INTEGER"
/>
<field-descriptor
name="kindID"
column="DOCUMENTKINDID"
jdbc-type="INTEGER"
/>
<field-descriptor
name="name"
column="DOCUMENTTITLE"
jdbc-type="VARCHAR"
/>
<!-- Relation n-m with AUTHOR thru WRITES -->
<collection-descriptor
name="authors"
element-class-ref="gr.tera.encyclopedia.bo.AuthorBO"
auto-retrieve="true"
auto-update="true"
indirection-table="WRITES"
orderby="AUTHORNAME"
>
<fk-pointing-to-this-class column="DOCUMENTID"/>
<fk-pointing-to-element-class column="AUTHORID"/>
</collection-descriptor>
</class-descriptor>
......
When i am trying to get a collection of documents i am taking the
following error
java.lang.NullPointerException
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatched(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelationship(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
gr.tera.encyclopedia.service.EncyclopediaServiceImpl.getDocuments(EncyclopediaServiceImpl.java:104)
at
org.apache.jsp.showDocuments$jsp._jspService(showDocuments$jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
org.apache.ojb.broker.PersistenceBrokerException:
java.lang.NullPointerException
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
gr.tera.encyclopedia.service.EncyclopediaServiceImpl.getDocuments(EncyclopediaServiceImpl.java:104)
at
org.apache.jsp.showDocuments$jsp._jspService(showDocuments$jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatched(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelationship(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
... 41 more
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: sequencemanagernative and mysql
Posted by Armin Waibel <ar...@apache.org>.
Hi Jin,
Jin Bal wrote:
> I'm finding that the PK field with autoincrement are negative numbers - is this normal behaviour or is somehting up?
>
hmm, the negative values are temporary used before the object was
written to DB.
See here
http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+sequence+manager
Does it cause side-effects in your environment? Could you post some
pseudo code to show the problem?
regards,
Armin
> TIA
> Jin
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: sequencemanagernative and mysql
Posted by Thomas Dudziak <to...@first.fhg.de>.
Jin Bal wrote:
>I'm finding that the PK field with autoincrement are negative numbers - is this normal behaviour or is somehting up?
>
>
Where, in the database or in the Java field ? What are the types,
respectively ?
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org