Re: only grab 10 records

2003-11-11 Thread Andy Czerwonka
Again, I don't think this will work, because I want 100 records, but I want 
the first 100 where column x = y.

On November 11, 2003 7:07 am, Charles Anthony wrote:
> In which case, I believe you can use the pseudo column "rownum". See
> previous message
> http://article.gmane.org/gmane.comp.jakarta.ojb.user/4038/match=rownum for
> an example of adding the appropriate SQL to a query...
>
> Note, this will tie your application to Oracle.
>
> Cheers,
>
> Charles.
>
> > -Original Message-
> > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > Sent: 11 November 2003 14:11
> > To: OJB Users List
> > Subject: Re: only grab 10 records
> >
> >
> > Oracle 9i
> >
> > On November 11, 2003 6:49 am, Charles Anthony wrote:
> > > Which Database ?
> > >
> > > > -Original Message-
> > > > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > > > Sent: 11 November 2003 13:55
> > > > To: OJB Users List
> > > > Subject: Re: only grab 10 records
> > > >
> > > >
> > > > Then I have a problem.  Is there a way to say 'select next
> > > > record order by
> > > > column' in OJB?  My issue is I have a queue table with
> > > > 200,000 records in it,
> > > > and I'm doing a getIterator() which works fine on a few
> > > > (<1) records, but
> > > > anything more than that it's very slow.  I need to select
> > > > less records,
> > > > process them, select more, process them, select.
> > > >
> > > > Any recommendation on a strategy?
> > > >
> > > > On November 11, 2003 6:41 am, Charles Anthony wrote:
> > > > > Hi,
> > > > >
> > > > > It is not possible to do this in a cross platform way, so
> > > >
> > > > No, currently
> > > >
> > > > > this is not possible in OJB.
> > > > >
> > > > > For an explanation of the reasons why, see
> > > >
> > > > http://article.gmane.org/gmane.comp.jakarta.ojb.user/10065/mat
> > > > ch=paging+per
> > > >
> > > > >f ormance+issues
> > > > >
> > > > > Cheers,
> > > > >
> > > > > Charles.
> > > > >
> > > > > > -Original Message-
> > > > > > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > > > > > Sent: 11 November 2003 13:35
> > > > > > To: 'OJB Users List'
> > > > > > Subject: only grab 10 records
> > > > > >
> > > > > >
> > > > > > Does anyone know if its possible to do something like
> >
> > this in OJB:
> > > > > > select * from table where criteria but only return me a
> > > > > > maximum of 10 records.
> > > > > >
> > > > > > Is this possible?
> >
> > -
> >
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > > ___
> > > > > HPD Software Ltd. - Helping Business Finance Business
> > > > > Email terms and conditions: www.hpdsoftware.com/disclaimer
> >
> > -
> >
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > > --
> > > > Andy Czerwonka
> > > > (403) 547-8892
> >
> > -----
> >
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ___
> > > HPD Software Ltd. - Helping Business Finance Business
> > > Email terms and conditions: www.hpdsoftware.com/disclaimer
> >
> > -
> >
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Andy Czerwonka
> > (403) 547-8892
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ___
> HPD Software Ltd. - Helping Business Finance Business
> Email terms and conditions: www.hpdsoftware.com/disclaimer
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Andy Czerwonka
(403) 547-8892


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: only grab 10 records

2003-11-11 Thread Andy Czerwonka
Well, that really won't work, because the table i'm selecting from has the 
following properties.

- It's a queue.
- Each record has a status (not_processed and error)
- I need to select only (not_processed)
- If, while processing, it get a business error, i set the record to error and 
move to the next.  If no error, I delete after processing.

So, it's a challenge setting the endIndex() because I never know how many 
'error' records are sitting at the top of the queue.

On November 11, 2003 7:30 am, Andy Czerwonka wrote:
> the setStartAtIndex() and setEndAtIndex() seems to work... so I could get
> the first record, get the unique id, and then ask for the next, say 20
> records. I could do that each time in the loop.  Thoughts?  I do need to do
> two selects each time though any way to get it down to 1?
>
> On November 11, 2003 6:49 am, Charles Anthony wrote:
> > Which Database ?
> >
> > > -Original Message-
> > > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > > Sent: 11 November 2003 13:55
> > > To: OJB Users List
> > > Subject: Re: only grab 10 records
> > >
> > >
> > > Then I have a problem.  Is there a way to say 'select next
> > > record order by
> > > column' in OJB?  My issue is I have a queue table with
> > > 200,000 records in it,
> > > and I'm doing a getIterator() which works fine on a few
> > > (<1) records, but
> > > anything more than that it's very slow.  I need to select
> > > less records,
> > > process them, select more, process them, select.
> > >
> > > Any recommendation on a strategy?
> > >
> > > On November 11, 2003 6:41 am, Charles Anthony wrote:
> > > > Hi,
> > > >
> > > > It is not possible to do this in a cross platform way, so
> > >
> > > No, currently
> > >
> > > > this is not possible in OJB.
> > > >
> > > > For an explanation of the reasons why, see
> > >
> > > http://article.gmane.org/gmane.comp.jakarta.ojb.user/10065/mat
> > > ch=paging+per
> > >
> > > >f ormance+issues
> > > >
> > > > Cheers,
> > > >
> > > > Charles.
> > > >
> > > > > -Original Message-
> > > > > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > > > > Sent: 11 November 2003 13:35
> > > > > To: 'OJB Users List'
> > > > > Subject: only grab 10 records
> > > > >
> > > > >
> > > > > Does anyone know if its possible to do something like this in OJB:
> > > > >
> > > > > select * from table where criteria but only return me a
> > > > > maximum of 10 records.
> > > > >
> > > > > Is this possible?
> > >
> > > -
> > >
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > > ___
> > > > HPD Software Ltd. - Helping Business Finance Business
> > > > Email terms and conditions: www.hpdsoftware.com/disclaimer
> > >
> > > -----
> > >
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > --
> > > Andy Czerwonka
> > > (403) 547-8892
> > >
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ___
> > HPD Software Ltd. - Helping Business Finance Business
> > Email terms and conditions: www.hpdsoftware.com/disclaimer
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Andy Czerwonka
(403) 547-8892


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: only grab 10 records

2003-11-11 Thread Andy Czerwonka
the setStartAtIndex() and setEndAtIndex() seems to work... so I could get the 
first record, get the unique id, and then ask for the next, say 20 records.  
I could do that each time in the loop.  Thoughts?  I do need to do two 
selects each time though any way to get it down to 1?

On November 11, 2003 6:49 am, Charles Anthony wrote:
> Which Database ?
>
> > -Original Message-
> > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > Sent: 11 November 2003 13:55
> > To: OJB Users List
> > Subject: Re: only grab 10 records
> >
> >
> > Then I have a problem.  Is there a way to say 'select next
> > record order by
> > column' in OJB?  My issue is I have a queue table with
> > 200,000 records in it,
> > and I'm doing a getIterator() which works fine on a few
> > (<1) records, but
> > anything more than that it's very slow.  I need to select
> > less records,
> > process them, select more, process them, select.
> >
> > Any recommendation on a strategy?
> >
> > On November 11, 2003 6:41 am, Charles Anthony wrote:
> > > Hi,
> > >
> > > It is not possible to do this in a cross platform way, so
> >
> > No, currently
> >
> > > this is not possible in OJB.
> > >
> > > For an explanation of the reasons why, see
> >
> > http://article.gmane.org/gmane.comp.jakarta.ojb.user/10065/mat
> > ch=paging+per
> >
> > >f ormance+issues
> > >
> > > Cheers,
> > >
> > > Charles.
> > >
> > > > -Original Message-
> > > > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > > > Sent: 11 November 2003 13:35
> > > > To: 'OJB Users List'
> > > > Subject: only grab 10 records
> > > >
> > > >
> > > > Does anyone know if its possible to do something like this in OJB:
> > > >
> > > > select * from table where criteria but only return me a
> > > > maximum of 10 records.
> > > >
> > > > Is this possible?
> >
> > -
> >
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ___
> > > HPD Software Ltd. - Helping Business Finance Business
> > > Email terms and conditions: www.hpdsoftware.com/disclaimer
> >
> > -
> >
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Andy Czerwonka
> > (403) 547-8892
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ___
> HPD Software Ltd. - Helping Business Finance Business
> Email terms and conditions: www.hpdsoftware.com/disclaimer
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Andy Czerwonka
(403) 547-8892


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: only grab 10 records

2003-11-11 Thread Andy Czerwonka
Oracle 9i

