My contaning class looks like:
<class-descriptor
class="uk.co.magus.trawl.Trawl"
table="TRAWL"
>
<field-descriptor
name="id"
column="id"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
>
</field-descriptor>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
>
</field-descriptor>
<collection-descriptor
name="startingURLs"
element-class-ref="uk.co.magus.trawl.URL"
auto-retrieve="true"
auto-update="false"
auto-delete="false"
>
<inverse-foreignkey field-ref="trawlId"/>
</collection-descriptor>
</class-descriptor>
I run the query as:
Implementation odmg= getODMGBrokerAPI();
Database db= odmg.newDatabase();
db.open("default", Database.OPEN_READ_WRITE);
OQLQuery query= odmg.newOQLQuery();
query.create("select alltrawls from " + Trawl.class.getName());
DList allTrawls= (DList) query.execute();
which always returns just 1 result :-(
Dumping the SQL gives:
18:15:07,462 ERROR [STDERR] Query "SET autocommit=0" execution time: 0
18:15:07,462 ERROR [STDERR] Query "SELECT MAX(ID) FROM OJB_DLIST" execution
time: 0 result set fetch time: 0
18:15:07,493 ERROR [STDERR] Query "SELECT A0.NAME,A0.id FROM TRAWL A0"
execution time: 0 result set fetch time:
0
18:15:07,524 ERROR [STDERR] Query "SELECT
A0.URL,A0.TRAWLID,A0.NORMALISEDURL,A0.id FROM CACHEDURL A0 WHERE A0.TRAWLID
= 1 " execution time: 0 result set fetch time: 0
18:15:07,524 WARN [WrappedConnection] Closing a statement you left open, please do
your own housekeeping
18:15:07,524 ERROR [STDERR] Query "SELECT A0.URL,A0.TRAWLID,A0.id FROM
STARTINGURL A0 WHERE A0.TRAWLID = 1 " exec
ution time: 0 result set fetch time: 0
18:15:07,540 ERROR [STDERR] Query "SELECT MAX(ID) FROM OJB_DLIST_ENTRIES"
execution time: 0 result set fetch time:
0
18:15:07,555 INFO [STDOUT] Query returned: 1 objects.
18:15:07,555 ERROR [STDERR] Query "SELECT
A0.TIMESTAMP_,A0.TX_ID,A0.OID_,A0.LOCKTYPE,A0.ISOLATIONLEVEL FROM OJB_LOCKEN
TRY A0 WHERE A0.TIMESTAMP_ < 1054314847555 " execution time: 0 result set
fetch time: 0
18:15:07,571 ERROR [STDERR] Query "SELECT
A0.TIMESTAMP_,A0.TX_ID,A0.OID_,A0.LOCKTYPE,A0.ISOLATIONLEVEL FROM OJB_LOCKEN
TRY A0 WHERE (A0.OID_ = 'uk.co.magus.trawl.Trawl{1}' ) AND A0.LOCKTYPE = 1 "
execution time: 0 result set fetch time:
0
18:15:07,571 ERROR [STDERR] Query "SELECT
A0.TIMESTAMP_,A0.TX_ID,A0.OID_,A0.LOCKTYPE,A0.ISOLATIONLEVEL FROM OJB_LOCKEN
TRY A0 WHERE A0.TIMESTAMP_ < 1054314847571 " execution time: 0 result set
fetch time: 0
18:15:07,571 ERROR [STDERR] Query "SELECT
A0.TIMESTAMP_,A0.TX_ID,A0.OID_,A0.LOCKTYPE,A0.ISOLATIONLEVEL FROM OJB_LOCKEN
TRY A0 WHERE (A0.OID_ = 'uk.co.magus.trawl.URL{1}' ) AND A0.LOCKTYPE = 1 "
execution time: 0 result set fetch time:
0
18:15:07,571 ERROR [STDERR] Query "commit" execution time: 0
18:15:07,571 ERROR [STDERR] Query "SET autocommit=1" execution time: 0
18:15:07,571 ERROR [STDERR] Query "SHOW VARIABLES LIKE 'tx_isolation'"
execution time: 0 result set fetch time:
...the WHERE A0.TRAWLID = 1 in the second select makes me guess that this query
should be re-issued for each row found by the first select.
Sounds as if the iterator isn't iterating as ken suggested (although I've not looking
into the code so thats pure speculation)
Dan
-----Original Message-----
From: McCaffrey, John G. [mailto:[EMAIL PROTECTED]
Sent: 30 May 2003 18:07
To: 'OJB Users List'
Subject: RE: Limited collection returned
ok, I am using PB Api.
what does your sql look like
-----Original Message-----
From: Dan Hanley [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 12:02 PM
To: OJB Users List
Subject: RE: Limited collection returned
>so are you having the same problem then? You are only getting one row back,
>instead of many?
Yes. Also I'm using the ODMG api rather than PersistenceBroker directly.
-----Original Message-----
From: Dan Hanley [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 11:47 AM
To: OJB Users List
Subject: RE: Limited collection returned
John
Setting auto-retrieve = "false" works for me using JBoss & mySQL *except*
that then I don't get any dependant ojbects loaded :-(
-----Original Message-----
From: McCaffrey, John G. [mailto:[EMAIL PROTECTED]
Sent: 30 May 2003 17:45
To: 'OJB Users List'
Subject: RE: Limited collection returned
I have been having the same problem. It seems like the initial query
actually gets all the rows, but the RSIterator only gives you one at a time.
In my situation if I have 4 rows that match the query, and I execute the
query once, I only get one row, each additional time I execute the query I
get one more row (all previous rows are also returned in the collection).
This is only happening for a referenced collection, all of my other queries
are working fine. I have no Idea what the deal is, I really hope that
someone can help you.
-John
-----Original Message-----
From: Ken Dempster [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 11:38 AM
To: [EMAIL PROTECTED]
Subject: Limited collection returned
Most everything works except I only get one out of the know four row
objects from the table in my collection. I want to get all the row
objects in the table. My question is why am I only getting only one row
object? I am not sure what I am doing something wrong.
Here is how I have things setup. I have set jboss 3.2 as suggested in
the deployment section of the documentation and have jboss configured it
with data source to connect to a DB2 database. I am requesting a
collection from a client to a SessionBean that delegates to a
PersistenceBroker instance. Basicly I am using the code in
PersistenceBrokerBean as a template for my EJB. I do generate my own
JdbcConnectionDescriptor and pass it to the ConnectionRepository instead
of using the repository.xml to define my JdbcConnectionDescriptor.
My query looks as follows:
Query query = new QueryByCriteria(Runner.class, null);
Collection list =
getPersistenceBrokerRemote().getCollectionByQuery(query);
My ClassDescriptor of the collection of objects I am trying to get is
defined in the repository_user.xml as follows :
<class-descriptor class="test.ojb.Runner" table="KENLIB.RUNNER">
<field-descriptor name="m_id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor name="m_name" column="NAME" jdbc-type="VARCHAR"/>
<collection-descriptor name="m_times" element-class-ref="test.ojb.Time">
<inverse-foreignkey field-ref="m_id"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="test.ojb.Race" table="KENLIB.RACE">
<field-descriptor name="m_id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor name="m_location" column="LOCATION"
jdbc-type="VARCHAR"/>
<field-descriptor name="m_date" column="DATE" jdbc-type="DATE"/>
</class-descriptor>
<class-descriptor class="test.ojb.Time" table="KENLIB.RACE_TIME">
<field-descriptor name="m_id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor name="m_runner_id" column="RUNNER_ID"
jdbc-type="INTEGER"/>
<field-descriptor name="m_race_id" column="RACE_ID"
jdbc-type="INTEGER"/>
<field-descriptor name="m_time" column="TIME" jdbc-type="VARCHAR"/>
<reference-descriptor name="m_race" class-ref="test.ojb.Race">
<foreignkey field-ref="m_race_id"/>
</reference-descriptor>
</class-descriptor>
Ken Dempster
Programmer Analyst
Vision Solutions, Inc.
17911 Von Karman Ave, 5th Floor
Irvine, CA 92614
UNITED STATES
Tel: +1 (949) 253-6500
Fax: +1 (949) 253-6501
Email: [EMAIL PROTECTED]
<http://www.visionsolutions.com/>
Disclaimer - 5/30/2003
The contents of this e-mail (and any attachments) are confidential, may be
privileged, and may contain copyright material of Vision Solutions, Inc. or
third parties. You may only reproduce or distribute the material if you are
expressly authorized by Vision Solutions to do so. If you are not the
intended recipient, any use, disclosure or copying of this e-mail (and any
attachments) is unauthorized. If you have received this e-mail in error,
please immediately delete it and any copies of it from your system and
notify us via e-mail at [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]