On November 11, 2003 6:49 am, Charles Anthony wrote:
> Which Database ?
>
> > -Original Message-
> > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > Sent: 11 November 2003 13:55
> > To: OJB Users List
> > Subject: Re: only grab 10 records
> >
> >
> > Then I have a problem.  Is there a way to say 'select next
> > record order by
> > column' in OJB?  My issue is I have a queue table with
> > 200,000 records in it,
> > and I'm doing a getIterator() which works fine on a few
> > (<1) records, but
> > anything more than that it's very slow.  I need to select
> > less records,
> > process them, select more, process them, select.
> >
> > Any recommendation on a strategy?
> >
> > On November 11, 2003 6:41 am, Charles Anthony wrote:
> > > Hi,
> > >
> > > It is not possible to do this in a cross platform way, so
> >
> > No, currently
> >
> > > this is not possible in OJB.
> > >
> > > For an explanation of the reasons why, see
> >
> > http://article.gmane.org/gmane.comp.jakarta.ojb.user/10065/mat
> > ch=paging+per
> >
> > >f ormance+issues
> > >
> > > Cheers,
> > >
> > > Charles.
> > >
> > > > -Original Message-
> > > > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > > > Sent: 11 November 2003 13:35
> > > > To: 'OJB Users List'
> > > > Subject: only grab 10 records
> > > >
> > > >
> > > > Does anyone know if its possible to do something like this in OJB:
> > > >
> > > > select * from table where criteria but only return me a
> > > > maximum of 10 records.
> > > >
> > > > Is this possible?
> >
> > -
> >
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ___
> > > HPD Software Ltd. - Helping Business Finance Business
> > > Email terms and conditions: www.hpdsoftware.com/disclaimer
> >
> > -
> >
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Andy Czerwonka
> > (403) 547-8892
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ___
> HPD Software Ltd. - Helping Business Finance Business
> Email terms and conditions: www.hpdsoftware.com/disclaimer
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Andy Czerwonka
(403) 547-8892


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: only grab 10 records

2003-11-11 Thread Andy Czerwonka
Then I have a problem.  Is there a way to say 'select next record order by 
column' in OJB?  My issue is I have a queue table with 200,000 records in it, 
and I'm doing a getIterator() which works fine on a few (<1) records, but 
anything more than that it's very slow.  I need to select less records, 
process them, select more, process them, select.

Any recommendation on a strategy?

On November 11, 2003 6:41 am, Charles Anthony wrote:
> Hi,
>
> It is not possible to do this in a cross platform way, so No, currently
> this is not possible in OJB.
>
> For an explanation of the reasons why, see
> http://article.gmane.org/gmane.comp.jakarta.ojb.user/10065/match=paging+per
>f ormance+issues
>
> Cheers,
>
> Charles.
>
> > -Original Message-
> > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > Sent: 11 November 2003 13:35
> > To: 'OJB Users List'
> > Subject: only grab 10 records
> >
> >
> > Does anyone know if its possible to do something like this in OJB:
> >
> > select * from table where criteria but only return me a
> > maximum of 10 records.
> >
> > Is this possible?
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ___
> HPD Software Ltd. - Helping Business Finance Business
> Email terms and conditions: www.hpdsoftware.com/disclaimer
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Andy Czerwonka
(403) 547-8892


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



only grab 10 records

2003-11-11 Thread Andy Czerwonka
Does anyone know if its possible to do something like this in OJB:

select * from table where criteria but only return me a maximum of 10 records.

Is this possible?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Allocation of auto incremented primary keys between 2 JVMs

2003-11-03 Thread Andy Czerwonka
Thanks for that correction... I should read before I post... :-(

On Mon, 2003-11-03 at 07:58, Charles Anthony wrote:
> It's not using a database sequence; Mark is testing the
> SequenceManagerHighLowImpl (see other mail messages), which does not use db
> based sequences.
> 
> Moreover, MS Sql does not support native datbase sequences - and, as Mark
> mentions, he is using MS SQL.
> 
> Cheers,
> 
> Charles.
> 
> > -Original Message-
> > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > Sent: 03 November 2003 14:57
> > To: OJB Users List
> > Subject: Re: Allocation of auto incremented primary keys 
> > between 2 JVMs
> > 
> > 
> > OUCH!! If this doesn't work, the it's a MAJOR problem.  Has someone
> > verified in using the PB API in a multi-system environment?  
> > Given that
> > it's using a database sequence, it shouldn't be a problem.  
> > It's got to
> > be a bug.
> > 
> > On Mon, 2003-11-03 at 04:37, Mark Rowell wrote:
> > > Hi
> > > 
> > > Further to my mails last week re auto incremented primary 
> > keys (integers)
> > > across extents I have created a very simple (non Junit 
> > based) test that
> > > starts 2 JVMs that write A number of instances of a 
> > concrete class into a
> > > table using the PerssitenceBroker API.
> > > 
> > > As it is currently setup, 2 JVMs are started that each 
> > attempt to insert
> > > 1000 instances. Everytime I have run it (10+) I get less 
> > than 2000 rows in
> > > the database or I will get a parimary key violation As one 
> > JVM attempts to
> > > store and ID that has already been created by the other JVM.
> > > 
> > > I was under the impression that the default highLow 
> > sequence implementation
> > > would work across JVMs for allocating IDs? 
> > > 
> > > The attached zip file has everything in it. If one of the 
> > OJB developers
> > > could take a look at it I would appreciate it.
> > > 
> > > Here is the stack trace:
> > > 
> > > com.jnetdirect.jsql.v: Violation of PRIMARY KEY constraint
> > > 'PK__Test__72F0F4D3'.  Cannot insert duplicate key in object 'Test'.
> > > at com.jnetdirect.jsql.v.a(Unknown Source)
> > > at com.jnetdirect.jsql.at.a(Unknown Source)
> > > at com.jnetdirect.jsql.af.i(Unknown Source)
> > > at com.jnetdirect.jsql.af.new(Unknown Source)
> > > at com.jnetdirect.jsql.af.int(Unknown Source)
> > > at com.jnetdirect.jsql.ao.executeUpdate(Unknown Source)
> > > at
> > > 
> > org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> > > n Source)
> > > at
> > > 
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> > > urce)
> > > at 
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > > Source
> > > )
> > > at 
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > > Source
> > > )
> > > at
> > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > > Source)
> > > at
> > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > > Source)
> > > at Test.main(Test.java:44)
> > > rethrown as 
> > org.apache.ojb.broker.PersistenceBrokerSQLException: Violation
> > > of PR IMARY KEY constraint 'PK__Test__72F0F4D3'. Cannot 
> > insert duplicate key
> > > in object  'Test'.
> > > at
> > > 
> > org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> > > n Source)
> > > at
> > > 
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> > > urce)
> > > at 
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > > Source
> > > )
> > > at 
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > > Source
> > > )
> > > at
> > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > > Source)
> > > at
> > > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > > Source)
> > > at Test.main(Test.java:44)
> > > Caused by: com.jnetdirect.jsql.v: Violation of P

Re: Allocation of auto incremented primary keys between 2 JVMs

2003-11-03 Thread Andy Czerwonka
OUCH!! If this doesn't work, the it's a MAJOR problem.  Has someone
verified in using the PB API in a multi-system environment?  Given that
it's using a database sequence, it shouldn't be a problem.  It's got to
be a bug.

On Mon, 2003-11-03 at 04:37, Mark Rowell wrote:
> Hi
> 
> Further to my mails last week re auto incremented primary keys (integers)
> across extents I have created a very simple (non Junit based) test that
> starts 2 JVMs that write A number of instances of a concrete class into a
> table using the PerssitenceBroker API.
> 
> As it is currently setup, 2 JVMs are started that each attempt to insert
> 1000 instances. Everytime I have run it (10+) I get less than 2000 rows in
> the database or I will get a parimary key violation As one JVM attempts to
> store and ID that has already been created by the other JVM.
> 
> I was under the impression that the default highLow sequence implementation
> would work across JVMs for allocating IDs? 
> 
> The attached zip file has everything in it. If one of the OJB developers
> could take a look at it I would appreciate it.
> 
> Here is the stack trace:
> 
> com.jnetdirect.jsql.v: Violation of PRIMARY KEY constraint
> 'PK__Test__72F0F4D3'.  Cannot insert duplicate key in object 'Test'.
> at com.jnetdirect.jsql.v.a(Unknown Source)
> at com.jnetdirect.jsql.at.a(Unknown Source)
> at com.jnetdirect.jsql.af.i(Unknown Source)
> at com.jnetdirect.jsql.af.new(Unknown Source)
> at com.jnetdirect.jsql.af.int(Unknown Source)
> at com.jnetdirect.jsql.ao.executeUpdate(Unknown Source)
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> n Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> urce)
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> Source
> )
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> Source
> )
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> Source)
> at Test.main(Test.java:44)
> rethrown as org.apache.ojb.broker.PersistenceBrokerSQLException: Violation
> of PR IMARY KEY constraint 'PK__Test__72F0F4D3'. Cannot insert duplicate key
> in object  'Test'.
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> n Source)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> urce)
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> Source
> )
> at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> Source
> )
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> Source)
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> Source)
> at Test.main(Test.java:44)
> Caused by: com.jnetdirect.jsql.v: Violation of PRIMARY KEY constraint
> 'PK__Test_ _72F0F4D3'. Cannot insert duplicate key in object 'Test'.
> at com.jnetdirect.jsql.v.a(Unknown Source)
> at com.jnetdirect.jsql.at.a(Unknown Source)
> at com.jnetdirect.jsql.af.i(Unknown Source)
> at com.jnetdirect.jsql.af.new(Unknown Source)
> at com.jnetdirect.jsql.af.int(Unknown Source)
> at com.jnetdirect.jsql.ao.executeUpdate(Unknown Source)
> ... 7 more
> 
> 
> I am using RC4. This test has no caching. The RDBMS is SQLServer2000.
> 
> To run the test extract the zip file to some directory. Go into that
> directory and create a lib sub-dir.
> Copy the RC4 jar all the commons jars (and the Jar that contains the logging
> code -- in my case log4j)
> 
> You will need a batch file called JDK14.BAT somewhere on you path that sets
> the path to point to the JDK.
> The batch file run.bat starts 2 JVMs that write the info into the database.
> 
> Regards
> 
> Mark Rowell
> 
> ---
> Mark Rowell
> Structured Credit Europe
> CreditTrade Limited
> 180 Fleet Street
> London EC4A 2HG
> 
> Tel +44 (0)20 7400 5078
> Fax +44 (0)20 7400 5099
> 
> http://www.credittrade.com
> 
>  
> 
> 
> 
> CreditTrade Limited is regulated by the FSA. (c) CreditTrade 2002. All rights 
> reserved. The information and data contained in this email is provided for the 
> information purposes of the addressee only and should not be reproduced and/or 
> distributed to any other person. It is provided without any warranty whatsoever and 
> unless stated otherwise consists purely of indicative market prices and other 
> information.
> 
> Any opinion or comments expressed or assumption made in association with the data or 
> information provided in this email is a reflection of CreditTrades judgement at the 
> time of compiling the data and is subject to change. CreditTrade hereby makes no 
> representation and accepts no responsibility or liability as to the comp

help with auto-update and/or auto-delete

2003-10-30 Thread Andy Czerwonka
If I have a 1..n relationship in my object, eg:

Car--->Parts

and I do something like:

Car car = new Car();
car.getParts().add(new Engine());
broker.store(car);

I expect one record in my Car table and one in my Parts table.  Perfect
- that's what I have.

Now, I do a:

car.setParts(new ArrayList());
store(car);

I expect that this removed all records in my Parts table pointing back
to the 'car' instance.

Can't get that to work.  Anyone know why

-andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: problem/question with getIteratorByQuery()

2003-10-30 Thread Andy Czerwonka
You need it for the lazy instantiation via the iterator

On Thu, 2003-10-30 at 09:06, [EMAIL PROTECTED] wrote:
> > get rid of the transaction... why are you doing a 
> > broker.close() before
> > you starting iterating?  Not sure what you are trying to do.
> 
> I'm doing a broker.close() to be sure to put the broker instance back to the 
> connection pool.
> 
> Sylvain
> 
> -
> 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]



Re: problem/question with getIteratorByQuery()

2003-10-30 Thread Andy Czerwonka
get rid of the transaction... why are you doing a broker.close() before
you starting iterating?  Not sure what you are trying to do.

getIteratorByQuery() is a lazy version of getCollectionByQuery().  If
does a count when creating the iterator and a select on each
iter.next().

your code should look more like this:

broker = PersistenceBrokerFactory.defaultPersistenceBroker();
Query query = 'whatever your query is';
Iterator iter = broker.getIteratorByQuery(query);
while (iter.hasNext()) {
Person person = (Person) iter.next()
...
}
broker.close();

On Thu, 2003-10-30 at 08:00, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I have a question/problem about the function getIteratorByQuery():
> 
> Here is a code:
> 
> code
> Iterator iter = null;
> try {
>   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
>   broker.beginTransaction();
>   iter = broker.getIteratorByQuery(query);
>   broker.commitTransaction();
> } catch (PersistenceBrokerException t) {
>   broker.abortTransaction();
>   t.printStackTrace();
> } finally {
>   broker.close();
> }
> 
> while (iter.hasNext()) {
>   Person person = (Person) iter.next();
>   
>   some code
>   
> }
> code
> 
> I have noticed that the Iterator object called iter isn't available after the broker 
> is closed (no iteration in the "while" statement).
> Why?
> 
> My idea is to use a broker only when I need one and close it just after the use.
> What is the solution?
> But could I write the code as below?
> 
> code
> try {
>   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
>   broker.beginTransaction();
>   Iterator iter = broker.getIteratorByQuery(query);
>   while (iter.hasNext()) {
> Person person = (Person) iter.next();
> 
> some code
> 
>   }
>   broker.commitTransaction();
> } catch (PersistenceBrokerException t) {
>   broker.abortTransaction();
>   t.printStackTrace();
> } finally {
>   broker.close();
> }
> code
> 
> Thanks for any help
> Sylvain
> 
> -
> 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]



Optimistic Locking using the PersistenceBroker API

2003-10-28 Thread Andy Czerwonka
Has anyone implemented an optimistic-locking strategy (I actually may
need a Pessimistic strategy - not sure yet)  using the PersistenceBroker
API?  Can you point me in the right direction?

-andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Oracle Auto-Increment

2003-10-28 Thread Andy Czerwonka
Turn batch-mode off and then try your test.  If it works, you'll need
the fix for this.  You can either patch ti yourself, or take the latest
CVS image.

On Tue, 2003-10-28 at 10:08, Ronald Paloschi wrote:
> Hi Danilo,
> 
> I will try to explain a little better (forgive the errors... IÂm
> brazillian... hehe :-)
> First: IÂm not a DB expert.
> The DBA have done the all the sequences. They work perfect outside OJB.
> Well, considering that I have a Oracle Database Setup and OK, with sequences
> and all... right?
> My doubt is on OJB, when I try to use the store() method I get an
> java.lang.ClassCastException.
> Can you send the pieces of the repository_user and repository_database to
> me?
> I think my error is there, because the database is already in use at a long
> time, without problems in a Client/Server application.
> You can do that?
> 
> Thanks for the support!!!
> []Âs
> 
> Ronald
> 
> 
> - Original Message -
> From: "Danilo Tommasina" <[EMAIL PROTECTED]>
> To: "OJB Users List" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 28, 2003 12:58 PM
> Subject: Re: Oracle Auto-Increment
> 
> 
> > Hi Roland,
> >
> > using sequences works very well
> >
> > cheers
> > danilo
> >
> >
> > -
> > 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]



RE: Auto incremented primary key and extents

2003-10-28 Thread Andy Czerwonka
autogenerated keys using the DefaultSequenceManagerImpl are not assigned
on broker.store(obj) using batch-mode=true.  I'm wondering if the hash
gets messed up (ordering) on the batch.

On Mon, 2003-10-27 at 05:25, Mark Rowell wrote:
> Armin
> 
> No the only thing I changed was OJB.properties.
> 
> One thing is that this problem happened during a run of my application where
> some batch mode=true stuff
> Was used. Would this have an impact?
> 
> Is the sequence max id still stored in OJB_HL_SEQ?
> 
> Regards
> 
> Mark
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED] 
> Sent: 27 October 2003 12:21
> To: OJB Users List
> Subject: Re: Auto incremented primary key and extents
> 
> 
> Hi Mark,
> 
>  > But as a follow on the extents are more than one level deep -- would  >
> this  > have an impact? No should not. Have a look in
> SequenceManagerHelper#getMaxForExtent
> 
> 
>  > unique Over all tables in the extent? Have I misconfigured OJB on 
> upgrading
>  > to RC4?
> Did you change metadata on upgrading? Add new extents,
> change order of declaration?
> 
> regards,
> Armin
> 
> 
> Mark Rowell wrote:
> 
> > Sorry
> > 
> > But as a follow on the extents are more than one level deep -- would 
> > this have an impact?
> > 
> > Regards,
> > 
> > Mark Rowell
> > 
> > -Original Message-
> > From: Mark Rowell [mailto:[EMAIL PROTECTED]
> > Sent: 27 October 2003 11:30
> > To: '[EMAIL PROTECTED]'
> > Subject: Auto incremented primary key and extents
> > 
> > 
> > Hi
> > 
> > I have an extent over 8 classes (and 8 corresponding tables) and I 
> > have noticed that primary keys are now not unique over all tables -- 
> > e.g. when I store and instances of 2 different classes In different 
> > "leaves" of the extent I get the same ID in both tables. In RC1 I the 
> > autogenerated IDs were unique Over all tables in the extent? Have I 
> > misconfigured OJB on upgrading to RC4?
> > 
> > Regards,
> > 
> > Mark Rowell
> > 
> > ---
> > Mark Rowell
> > Structured Credit Europe
> > CreditTrade Limited
> > 180 Fleet Street
> > London EC4A 2HG
> > 
> > Tel +44 (0)20 7400 5078
> > Fax +44 (0)20 7400 5099
> > 
> > http://www.credittrade.com
> > 
> >  
> > 
> > CreditTrade Limited is regulated by the FSA. (c) CreditTrade 2002. All 
> > rights reserved. The information and data contained in this email is 
> > provided for the information purposes of the addressee only and should 
> > not be reproduced and/or distributed to any other person. It is 
> > provided without any warranty whatsoever and unless stated otherwise 
> > consists purely of indicative market prices and other information.
> > 
> > Any opinion or comments expressed or assumption made in association 
> > with the data or information provided in this email is a reflection of 
> > CreditTrades judgement at the time of compiling the data and is 
> > subject to change. CreditTrade hereby makes no representation and 
> > accepts no responsibility or liability as to the completeness or 
> > accuracy of this email.
> > 
> > The content of this email is not intended as an offer or solicitation 
> > for, or recommendation of, the purchase or sale of any financial 
> > instrument, or as an official confirmation of any transaction, and 
> > should not be construed as investment advice.
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > CreditTrade Limited is regulated by the FSA. (c) CreditTrade 2002. All 
> > rights reserved. The information and data contained in this email is 
> > provided for the information purposes of the addressee only and should 
> > not be reproduced and/or distributed to any other person. It is 
> > provided without any warranty whatsoever and unless stated otherwise 
> > consists purely of indicative market prices and other information.
> > 
> > Any opinion or comments expressed or assumption made in association 
> > with the data or information provided in this email is a reflection of 
> > CreditTrades judgement at the time of compiling the data and is 
> > subject to change. CreditTrade hereby makes no representation and 
> > accepts no responsibility or liability as to the completeness or 
> > accuracy of this email.
> > 
> > The content of this email is not intended as an offer or solicitation 
> > for, or recommendation of, the purchase or sale of any financial 
> > instrument, or as an official confirmation of any transaction, and 
> > should not be construed as investment advice.
> > 
> > -
> > 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 

Re: OutOfMemoryError using commons-lang 2.0 and OJB 1.0rc4

2003-10-25 Thread Andy Czerwonka
How many records are you bringing back?

On Fri, 2003-10-24 at 18:15, Michel Marti wrote:
> Hello, Since I upgraded commons-lang to version 2.0 (due to the
> "display" taglib requiring it), OJB (1.0rc4) always throws a
> OutOfMemoryError when calling getCollectionByQuery() on the
> defaultPersistenceBroker:
> 
> org.apache.ojb.broker.PersistenceBrokerException: java.lang.OutOfMemoryError
>   at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
>   at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.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)
> 
> Is OJB supposed to work with commons-lang 2.0? If not, are there any plans
> to support it?
> 
> Thanks,
> - Michel
> 
> 
> 
> 
> -
> 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]



someone please tell me...

2003-10-24 Thread Andy Czerwonka
How could batch-mode=true be slower than batch-mode=false???

OJB rc4 + small batch-mode hack (Mark Rowell)
Oracle9i
ojdbc14.jar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: mapping problem or something VERY wierd...

2003-10-23 Thread Andy Czerwonka
The mapping needed the obvious primary key

On Thu, 2003-10-23 at 17:15, Andy Czerwonka wrote:
> In looking at the SQL, and update is done when I do the store.. hey I
> think the PK is NOT unique... yup - it's not unique... that's gotta be
> the problem...
> 
> On Thu, 2003-10-23 at 16:07, Andy Czerwonka wrote:
> > I've got a simple 1..n association and I'm doing something like
> > this...(pardon the syntax... just trying to make a point)
> > 
> > Parent parent = new Parent()
> > Child c1 = new Child(parent);
> > Child c2 = new Child(parent);
> > parent.getChildren.add(c1);
> > parent.getChildren.add(c2);
> > broker.store(parent);
> > broker.commit();
> > 
> > database looks good... 1 record in the parent table and 2 in the child
> > table with fk point back to the parent record...looks like:
> > 
> > parent
> >   +--c1
> >   +--c2
> > 
> > 
> > and then all hell breaks loose...
> > 
> > Parent found = broker.query(parent);
> > 
> > so far, so good, looks like it came from the cache... all references
> > look good, still have:
> > 
> > parent
> >   +--c1
> >   +--c2
> > 
> > checked the database.. all good..
> > 
> > parent.setAnotherAttribute("changed state of parent");
> > broker.store(parent);
> > 
> > still all good.. checked the database...
> > 
> > and NOW
> > 
> > broker.commit();
> > 
> > look in the database, and I see:
> > 
> > parent
> >   +--c2
> >   +--c2
> > 
> > HHHEEELLLPPP
> > No Idea.
> > 
> > -andy
> > 
> > 
> > -
> > 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]



Re: mapping problem or something VERY wierd...

2003-10-23 Thread Andy Czerwonka
In looking at the SQL, and update is done when I do the store.. hey I
think the PK is NOT unique... yup - it's not unique... that's gotta be
the problem...

On Thu, 2003-10-23 at 16:07, Andy Czerwonka wrote:
> I've got a simple 1..n association and I'm doing something like
> this...(pardon the syntax... just trying to make a point)
> 
> Parent parent = new Parent()
> Child c1 = new Child(parent);
> Child c2 = new Child(parent);
> parent.getChildren.add(c1);
> parent.getChildren.add(c2);
> broker.store(parent);
> broker.commit();
> 
> database looks good... 1 record in the parent table and 2 in the child
> table with fk point back to the parent record...looks like:
> 
> parent
>   +--c1
>   +--c2
> 
> 
> and then all hell breaks loose...
> 
> Parent found = broker.query(parent);
> 
> so far, so good, looks like it came from the cache... all references
> look good, still have:
> 
> parent
>   +--c1
>   +--c2
> 
> checked the database.. all good..
> 
> parent.setAnotherAttribute("changed state of parent");
> broker.store(parent);
> 
> still all good.. checked the database...
> 
> and NOW
> 
> broker.commit();
> 
> look in the database, and I see:
> 
> parent
>   +--c2
>   +--c2
> 
> HHHEEELLLPPP
> No Idea.
> 
> -andy
> 
> 
> -
> 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]



mapping problem or something VERY wierd...

2003-10-23 Thread Andy Czerwonka
I've got a simple 1..n association and I'm doing something like
this...(pardon the syntax... just trying to make a point)

Parent parent = new Parent()
Child c1 = new Child(parent);
Child c2 = new Child(parent);
parent.getChildren.add(c1);
parent.getChildren.add(c2);
broker.store(parent);
broker.commit();

database looks good... 1 record in the parent table and 2 in the child
table with fk point back to the parent record...looks like:

parent
  +--c1
  +--c2


and then all hell breaks loose...

Parent found = broker.query(parent);

so far, so good, looks like it came from the cache... all references
look good, still have:

parent
  +--c1
  +--c2

checked the database.. all good..

parent.setAnotherAttribute("changed state of parent");
broker.store(parent);

still all good.. checked the database...

and NOW

broker.commit();

look in the database, and I see:

parent
  +--c2
  +--c2

HHHEEELLLPPP
No Idea.

-andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: problems with batch-mode=true

2003-10-23 Thread Andy Czerwonka
Okay, first of all, thanks for the fix Mark.  Now that I have it
working, can anyone explain why my performance just dropped about 20%
after turning on batch mode?  I reason I wanted a fix is because i was
trying to get some better performance, not worsen then performance! 
HELP!!!



On Thu, 2003-10-23 at 03:31, Mark Rowell wrote:
> Hi
> 
> 
> 
> Sorry for the flurry of emails but changing == to .equals in the doExecute
> method of
> PreparedStatementInvocationHandler fixes this problem.
> 
> Change line 214 in RC4 from
> 
>   if ( ((Method)_methods.get(i)) ==
> ADD_BATCH )
>   {
>   /**
>* we invoke on the platform
> and pass the stmt as an arg.
>*/
>   ((Method)
> _methods.get(i)).invoke(m_platform, new Object[] {stmt});
>   }
>   else
>   {
>   ((Method)
> _methods.get(i)).invoke(stmt, (Object[]) _params.get(i));
>   }
> 
> 
>   if ( ADD_BATCH.equals(
> _methods.get(i)) )
>   {
>   /**
>* we invoke on the platform
> and pass the stmt as an arg.
>*/
>   ((Method)
> _methods.get(i)).invoke(m_platform, new Object[] {stmt});
>   }
>   else
>   {
>   ((Method)
> _methods.get(i)).invoke(stmt, (Object[]) _params.get(i));
>   }
> 
> BTW the cast in the equality is unecessary.
> 
> Regards
> 
> Mark Rowell
> 
> -Original Message-
> From: Mark Rowell [mailto:[EMAIL PROTECTED] 
> Sent: 23 October 2003 10:27
> To: 'OJB Users List'
> Subject: RE: problems with batch-mode=true
> 
> 
> Hi
> 
> As a follow on I checked the source for java.lang.reflect.Method and it has
> an implementation Of equals which could possibly indicate tat the equality
> operator (==) does not hold for methods.
> 
> Mark
> 
> -Original Message-
> From: Mark Rowell [mailto:[EMAIL PROTECTED] 
> Sent: 23 October 2003 10:23
> To: 'OJB Users List'
> Subject: RE: problems with batch-mode=true
> 
> 
> Hi
> 
> Regarding this issue it looks like (at least as far as RC4 is concerned)
> that in the doExecute method of PreparedStatementInvocationHandler.java the
> following line (223) gets invoked
> 
> ((Method) _methods.get(i)).invoke(stmt, (Object[]) _params.get(i));
> 
> In my case when using batched mode, and JSQLConnect on MSSqlServer I get a
> similar error to Bonnie (java.lang.IllegalArgumentException: object is not
> an instance of declaring class)
> 
> The methods returned by _methods.get(i) is
> 
> public void
> org.apache.ojb.broker.platforms.PlatformDefaultImpl.addBatch(java.sql.Prepar
> edStatement)
> 
> And we are trying to executed it on the statement rather than passing the
> platform instance. I think the problem Is in the if statement in that it
> does an == rather than a .equals() call to determine whether we want to call
> the addBatch method. Now, I do not know whether within a single JVM that the
> following Returns true
> 
> Method method1 = obj.getClass().getMethod("methodName", ); Method
> method2 = obj.getClass().getMethod("methodName", ); method1 ==
> method2; // is this gurantee dto be true like it is for instances of Class
> e.g.
> 
> Obj.getClass() == Obj.getClass() is guranteed to be true?
> 
> Regards,
> 
> Mark Rowell
> 
> 
> -Original Message-
> From: Bonnie MacKellar [mailto:[EMAIL PROTECTED] 
> Sent: 22 October 2003 14:02
> To: OJB Users List
> Subject: RE: problems with batch-mode=true
> 
> 
> Hi, 
> Here is the code that I tested. You can 
> see that setBatchMode is called before I start 
> the tx. 
> try 
> { 
> broker.serviceConnectionManager().setBatchMode(true); 
> broker.beginTransaction(); 
> for (int i = 0; i < 100; i++) 
> { 
> CustomerInterface customer = new Customer(); 
> customer.setCustomerNumber("100" + i); 
> customer.setFirstName("Big"); 
> customer.setLastName("Customer"); 
> customer.setCustomerName("BadCorporation"); 
> customer.setDeleteTag(Boolean.FALSE); 
> broker.store(customer); 
> } 
>  //   conMan.executeBatch(); 
> broker.commitTransaction(); 
> } 
> catch(Exception e) 
> 

Re: RE : problems with batch-mode=true

2003-10-23 Thread Andy Czerwonka
See Mark Rowell's posts to see the bug and fix.

Thanks to Mark!!

Cheers!!

On Thu, 2003-10-23 at 06:53, Emmanuel Dupont wrote:
> Please to tell you yhat we are three !
> 
> :)
> 
> -Message d'origine-
> De : Bonnie MacKellar [mailto:[EMAIL PROTECTED] 
> Envoyé : jeudi 23 octobre 2003 14:33
> À : 'Mark Rowell '; ''OJB Users List' '
> Objet : RE: problems with batch-mode=true
> 
>  I have the same problem! I thought I was
> the only one.
> 
> Bonnie MacKellar
> 
> -Original Message-
> From: Mark Rowell
> To: 'OJB Users List'
> Sent: 10/23/03 7:59 AM
> Subject: RE: problems with batch-mode=true
> 
> Armin
> 
> No because I am not allowed to use CVS where I work..hence...
> 
> Oh well!
> 
> Thanks
> 
> Mark
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED] 
> Sent: 23 October 2003 11:37
> To: OJB Users List
> Subject: Re: problems with batch-mode=true
> 
> 
> Hi Mark,
> 
> did you tried latest version from CVS?
> I think your mentioned bug was fixed in
> CVS.
> 
> See
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/
> util
> /batch/PreparedStatementInvocationHandler.java
> 
> regards,
> Armin
> 
> Mark Rowell wrote:
> > Hi
> > 
> > As a follow on I checked the source for java.lang.reflect.Method and 
> > it has an implementation Of equals which could possibly indicate tat 
> > the equality operator (==) does not hold for methods.
> > 
> > Mark
> > 
> > -Original Message-
> > From: Mark Rowell [mailto:[EMAIL PROTECTED]
> > Sent: 23 October 2003 10:23
> > To: 'OJB Users List'
> > Subject: RE: problems with batch-mode=true
> > 
> > 
> > Hi
> > 
> > Regarding this issue it looks like (at least as far as RC4 is 
> > concerned) that in the doExecute method of 
> > PreparedStatementInvocationHandler.java the following line (223) gets 
> > invoked
> > 
> > ((Method) _methods.get(i)).invoke(stmt, (Object[]) _params.get(i));
> > 
> > In my case when using batched mode, and JSQLConnect on MSSqlServer I 
> > get a similar error to Bonnie (java.lang.IllegalArgumentException: 
> > object is not an instance of declaring class)
> > 
> > The methods returned by _methods.get(i) is
> > 
> > public void 
> > org.apache.ojb.broker.platforms.PlatformDefaultImpl.addBatch(java.sql.
> > Prepar
> > edStatement)
> > 
> > And we are trying to executed it on the statement rather than passing 
> > the platform instance. I think the problem Is in the if statement in 
> > that it does an == rather than a .equals() call to determine whether 
> > we want to call the addBatch method. Now, I do not know whether within
> 
> > a single JVM that the following Returns true
> > 
> > Method method1 = obj.getClass().getMethod("methodName", ); 
> > Method method2 = obj.getClass().getMethod("methodName", ); 
> > method1 == method2; // is this gurantee dto be true like it is for 
> > instances of Class e.g.
> > 
> > Obj.getClass() == Obj.getClass() is guranteed to be true?
> > 
> > Regards,
> > 
> > Mark Rowell
> > 
> > 
> > -Original Message-
> > From: Bonnie MacKellar [mailto:[EMAIL PROTECTED]
> > Sent: 22 October 2003 14:02
> > To: OJB Users List
> > Subject: RE: problems with batch-mode=true
> > 
> > 
> > Hi,
> > Here is the code that I tested. You can 
> > see that setBatchMode is called before I start 
> > the tx. 
> > try 
> > { 
> > broker.serviceConnectionManager().setBatchMode(true); 
> > broker.beginTransaction(); 
> > for (int i = 0; i < 100; i++) 
> > { 
> > CustomerInterface customer = new Customer(); 
> > customer.setCustomerNumber("100" + i); 
> > customer.setFirstName("Big"); 
> > customer.setLastName("Customer"); 
> > customer.setCustomerName("BadCorporation"); 
> > customer.setDeleteTag(Boolean.FALSE); 
> > broker.store(customer); 
> > } 
> >  //   conMan.executeBatch(); 
> > broker.commitTransaction(); 
> > } 
> > catch(Exception e) 
> > { 
> > e.printStackTrace(); 
> > logger.error(e.getMessage()); 
> > broker.abortTransaction(); 
> > } 
> > finally 
> > {  
> > broker.close(); 
> > } 
> >   
> > This chunk of code, exectued with batch-mode="true"
> > in repository_database.xml, results in the following 
> > two exceptions : 
> > java.lang.IllegalArgumentException: object is not an instance of
> declaring
> > class 
> > at java.lang.reflect.Method.invoke(Native Method) 
> > at
> >
> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doEx
> ecut
> > e(Unknown Source) 
> > at
> >
> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invo
> ke(U
> > nknown Source) 
> > at $Proxy0.doExecute(Unknown Source) 
> > at
> > org.apache.ojb.broker.util.batch.Bat

RE: refresh=true OR refresh=false

2003-10-23 Thread Andy Czerwonka
Thank you.  I supposed, from a performance perspective, if the
relationship is ternary, I should have a convenience method that does
the setA(A) and A.getBs().add(B) and then I can turn it off to stop the
SQL from being executed.  Correct?

On Thu, 2003-10-23 at 00:32, Charles Anthony wrote:
> Hi,
> It is indeed to do with caching.
> 
> Let us have a one-to-many relation  : A has many Bs.
> We modify A (but leave it's related B's alone), and A remains in the cache.
> We then create a B, and associate it with A (e.g. b.setA(A) ) - but we
> *don't* add it to A's collection of B's.
> If we then retrieve A from the Cache as a result of another query.
> If refresh = false, then the collection of B's will *not* contain our new B.
> If refresh = true, the the collecton will contain the new B - in other words
> the collection is refreshed when the object is retrieved from the cache.
> 
> The use of CollectionProxies prevents the actual materialization of all
> object in colleciton until needed i.e. the full query is not actually
> executed until the contents of the collection is accessed.
> 
> Cheers,
> 
> Charles.
> 
> > -Original Message-
> > From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> > Sent: 22 October 2003 23:53
> > To: OJB Users List
> > Subject: refresh=true OR refresh=false
> > 
> > 
> > In looking at the documentation, there isn't really anything 
> > descriptive
> > regarding this attribute on collections/references.  I'd like 
> > to turn it
> > off, but I'm afraid.  Should I be?  Can someone help me 
> > understand this
> > a little better so that I know what's going on?  Is this a 
> > cache thing?
> > 
> > -andy
> > 
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> This email and any attachments are strictly confidential and are intended
> solely for the addressee. If you are not the intended recipient you must
> not disclose, forward, copy or take any action in reliance on this message
> or its attachments. If you have received this email in error please notify
> the sender as soon as possible and delete it from your computer systems.
> Any views or opinions presented are solely those of the author and do not
> necessarily reflect those of HPD Software Limited or its affiliates.
> 
>  At present the integrity of email across the internet cannot be guaranteed
> and messages sent via this medium are potentially at risk.  All liability
> is excluded to the extent permitted by law for any claims arising as a re-
> sult of the use of this medium to transmit information by or to 
> HPD Software Limited or its affiliates.
> 
> 
> 
> -
> 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]



IllegalClassCastException when batch-mode=true

2003-10-22 Thread Andy Czerwonka
All my tests run fine with batch-mode off.  As soon as I turn it on,
BOOM... I get a IllegalClassCastException.

I'm using Orcle 9.2 and ojdbc4.jar

-andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



refresh=true OR refresh=false

2003-10-22 Thread Andy Czerwonka
In looking at the documentation, there isn't really anything descriptive
regarding this attribute on collections/references.  I'd like to turn it
off, but I'm afraid.  Should I be?  Can someone help me understand this
a little better so that I know what's going on?  Is this a cache thing?

-andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Can't search by reference-descriptor object - Why?????

2003-10-10 Thread Andy Czerwonka
How come I can't do a query and use a reference-descriptor.  It should
work.  Here's my code.

Criteria crit = new Criteria();
crit.addEqualTo("identifierText", value);
crit.addEqualTo("issuingAuthority", issuingAuthority);
Query query = QueryFactory.newQuery(PersonIdentifier.class, crit, true);
return (PersonIdentifier) broker.getObjectByQuery(query);

That doesn't work becuase issuingAuthority, is of type CodeValue, which
is a reference-descriptor to to an Integer.  It should work, because via
the mapping, OJB know both what issuingAuthority points to and it also
knows the id (pk) of CodeValue. To make it work, I have to do:

...
crit.addEqualTo("issuingAuthorityCode", issuingAuthority.getCode());
...

Sure, it works, but it's primitive.  The issuingAuthorityCode has
anonymous access, in which case my code doesn't even know about it. 
Now, I have to reference it in the code.

Does anyone have an opinion that they'd like to share.  Am I making a
mountain out of a molehill?


-- 
andy

-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Can't search by reference-descriptor object - Why?????

2003-10-10 Thread Andy Czerwonka
How come I can't do a query and use a reference-descriptor.  It should
work.  Here's my code.

Criteria crit = new Criteria();
crit.addEqualTo("identifierText", value);
crit.addEqualTo("issuingAuthority", issuingAuthority);
Query query = QueryFactory.newQuery(PersonIdentifier.class, crit, true);
return (PersonIdentifier) broker.getObjectByQuery(query);

That doesn't work becuase issuingAuthority, is of type CodeValue, which
is a reference-descriptor to to an Integer.  It should work, because via
the mapping, OJB know both what issuingAuthority points to and it also
knows the id (pk) of CodeValue. To make it work, I have to do:

...
crit.addEqualTo("issuingAuthorityCode", issuingAuthority.getCode());
...

Sure, it works, but it's primitive.  The issuingAuthorityCode has
anonymous access, in which case my code doesn't even know about it. 
Now, I have to reference it in the code.

Does anyone have an opinion that they'd like to share.  Am I making a
mountain out of a molehill?


-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Objects in referenced collection don't auto delete

2003-09-27 Thread Andy Czerwonka
Something to do with the Cache I think.  BTW - broker.deleteByQuery
doesn't work but if I get a collection via the same query and delete
each object - works fine.

On Sat, 2003-09-27 at 09:12, Andy Czerwonka wrote:
> Anyone see this before?
> 
> What I'd like is when I remove an object from a collection that is
> referenced by another object, and then store() the object, I'd like the
> collection to reflect that.  It doesn't seen to work.  The add worked
> fine.
> 
> Failing Test
> 
> Person found = PersonHome.getInstance().find(person); // okay, got it.
> 
> PersonIdentifier identifier = (PersonIdentifier)
> found.getPersonIdentifiers().toArray()[0]; // got the first object in
> the collection
> 
> found.getPersonIdentifiers().remove(identifier); // remove it
> 
> PersistenceManager.storeInTransaction(person);  // store the 'updated'
> object
> 
> PersistenceManager.clearCache();
> 
> 
> found = PersonHome.getInstance().find(person);
> assertTrue("Person has 0 PersonIdentifiers",
> found.getPersonIdentifiers().size() == 0); // STILL THERE!!
-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Objects in referenced collection don't auto delete

2003-09-27 Thread Andy Czerwonka
Anyone see this before?

What I'd like is when I remove an object from a collection that is
referenced by another object, and then store() the object, I'd like the
collection to reflect that.  It doesn't seen to work.  The add worked
fine.

Failing Test

Person found = PersonHome.getInstance().find(person); // okay, got it.

PersonIdentifier identifier = (PersonIdentifier)
found.getPersonIdentifiers().toArray()[0]; // got the first object in
the collection

found.getPersonIdentifiers().remove(identifier); // remove it

PersistenceManager.storeInTransaction(person);  // store the 'updated'
object

PersistenceManager.clearCache();


found = PersonHome.getInstance().find(person);
assertTrue("Person has 0 PersonIdentifiers",
found.getPersonIdentifiers().size() == 0); // STILL THERE!!


-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



FAQ for XDoclet

2003-09-25 Thread Andy Czerwonka
Is there an FAQ out there that'll show me how to use XDoclet to generate
my .xml for my mappings?  That'd be great.


-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PLEASE HELP!!!! No recursion??????

2003-09-23 Thread Andy Czerwonka
Need the auto-update to be "true" - off by default I guess

thanks for all who were beginning to try and help me

On Tue, 2003-09-23 at 08:08, Andy Czerwonka wrote:
> So that you can see a pattern, I've attached the database results after
> I run the test 3 times.
> 
> 
> 
> On Tue, 2003-09-23 at 07:57, Andy Czerwonka wrote:
> > One more thing...
> > 
> > One the one record in the database it does produce, the UNQ_ID = 1 and
> > the NXT_UNQ_ID = 2, just as expected, But, there's NO SECOND RECORD!
> > Very weird.  Looks like the SequenceImpl correctly assigns the UNQ_ID
> > and understand the foreign key relationship just fine, but can't persist
> > the recursive behaviour.
> > 
> > On Tue, 2003-09-23 at 07:50, Andy Czerwonka wrote:
> > > BTW - on a subsequent test that does the query again, it fails.  I does
> > > only see the 1 record and doesn't build my linked list.  Looks like
> > > there is some caching.  Anyone know what I'm doing wrong here or do we
> > > just have a bug?
> > > 
> > > On Tue, 2003-09-23 at 07:42, Andy Czerwonka wrote:
> > > > I'm having a problem with a very simple mapping.  I've went through all
> > > > the docs and examples, and afaik, the mappings are right. I'll provide
> > > > some context.
> > > > 
> > > > Database
> > > > 
> > > > create table LBRTRY_Q (UNQ_ID number(12) not null, MSG_TXT clob not /
> > > > null, STTS_CODE number(8) not null, NXT_UNQ_ID number(12));
> > > > 
> > > > alter table LBRTRY_Q add constraint LBRTRY_Q_PK primary key (UNQ_ID) /
> > > > using index;
> > > > 
> > > > create sequence LBRTRY_Q_SEQ maxvalue  cycle;
> > > > 
> > > > 
> > > > Database And User Repositories
> > > > ==
> > > >  > > > 
> > > > jcd-alias="default"
> > > > platform="Oracle9i"
> > > > jdbc-level="2.0"
> > > > driver="oracle.jdbc.driver.OracleDriver"
> > > > protocol="jdbc"
> > > > subprotocol="oracle:thin"
> > > > dbalias="@locahost:1521:iadb"
> > > > username="user1"
> > > > password="user1"
> > > > eager-release="false"
> > > > batch-mode="false"
> > > > useAutoCommit="0"
> > > > ignoreAutoCommitExceptions="false"
> > > > default-connection="true">
> > > > 
> > > >  > > > className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"/>
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  > > >   class="com.clrstream.chr.mm.persistence.HL7Message"
> > > >   proxy="dynamic"
> > > >   table="LBRTRY_Q">
> > > > 
> > > >> > >  name="id"
> > > >  column="UNQ_ID"
> > > >  jdbc-type="INTEGER"
> > > >  primarykey="true"
> > > >  autoincrement="true"
> > > >  sequence-name="LBRTRY_Q_SEQ"/>
> > > > 
> > > >> > >  name="value"
> > > >  column="MSG_TXT"
> > > >  jdbc-type="VARCHAR"/>
> > > > 
> > > >> > >  name="status"
> > > >  column="STTS_CODE"
> > > >  jdbc-type="INTEGER"/>
> > > > 
> > > >> > >  name="nextId"
> > > >  column="NXT_UNQ_ID"
> > > >  jdbc-type="INTEGER"
> > > >  access="anonymous"/>
> > > > 
> > > >> > >  name="next"
> > > >  class-ref="com.clrstream.chr.mm.persistence.HL7Message">
> > > > 
> > > >   
> > > > 
> > > >
> > > > 
> > > > 
> > > > Important Bits Of The Persistent Java POJO
> > > >

Re: PLEASE HELP!!!! No recursion??????

2003-09-23 Thread Andy Czerwonka
So that you can see a pattern, I've attached the database results after
I run the test 3 times.



On Tue, 2003-09-23 at 07:57, Andy Czerwonka wrote:
> One more thing...
> 
> One the one record in the database it does produce, the UNQ_ID = 1 and
> the NXT_UNQ_ID = 2, just as expected, But, there's NO SECOND RECORD!
> Very weird.  Looks like the SequenceImpl correctly assigns the UNQ_ID
> and understand the foreign key relationship just fine, but can't persist
> the recursive behaviour.
> 
> On Tue, 2003-09-23 at 07:50, Andy Czerwonka wrote:
> > BTW - on a subsequent test that does the query again, it fails.  I does
> > only see the 1 record and doesn't build my linked list.  Looks like
> > there is some caching.  Anyone know what I'm doing wrong here or do we
> > just have a bug?
> > 
> > On Tue, 2003-09-23 at 07:42, Andy Czerwonka wrote:
> > > I'm having a problem with a very simple mapping.  I've went through all
> > > the docs and examples, and afaik, the mappings are right. I'll provide
> > > some context.
> > > 
> > > Database
> > > 
> > > create table LBRTRY_Q (UNQ_ID number(12) not null, MSG_TXT clob not /
> > > null, STTS_CODE number(8) not null, NXT_UNQ_ID number(12));
> > > 
> > > alter table LBRTRY_Q add constraint LBRTRY_Q_PK primary key (UNQ_ID) /
> > > using index;
> > > 
> > > create sequence LBRTRY_Q_SEQ maxvalue  cycle;
> > > 
> > > 
> > > Database And User Repositories
> > > ==
> > >  > > 
> > >   jcd-alias="default"
> > >   platform="Oracle9i"
> > >   jdbc-level="2.0"
> > >   driver="oracle.jdbc.driver.OracleDriver"
> > >   protocol="jdbc"
> > >   subprotocol="oracle:thin"
> > >   dbalias="@locahost:1521:iadb"
> > >   username="user1"
> > >   password="user1"
> > >   eager-release="false"
> > >   batch-mode="false"
> > >   useAutoCommit="0"
> > >   ignoreAutoCommitExceptions="false"
> > >   default-connection="true">
> > >   
> > >  > > className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"/>
> > > 
> > > 
> > > 
> > > 
> > >  > > class="com.clrstream.chr.mm.persistence.HL7Message"
> > > proxy="dynamic"
> > > table="LBRTRY_Q">
> > > 
> > >> >  name="id"
> > >  column="UNQ_ID"
> > >  jdbc-type="INTEGER"
> > >  primarykey="true"
> > >  autoincrement="true"
> > >  sequence-name="LBRTRY_Q_SEQ"/>
> > > 
> > >> >  name="value"
> > >  column="MSG_TXT"
> > >  jdbc-type="VARCHAR"/>
> > > 
> > >> >  name="status"
> > >  column="STTS_CODE"
> > >  jdbc-type="INTEGER"/>
> > > 
> > >> >  name="nextId"
> > >  column="NXT_UNQ_ID"
> > >  jdbc-type="INTEGER"
> > >  access="anonymous"/>
> > > 
> > >> >  name="next"
> > >  class-ref="com.clrstream.chr.mm.persistence.HL7Message">
> > >   
> > >   
> > > 
> > >
> > > 
> > > 
> > > Important Bits Of The Persistent Java POJO
> > > ==
> > > public class HL7Message
> > > {
> > > private static int UNPROCESSED = 67;
> > > private static int MAX_LENGTH = 1
> > > 
> > > protected int id;
> > > protected String value = null;
> > > protected int status = UNPROCESSED;
> > > protected HL7Message next;
> > > 
> > > public HL7Message()
> > > {
> > > }
> > > 
> > > public HL7Message(String value)
> > > {
> > >   int messageLength = value.length();
> > >   if (messageLength > MAX_LENGTH)
> > >   {
> > >   this.value = value.substring(0, MAX_LENGTH);
> > >   this.next = new HL7Message(value.substring(MAX_LENGTH));
> > >   }
> > >   else
> > >   {
> > >   this.value = value;
> > >   }
> > > }
> > > 
> > > }
> > > 
> > > 
> > > Important Bit Of Unit Test
> > > ==
> > > broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> > > ...
> > > HL7Message msg = new HL7Message("123");
> > > broker.beginTransaction();
> > > broker.store(msg);
> > > broker.commitTransaction();
> > > Query query = new QueryByCriteria(HL7Message.class, null);
> > > Collection results = broker.getCollectionByQuery(query);
> > > assertTrue("Found 1 Message", results.size() == 1);
> > > HL7Message foundMessage = (HL7Message) results.toArray()[0];
> > > assertTrue("Recursively 3 deep", foundMessage.getNext().getNext() !=
> > > null);
> > > 
> > > 
> > > PROBLEM
> > > ===
> > > 
> > > You can see that the table is simple a queue that breaks up a message
> > > into 4k bits, actually for testing, simply string of length 1.  When I
> > > broker.store(), it only creates 1 record in the database.  The WEIRD
> > > part is that this test PASSES!!  Looking at the database, it shouldn't. 
> > > Is there some kind of caching going on?
-- 
andy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: PLEASE HELP!!!! No recursion??????

2003-09-23 Thread Andy Czerwonka
BTW - on a subsequent test that does the query again, it fails.  I does
only see the 1 record and doesn't build my linked list.  Looks like
there is some caching.  Anyone know what I'm doing wrong here or do we
just have a bug?

On Tue, 2003-09-23 at 07:42, Andy Czerwonka wrote:
> I'm having a problem with a very simple mapping.  I've went through all
> the docs and examples, and afaik, the mappings are right. I'll provide
> some context.
> 
> Database
> 
> create table LBRTRY_Q (UNQ_ID number(12) not null, MSG_TXT clob not /
> null, STTS_CODE number(8) not null, NXT_UNQ_ID number(12));
> 
> alter table LBRTRY_Q add constraint LBRTRY_Q_PK primary key (UNQ_ID) /
> using index;
> 
> create sequence LBRTRY_Q_SEQ maxvalue  cycle;
> 
> 
> Database And User Repositories
> ==
>  
>   jcd-alias="default"
>   platform="Oracle9i"
>   jdbc-level="2.0"
>   driver="oracle.jdbc.driver.OracleDriver"
>   protocol="jdbc"
>   subprotocol="oracle:thin"
>   dbalias="@locahost:1521:iadb"
>   username="user1"
>   password="user1"
>   eager-release="false"
>   batch-mode="false"
>   useAutoCommit="0"
>   ignoreAutoCommitExceptions="false"
>   default-connection="true">
>   
>  className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"/>
> 
> 
> 
> 
>  class="com.clrstream.chr.mm.persistence.HL7Message"
> proxy="dynamic"
> table="LBRTRY_Q">
> 
> name="id"
>  column="UNQ_ID"
>  jdbc-type="INTEGER"
>  primarykey="true"
>  autoincrement="true"
>  sequence-name="LBRTRY_Q_SEQ"/>
> 
> name="value"
>  column="MSG_TXT"
>  jdbc-type="VARCHAR"/>
> 
> name="status"
>  column="STTS_CODE"
>  jdbc-type="INTEGER"/>
> 
> name="nextId"
>  column="NXT_UNQ_ID"
>  jdbc-type="INTEGER"
>  access="anonymous"/>
> 
> name="next"
>  class-ref="com.clrstream.chr.mm.persistence.HL7Message">
>   
>   
> 
>
> 
> 
> Important Bits Of The Persistent Java POJO
> ==
> public class HL7Message
> {
> private static int UNPROCESSED = 67;
> private static int MAX_LENGTH = 1
> 
> protected int id;
> protected String value = null;
> protected int status = UNPROCESSED;
> protected HL7Message next;
> 
> public HL7Message()
> {
> }
> 
> public HL7Message(String value)
> {
>   int messageLength = value.length();
>   if (messageLength > MAX_LENGTH)
>   {
>   this.value = value.substring(0, MAX_LENGTH);
>   this.next = new HL7Message(value.substring(MAX_LENGTH));
>   }
>   else
>   {
>   this.value = value;
>   }
> }
> 
> }
> 
> 
> Important Bit Of Unit Test
> ==
> broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> ...
> HL7Message msg = new HL7Message("123");
> broker.beginTransaction();
> broker.store(msg);
> broker.commitTransaction();
> Query query = new QueryByCriteria(HL7Message.class, null);
> Collection results = broker.getCollectionByQuery(query);
> assertTrue("Found 1 Message", results.size() == 1);
> HL7Message foundMessage = (HL7Message) results.toArray()[0];
> assertTrue("Recursively 3 deep", foundMessage.getNext().getNext() !=
> null);
> 
> 
> PROBLEM
> ===
> 
> You can see that the table is simple a queue that breaks up a message
> into 4k bits, actually for testing, simply string of length 1.  When I
> broker.store(), it only creates 1 record in the database.  The WEIRD
> part is that this test PASSES!!  Looking at the database, it shouldn't. 
> Is there some kind of caching going on?
-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PLEASE HELP!!!! No recursion??????

2003-09-23 Thread Andy Czerwonka
One more thing...

One the one record in the database it does produce, the UNQ_ID = 1 and
the NXT_UNQ_ID = 2, just as expected, But, there's NO SECOND RECORD!
Very weird.  Looks like the SequenceImpl correctly assigns the UNQ_ID
and understand the foreign key relationship just fine, but can't persist
the recursive behaviour.

On Tue, 2003-09-23 at 07:50, Andy Czerwonka wrote:
> BTW - on a subsequent test that does the query again, it fails.  I does
> only see the 1 record and doesn't build my linked list.  Looks like
> there is some caching.  Anyone know what I'm doing wrong here or do we
> just have a bug?
> 
> On Tue, 2003-09-23 at 07:42, Andy Czerwonka wrote:
> > I'm having a problem with a very simple mapping.  I've went through all
> > the docs and examples, and afaik, the mappings are right. I'll provide
> > some context.
> > 
> > Database
> > 
> > create table LBRTRY_Q (UNQ_ID number(12) not null, MSG_TXT clob not /
> > null, STTS_CODE number(8) not null, NXT_UNQ_ID number(12));
> > 
> > alter table LBRTRY_Q add constraint LBRTRY_Q_PK primary key (UNQ_ID) /
> > using index;
> > 
> > create sequence LBRTRY_Q_SEQ maxvalue  cycle;
> > 
> > 
> > Database And User Repositories
> > ==
> >  > 
> > jcd-alias="default"
> > platform="Oracle9i"
> > jdbc-level="2.0"
> > driver="oracle.jdbc.driver.OracleDriver"
> > protocol="jdbc"
> > subprotocol="oracle:thin"
> > dbalias="@locahost:1521:iadb"
> > username="user1"
> > password="user1"
> > eager-release="false"
> > batch-mode="false"
> > useAutoCommit="0"
> > ignoreAutoCommitExceptions="false"
> > default-connection="true">
> > 
> >  > className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"/>
> > 
> > 
> > 
> > 
> >  >   class="com.clrstream.chr.mm.persistence.HL7Message"
> >   proxy="dynamic"
> >   table="LBRTRY_Q">
> > 
> >>  name="id"
> >  column="UNQ_ID"
> >  jdbc-type="INTEGER"
> >  primarykey="true"
> >  autoincrement="true"
> >  sequence-name="LBRTRY_Q_SEQ"/>
> > 
> >>  name="value"
> >  column="MSG_TXT"
> >  jdbc-type="VARCHAR"/>
> > 
> >>  name="status"
> >  column="STTS_CODE"
> >  jdbc-type="INTEGER"/>
> > 
> >>  name="nextId"
> >  column="NXT_UNQ_ID"
> >  jdbc-type="INTEGER"
> >  access="anonymous"/>
> > 
> >>  name="next"
> >  class-ref="com.clrstream.chr.mm.persistence.HL7Message">
> > 
> >   
> > 
> >
> > 
> > 
> > Important Bits Of The Persistent Java POJO
> > ==
> > public class HL7Message
> > {
> > private static int UNPROCESSED = 67;
> > private static int MAX_LENGTH = 1
> > 
> > protected int id;
> > protected String value = null;
> > protected int status = UNPROCESSED;
> > protected HL7Message next;
> > 
> > public HL7Message()
> > {
> > }
> > 
> > public HL7Message(String value)
> > {
> > int messageLength = value.length();
> > if (messageLength > MAX_LENGTH)
> > {
> > this.value = value.substring(0, MAX_LENGTH);
> > this.next = new HL7Message(value.substring(MAX_LENGTH));
> > }
> > else
> > {
> > this.value = value;
> > }
> > }
> > 
> > }
> > 
> > 
> > Important Bit Of Unit Test
> > ==
> > broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> > ...
> > HL7Message msg = new HL7Message("123");
> > broker.beginTransaction();
> > broker.store(msg);
> > broker.commitTransaction();
> > Query query = new QueryByCriteria(HL7Message.class, null);
> > Collection results = broker.getCollectionByQuery(query);
> > assertTrue("Found 1 Message", results.size() == 1);
> > HL7Message foundMessage = (HL7Message) results.toArray()[0];
> > assertTrue("Recursively 3 deep", foundMessage.getNext().getNext() !=
> > null);
> > 
> > 
> > PROBLEM
> > ===
> > 
> > You can see that the table is simple a queue that breaks up a message
> > into 4k bits, actually for testing, simply string of length 1.  When I
> > broker.store(), it only creates 1 record in the database.  The WEIRD
> > part is that this test PASSES!!  Looking at the database, it shouldn't. 
> > Is there some kind of caching going on?
-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



PLEASE HELP!!!! No recursion??????

2003-09-23 Thread Andy Czerwonka
I'm having a problem with a very simple mapping.  I've went through all
the docs and examples, and afaik, the mappings are right. I'll provide
some context.

Database

create table LBRTRY_Q (UNQ_ID number(12) not null, MSG_TXT clob not /
null, STTS_CODE number(8) not null, NXT_UNQ_ID number(12));

alter table LBRTRY_Q add constraint LBRTRY_Q_PK primary key (UNQ_ID) /
using index;

create sequence LBRTRY_Q_SEQ maxvalue  cycle;


Database And User Repositories
==









  

  

  

  

  

  

   


Important Bits Of The Persistent Java POJO
==
public class HL7Message
{
private static int UNPROCESSED = 67;
private static int MAX_LENGTH = 1

protected int id;
protected String value = null;
protected int status = UNPROCESSED;
protected HL7Message next;

public HL7Message()
{
}

public HL7Message(String value)
{
int messageLength = value.length();
if (messageLength > MAX_LENGTH)
{
this.value = value.substring(0, MAX_LENGTH);
this.next = new HL7Message(value.substring(MAX_LENGTH));
}
else
{
this.value = value;
}
}

}


Important Bit Of Unit Test
==
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
...
HL7Message msg = new HL7Message("123");
broker.beginTransaction();
broker.store(msg);
broker.commitTransaction();
Query query = new QueryByCriteria(HL7Message.class, null);
Collection results = broker.getCollectionByQuery(query);
assertTrue("Found 1 Message", results.size() == 1);
HL7Message foundMessage = (HL7Message) results.toArray()[0];
assertTrue("Recursively 3 deep", foundMessage.getNext().getNext() !=
null);


PROBLEM
===

You can see that the table is simple a queue that breaks up a message
into 4k bits, actually for testing, simply string of length 1.  When I
broker.store(), it only creates 1 record in the database.  The WEIRD
part is that this test PASSES!!  Looking at the database, it shouldn't. 
Is there some kind of caching going on?


-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Evaluation and CLOB... or not

2003-09-21 Thread Andy Czerwonka
Hi guys/gals,

I've got a problem that I'd like to solve, and at the same time I'd like
to evaluate OJB as a potential solution moving forward in a project I'm
using.  Anyway here' my issue.

I've got a simple socket listener that listens for message from an HL7
message server.  The listener simple takes the message an throws it on a
queue, which is just a table in an Oracle database.  There are a couple
of fields, but the important field is the actual message, which can
simple be represented in Java using a String.  Saying that, the message
can be larger than 4K.  The Oracle JDBC drivers seem to have a problem
with anything larger than 4k. So, here's my question:

I could break up the message and fire them into multiple records and
rebuild them on subsequent reads. Or, I could use a CLOB type and fire
the whole thing in.  Now, initial tests tell me that using the CLOB on
anything > 4K is still troublesome. Does OJB deal with this?  If not,
I'm guessing that I could still use OJB by breaking up the message in a
message class that'd look something like this:

class Message
{
BigDecimal id;
Message child;
Message parent
String value;
int status;
}

The table would simple have a unique sequence id, the CLOB or VARCHAR
message, and parent and child foreign keys.  I'm guessing that this is a
simple map for OJB?  Does anyone see any limitations?  

One thing I don't quite understand is how to deal with the id using
sequences using OJB.  Is there anything special I'd need to do?


-- 
-andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OJB and Oracle 9ias

2003-09-15 Thread Andy Czerwonka
Oracle obviously deals with classpaths differently.  In Tomcat, you
either deployed the ojb jars contextually or in
$TOMCAT_HOME/server/lib.  I'd be that you need to drop them somewhere
where the container knows to look.

On Mon, 2003-09-15 at 08:25, Durham David Contr 805 CSPTS/SCBE wrote:
> Hi all,
> 
> I have a problem using OJB on an Oracle 9ias server.  The application
> I'm working on runs just fine on Tomcat.  However, when deploying to
> Oracle, I receive the following error:
> 
> 
> Failed to deploy web application "aep". 
> Nested exception Root Cause: Class not found:
> org.apache.ojb.broker.metadata.MetadataException; 
> nested exception is: java.lang.ClassNotFoundException:
> org.apache.ojb.broker.metadata.MetadataException. 
> Class not found: org.apache.ojb.broker.metadata.MetadataException;
> nested exception is: java.lang.ClassNotFoundException:
> org.apache.ojb.broker.metadata.MetadataException
> 
> I checked, and the class, MetadataException is in the db-ojb-1.0.rc4.jar
> 
> I'm hoping someone on the list has seen this problem before and knows
> what causes it.
> 
> Thanks,
> 
> 
> Dave
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Xdoclet: How to use base-class properties with different colu mn names in children?

2003-09-12 Thread Andy Czerwonka
Outstanding

On Fri, 2003-09-12 at 05:58, Thomas Dudziak wrote:
> Yes, both the repository descriptor (aka repository_user.xml) and the
> table schema (for Torque which then generates the tables in your
> database) are generated by the xdoclet ojb module.
> If you want to try it out, grab OJB from CVS and look into the contrib
> folder. There you'll find the module along with the xdoclet jars, and the
> documentation for the module.
> 
> Tom
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Xdoclet: How to use base-class properties with different colu mn names in children?

2003-09-12 Thread Andy Czerwonka
I'd love to learn how your using XDoclet with OJB.  Are you generating
both the DDL and the repository?

On Fri, 2003-09-12 at 03:13, Thomas Dudziak wrote:
> A field declared in the class javadoc comment is only then not anonymous
> if there is a tagged field with that name in a base class of that
> class. So, you simply tag the field with @ojb.field in your base class
> (BusinessObject if I remember correctly) - this does not require that you
> also tag the class - and then the @ojb.field in the class javadoc comment
> in the subclass will automatically override the base class tag for the
> subclass.
> 
> E.g.
> 
> class BusinessObject
> {
>   /**
>* @ojb.field column="guid"
>*/
>   protected String guid;
> }
> 
> /**
>  * @ojb.class
>  * @ojb.field name="guid"
>  *column="dog_guid"
>  */
> class Dog extends BusinessObject
> {
> }
> 
> Tom
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



id in the class

2003-09-11 Thread Andy Czerwonka
Hi there,

I'm new to this list.  What I'm looking for is an explanation as to why
I need to to do the following:

class Job {}
class Person {

protected Job job;
protected int jobId;
}

I realize that OJB uses the unique ID, but can't it do something similar
to Toplink, where you don't need to store the id the aggregate?

-- 
Andy Czerwonka
Arctic Penguin Open Source Solutions Inc.
(403) 547-8892
(403) 540-6133 (mobile)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]