OJB - Torque - Incremental sql

2004-04-23 Thread Frank Renaers
Hi,

 

We are using Torque to describe our database schema.

We are looking now for a tool which compares 2 Torque schemas (the old
and the new one) and

generates incremental sql.

Does this already exists ?

 

Thanks,

 

Frank Renaers

Ikan Software

 

 



Re: OJB - Torque - Incremental sql

2004-04-23 Thread Thomas Dudziak
On Fri, 23 Apr 2004, Frank Renaers wrote:

 We are using Torque to describe our database schema.
 
 We are looking now for a tool which compares 2 Torque schemas (the old
 and the new one) and
 
 generates incremental sql.
 
 Does this already exists ?

Havn't heard of something like this, though you might want to ask on the
torque user mailing list, as well.
Perhaps Torque or commons-sql (which also can read Torque schemas) create
'ALTER TABLE' statements ? I guess you could try a temporary database,
generate it using the old schema, then applying the new schema on the same
database to see what Torque and commons-sql generate.
Otherwise you could use Torque as a library, more precisly its metadata
part, then read in both schemas and compare them on the object level (I
don't know nothing of the Torque metadata handling, but it is probably
either DOM, or a specific object model.)

Tom


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



RE: Problem with clearing cache

2004-04-23 Thread Guillaume Nodet
What about using runtime byte-code enhancement, as you mentioned it,
to extends classes to dynamically add properties for storing AKs,
thus removing the need of AnonymousPersistentField ...

Guillaume

-Message d'origine-
De : Armin Waibel [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 22 avril 2004 15:01
À : OJB Users List
Objet : Re: Problem with clearing cache


Hi Guillaume,Brian,

I think the anonymous key (AK) feature should be modified/rewriten
because currently it is object identity based. This means you will loose
all AK information when the object will be de-/serialized or copied. The
upcoming two-level cache will do so and the OTM implementation too (and
my feeling is that this will cause problems).
The AK in conjunction with 1:1 references are always be save (I think),
because when the AK information is lost, we can use the reference to
re-create the AK information.

  I'm willingfull to help refactoring this part, but i'd like to
  have guidelines

sorry I don't have any ideas (without byte-code enhancement ;-))

  if anonymous keys are integrated within the existing cache system,
  but i have no ideas on how to do it.

this will be difficult, because AK implementation does not know about
the cache and the cache could be per class-descriptor, per connection or
global.

regards,
Armin

Guillaume Nodet wrote:

 I use both anonymous PK's and FK's. But the use i do of anonymous
 primary keys is limited to objects that belongs to collections of
 main objects.  Main objects have *real* primary keys and only
 these ones are used directly in the broker (all collections are
 prefetched) and cached. So i think that using anonymous pk's in
 my case is safe (if my understanding is good, problems can arise
 when using anonymous pk's in distributed environnments).

 So the main problem is the caching system
 for anonymous keys (either pk or fk) :
   * keys are kept in a cache specific to the field
   * this cache can not be accessed by any means so no clear
   is possible
   * this cache can not be a per-broker cache
   * anonymous persistent fields implementation
   can not be extended or overriden

 I'm willingfull to help refactoring this part, but i'd like to
 have guidelines on how to do it...
 I think it would be great
 if anonymous keys are integrated within the existing cache system,
 but i have no ideas on how to do it.

 Guillaume


 -Message d'origine-
 De : Brian McCallister [mailto:[EMAIL PROTECTED]
 Envoyé : jeudi 22 avril 2004 14:06
 À : OJB Users List
 Objet : Re: Problem with clearing cache


 Anonymous PK's are risky things -- I apologize for using them in the
 original anonymous keys tutorial. Anonymous FK's are great, and not
 using them is usually a bad ida in my opinion =)

 I don't think the anonymous PK issues you are having will be resolved
 very soon, the anonymous key functionality wasn't really designed for
 PK usage, but for FK usage. I completely feel that it would be good to
 be able to use them for PK's as well, but my slate is full at the
 moment with JDO stuff =(

 I don't know about everyone else. Any chance *you* want to dig into it?
 ;-)

 -Brian

 On Apr 22, 2004, at 7:55 AM, Guillaume Nodet wrote:


It also seems that cached anonymous keys are not removed from
the cache when an object is deleted from database.
Will these problems be solved, or should i try not to use
anonymous keys ?

Guillaume

-Message d'origine-
De : Guillaume Nodet [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 21 avril 2004 14:42
À : OJB Users List
Objet : Problem with clearing cache


I need to clear the ojb cache at some point in my program
(namely after deleting all data in the database).
The problem i have is that i use anonymous primary keys and
the caches associated with the anonymous fields are not cleared.
Would it be possible to had some mean of clearing these caches ?

The problem is that at some time, i've got errors when inserting
objects. I think that the key for the failing object is in cache
but not in the database so when a foreign key references it,
the insertion fails.

Thanks,
Guillaume Nodet

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




RE: OJB - Torque - Incremental sql

2004-04-23 Thread Guillaume Nodet
The commons-sql library is able to handle this,
but i've not tested it.

Guillaume

-Message d'origine-
De : Thomas Dudziak [mailto:[EMAIL PROTECTED]
Envoye : vendredi 23 avril 2004 11:16
A : OJB Users List
Objet : Re: OJB - Torque - Incremental sql


On Fri, 23 Apr 2004, Frank Renaers wrote:

 We are using Torque to describe our database schema.
 
 We are looking now for a tool which compares 2 Torque schemas (the old
 and the new one) and
 
 generates incremental sql.
 
 Does this already exists ?

Havn't heard of something like this, though you might want to ask on the
torque user mailing list, as well.
Perhaps Torque or commons-sql (which also can read Torque schemas) create
'ALTER TABLE' statements ? I guess you could try a temporary database,
generate it using the old schema, then applying the new schema on the same
database to see what Torque and commons-sql generate.
Otherwise you could use Torque as a library, more precisly its metadata
part, then read in both schemas and compare them on the object level (I
don't know nothing of the Torque metadata handling, but it is probably
either DOM, or a specific object model.)

Tom


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



Problem with sequence manager

2004-04-23 Thread Guillaume Nodet
Hi,

In my application, i can dynamically create and drop the tables
for storing ojb objects. The problem is that when i insert some
data, drop the tables, recreate them, and insert data, the sequence
manager is not re-initialized (i use SequenceManagerHighLowImpl)
so when inserting data in the newly created tables, the sequence
manager reuses caches sequences (in the sequencesMap), instead
of creating new ones. So when a sequence runs out of id, it looks
into the database, creates a new sequence and thus ids overlapp.

Could it be possible to add a method for clearing the cache of
sequences (stored in the sequencesMap attribute) ?

I will for the moment use my own sequence manager (a copy of
SequenceManagerHighLowImpl with the above method).

Thanks,

Guillaume

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



RE: Problem with sequence manager

2004-04-23 Thread Guillaume Nodet
I only added the following method:

public static void clearCache() {
if (sequencesMap != null) {
sequencesMap.clear();
}
}

and called it when i destroy the tables, and everything
works fine now.

-Message d'origine-
De : Guillaume Nodet [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 23 avril 2004 16:25
À : OJB Users List
Objet : Problem with sequence manager


Hi,

In my application, i can dynamically create and drop the tables
for storing ojb objects. The problem is that when i insert some
data, drop the tables, recreate them, and insert data, the sequence
manager is not re-initialized (i use SequenceManagerHighLowImpl)
so when inserting data in the newly created tables, the sequence
manager reuses caches sequences (in the sequencesMap), instead
of creating new ones. So when a sequence runs out of id, it looks
into the database, creates a new sequence and thus ids overlapp.

Could it be possible to add a method for clearing the cache of
sequences (stored in the sequencesMap attribute) ?

I will for the moment use my own sequence manager (a copy of
SequenceManagerHighLowImpl with the above method).

Thanks,

Guillaume

-
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 increment not working

2004-04-23 Thread Glenn Barnard
Your settings look good. I use this technique with MS SQL Server and all is 
working well. Please note which version of OJB you're using. Hopefully, its 
rc6!

From: Nilesh [EMAIL PROTECTED]
Reply-To: OJB Users List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: auto increment not working
Date: Sun, 22 Feb 2004 19:40:34 +0530
In my OJB (using  PersistenceBroker ) application auto-increment is not 
working.

I am using  MySQL in which I have also used the auto-increment constraint 
for the Primarykey ( bigint(20) )

For my database definition i have used the SequenceManagerNativeImpl

 sequence-manager 
className=org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
attribute attribute-name=autoNaming 
attribute-value=true/
 /sequence-manager

also in the mapping file  i have

class-descriptor 
class=com.haystack.emailmarketingchoice.member.MemberVO 
table=tblMember

   field-descriptor id=1 name=memberId column=member_id 
jdbc-type=BIGINT  primarykey=true autoincrement=true 
access=readonly /


/class-descriptor

i have also tried without the  -- access=readonly

but it generates a new 20 digit  auto-increment number  only for the 
first insert, for the subsequent inserts it generates the same number and a 
Duplicate Entry error arises.

I have also tried the following sequence managers

SequenceManagerMySQLImpl
SequenceManagerSeqHiLoImpl
with and without these attributes
  attribute attribute-name=grabSize attribute-value=5 /
  attribute attribute-name=globalSequenceId attribute-value=true/
 attribute attribute-name=globalSequenceStart attribute-value=1/


But ALL Failed.
Have any one of you tried this. Please let me know.
Thanks in advance for your interest in my problem.
Regards,
Arjun.





_
From must-see cities to the best beaches, plan a getaway with the Spring 
Travel Guide! http://special.msn.com/local/springtravel.armx

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


Trying to return an unknown connection2!

2004-04-23 Thread Guido Beutler
Hello,

I've got a strange problem with RC6 at JBoss 3.2.3.

I've got a statefull and a stateless session bean. The stateless session 
bean contains all OJB stuff.
The statefull facade accesses some tables via JDBC directly.
That stateless session OJB bean has transaction attribute RequiresNew.
The facade runs with Required.
Both ejb's are container managed.

If a method allocates a JDBC Connection from data source and then access 
the OJB EJB the following
exception is thrown.

java.lang.IllegalStateException: Trying to return an unknown 
connection2! [EMAIL PROTECTED]
   at 
org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.java:330)
   at 
org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:539)
   at 
org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:296)
   at 
org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:117)
   at 
org.apache.ojb.broker.util.WrappedConnection.close(WrappedConnection.java:124)
   at 
org.apache.ojb.broker.util.pooling.ByPassConnection.close(ByPassConnection.java:64)
   at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.releaseConnection(ConnectionFactoryAbstractImpl.java:79)
   at 
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.releaseConnection(ConnectionManagerImpl.java:286)
   at 
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl.beforeCompletion(PersistenceBrokerFactorySyncImpl.jav
a:177)
   at 
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$TransactionBox.beforeCompletion(PersistenceBrokerFactorySyncImpl.java:329)
   at 
org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1308)
   at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:347)
   at 
org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
   at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:325)
   at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
   at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
   at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
   at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
   at 
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
   at org.jboss.ejb.Container.invoke(Container.java:700)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
   at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
   at 
org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
   at 
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
   at 
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
   at 
org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
   at 
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
   at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)

I've got 2 workarounds.

1) If I change RequiresNew at the OJB EJB into Required the problem 
disappears.
2) If the facade does no access a JDBC connection the problem disappears 
too.

Any ideas what's going on there?

best regards,

Guido

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


Re: Problem with clearing cache

2004-04-23 Thread Armin Waibel
Hi Guillaume,

Guillaume Nodet wrote:
What about using runtime byte-code enhancement, as you mentioned it,
to extends classes to dynamically add properties for storing AKs,
thus removing the need of AnonymousPersistentField ...
you stir up a hornet's nest ;-)

Many people don't like manipulation of persistent object classes 
(dynamically or pre-compiled). Another problem will be the use of the 
correct classloader when dynamically enhancement was used and the user 
can't create persistent objects by it's own.

But indeed byte code enhancement will solve or simplify many problems 
(e.g. anonymous fields, object state detection, object locking, ...).
I don't have experience in bytecode manipulation (only played a little 
with ASM) but all suggestions, pros and cons are welcome.

regards,
Armin

Guillaume

-Message d'origine-
De : Armin Waibel [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 22 avril 2004 15:01
À : OJB Users List
Objet : Re: Problem with clearing cache
Hi Guillaume,Brian,

I think the anonymous key (AK) feature should be modified/rewriten
because currently it is object identity based. This means you will loose
all AK information when the object will be de-/serialized or copied. The
upcoming two-level cache will do so and the OTM implementation too (and
my feeling is that this will cause problems).
The AK in conjunction with 1:1 references are always be save (I think),
because when the AK information is lost, we can use the reference to
re-create the AK information.
  I'm willingfull to help refactoring this part, but i'd like to
  have guidelines
sorry I don't have any ideas (without byte-code enhancement ;-))

  if anonymous keys are integrated within the existing cache system,
  but i have no ideas on how to do it.
this will be difficult, because AK implementation does not know about
the cache and the cache could be per class-descriptor, per connection or
global.
regards,
Armin
Guillaume Nodet wrote:


I use both anonymous PK's and FK's. But the use i do of anonymous
primary keys is limited to objects that belongs to collections of
main objects.  Main objects have *real* primary keys and only
these ones are used directly in the broker (all collections are
prefetched) and cached. So i think that using anonymous pk's in
my case is safe (if my understanding is good, problems can arise
when using anonymous pk's in distributed environnments).
So the main problem is the caching system
for anonymous keys (either pk or fk) :
 * keys are kept in a cache specific to the field
 * this cache can not be accessed by any means so no clear
 is possible
 * this cache can not be a per-broker cache
 * anonymous persistent fields implementation
 can not be extended or overriden
I'm willingfull to help refactoring this part, but i'd like to
have guidelines on how to do it...
I think it would be great
if anonymous keys are integrated within the existing cache system,
but i have no ideas on how to do it.
Guillaume

-Message d'origine-
De : Brian McCallister [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 22 avril 2004 14:06
À : OJB Users List
Objet : Re: Problem with clearing cache
Anonymous PK's are risky things -- I apologize for using them in the
original anonymous keys tutorial. Anonymous FK's are great, and not
using them is usually a bad ida in my opinion =)
I don't think the anonymous PK issues you are having will be resolved
very soon, the anonymous key functionality wasn't really designed for
PK usage, but for FK usage. I completely feel that it would be good to
be able to use them for PK's as well, but my slate is full at the
moment with JDO stuff =(
I don't know about everyone else. Any chance *you* want to dig into it?
;-)
-Brian

On Apr 22, 2004, at 7:55 AM, Guillaume Nodet wrote:



It also seems that cached anonymous keys are not removed from
the cache when an object is deleted from database.
Will these problems be solved, or should i try not to use
anonymous keys ?
Guillaume

-Message d'origine-
De : Guillaume Nodet [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 21 avril 2004 14:42
À : OJB Users List
Objet : Problem with clearing cache
I need to clear the ojb cache at some point in my program
(namely after deleting all data in the database).
The problem i have is that i use anonymous primary keys and
the caches associated with the anonymous fields are not cleared.
Would it be possible to had some mean of clearing these caches ?
The problem is that at some time, i've got errors when inserting
objects. I think that the key for the failing object is in cache
but not in the database so when a foreign key references it,
the insertion fails.
Thanks,
Guillaume Nodet
-
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 with sequence manager

2004-04-23 Thread Armin Waibel
Guillaume Nodet wrote:

I only added the following method:

public static void clearCache() {
if (sequencesMap != null) {
sequencesMap.clear();
}
}
It should be no problem to add such a method, but I can't change the 
sequence manager interface (maybe for 1.1), so you have to cast. Maybe 
we call the method 'reset()' and introduce this method in sequence 
manager interface for 1.1.
In reset() method depended on the implementation the sequence manager 
was set to an initial state.
What do you think? Better method name?

regards,
Armin
and called it when i destroy the tables, and everything
works fine now.
-Message d'origine-
De : Guillaume Nodet [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 23 avril 2004 16:25
À : OJB Users List
Objet : Problem with sequence manager
Hi,

In my application, i can dynamically create and drop the tables
for storing ojb objects. The problem is that when i insert some
data, drop the tables, recreate them, and insert data, the sequence
manager is not re-initialized (i use SequenceManagerHighLowImpl)
so when inserting data in the newly created tables, the sequence
manager reuses caches sequences (in the sequencesMap), instead
of creating new ones. So when a sequence runs out of id, it looks
into the database, creates a new sequence and thus ids overlapp.
Could it be possible to add a method for clearing the cache of
sequences (stored in the sequencesMap attribute) ?
I will for the moment use my own sequence manager (a copy of
SequenceManagerHighLowImpl with the above method).
Thanks,

Guillaume

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


Code in two table join

2004-04-23 Thread Info
Hello,

I tried the following code to select a join, but get error:

   Criteria crit = new Criteria();
   crit.addEqualToColumn(A.xxx, B.xxx);
   ReportQueryByCriteria q = 
QueryFactory.newReportQuery(A.class, crit);
   
   q.setAttributes(new String[] {A.xxx, A.yyy, B.zzz });

   Iterator it = broker.getReportQueryIteratorByQuery(q);

( In the case,  for string A.xxx or B.zzz, what name should I use as 
A or B? The physical table name or class name represented or other name?)
SQL statement:

SELECT A.xxx, A.yyy, B.zzz
FROM A JOIN B
ON A.xxx = B.xxx
Please help!

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


Re: Code in two table join

2004-04-23 Thread Jakob Braeuchi
hi wallace,

it's not necessary to join manually, ojb will do it for you:

Criteria crit = new Criteria();
ReportQueryByCriteria q = QueryFactory.newReportQuery(A.class, crit);
q.setAttributes(new String[] {xxx, yyy, rel_b.zzz });
Iterator it = broker.getReportQueryIteratorByQuery(q);

there must be a relationship-definition from class A to B named 'rel_b' in the 
repository.

jakob

Info wrote:

Hello,

I tried the following code to select a join, but get error:

   Criteria crit = new Criteria();
   crit.addEqualToColumn(A.xxx, B.xxx);
   ReportQueryByCriteria q = 
QueryFactory.newReportQuery(A.class, crit);
  q.setAttributes(new String[] {A.xxx, A.yyy, 
B.zzz });

   Iterator it = broker.getReportQueryIteratorByQuery(q);

( In the case,  for string A.xxx or B.zzz, what name should I use as 
A or B? The physical table name or class name represented or other name?)
SQL statement:

SELECT A.xxx, A.yyy, B.zzz
FROM A JOIN B
ON A.xxx = B.xxx
Please help!

Thanks!
Wallace
-
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]


Exception from RsIterator

2004-04-23 Thread Info
Hello Everybody! I am working through the week end.

-
J2SE 1.4.2_04 + OJB 1.0 rc6 + Struts 1.1 + J2EE (just in classpath)
-
I am geting a report query by:
   broker = PersistenceBrokerFactory.defaultPersistenceBroker();

   Criteria crit = new Criteria();
   ReportQueryByCriteria q = 
QueryFactory.newReportQuery(ThreadDto.class, crit);
   q.setAttributes(new String[]{priority, username});
  
   Iterator it = broker.getReportQueryIteratorByQuery(q);
   while (it.hasNext()){
   it.next();..
   .
   }

but from line:   while (it.hasNext()) get the following exception

org.apache.ojb.broker.accesslayer.RsIterator$ResourceClosedException: 
Resources no longer reachable, RsIterator will be automatic cleaned up 
on PB.close/.commitTransaction/.abortTransaction
   at 
org.apache.ojb.broker.accesslayer.RsIterator.getRsAndStmt(RsIterator.java:876)
   at 
org.apache.ojb.broker.accesslayer.RsIterator.hasNext(RsIterator.java:228)

I tried to use Query instead of report query, and let it returns a 
Colleciton, everything is fine.
Later, I still used Query, but ask it return a Iterator (by method: 
getIteratorByQuery()), I get the same exception as above. It looks like 
not caused by report query but by Iterator return.

Please give advice,

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


Re: Exception from RsIterator

2004-04-23 Thread Info
Hello week end mid-night!

I know the reason. Actually, after I get Iterator, this time OJB hasn't 
get whole data set yet. So I only get a interface, every time I invoke 
next(), the Iterator(RsIterator) will retrieve the data from database. 
So I can't return Iterator from a method. Because, before return the 
Iterator the following code will be executed:

   } finally {
   if (broker != null) {
   broker.close();
   }
   }
my database connection has been close before I process the Iterator.
I have to retrieve the data from Iterator manually before I return. I 
guess OJB intend to minimize the database access from Iterator mode.

Thanks,
Wallace
Info wrote:

Hello Everybody! I am working through the week end.

- 

J2SE 1.4.2_04 + OJB 1.0 rc6 + Struts 1.1 + J2EE (just in classpath)
- 

I am geting a report query by:

   broker = PersistenceBrokerFactory.defaultPersistenceBroker();

   Criteria crit = new Criteria();
   ReportQueryByCriteria q = 
QueryFactory.newReportQuery(ThreadDto.class, crit);
   q.setAttributes(new String[]{priority, username});
 Iterator it = broker.getReportQueryIteratorByQuery(q);
   while (it.hasNext()){
   it.next();..
   .
   }

but from line:   while (it.hasNext()) get the following exception

org.apache.ojb.broker.accesslayer.RsIterator$ResourceClosedException: 
Resources no longer reachable, RsIterator will be automatic cleaned up 
on PB.close/.commitTransaction/.abortTransaction
   at 
org.apache.ojb.broker.accesslayer.RsIterator.getRsAndStmt(RsIterator.java:876) 

   at 
org.apache.ojb.broker.accesslayer.RsIterator.hasNext(RsIterator.java:228)

I tried to use Query instead of report query, and let it returns a 
Colleciton, everything is fine.
Later, I still used Query, but ask it return a Iterator (by method: 
getIteratorByQuery()), I get the same exception as above. It looks 
like not caused by report query but by Iterator return.

Please give advice,

Thanks!
Wallace
-
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 increment not working

2004-04-23 Thread Nilesh



Thanks Glenn,
 Yes I am using OJB rc6. And I have also tried without
using any sequence manager. Do I neeed to create my own sequence manager.
How will it help and how do I do that ? Please tell me if you have any idea.

Thanks again.


Regards,
Nilesh.






- Original Message -
From: Glenn Barnard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 23, 2004 8:56 PM
Subject: RE: auto increment not working


 Your settings look good. I use this technique with MS SQL Server and all
is
 working well. Please note which version of OJB you're using. Hopefully,
its
 rc6!

 From: Nilesh [EMAIL PROTECTED]
 Reply-To: OJB Users List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: auto increment not working
 Date: Sun, 22 Feb 2004 19:40:34 +0530
 
 In my OJB (using  PersistenceBroker ) application auto-increment is not
 working.
 
 I am using  MySQL in which I have also used the auto-increment constraint
 for the Primarykey ( bigint(20) )
 
 
 For my database definition i have used the SequenceManagerNativeImpl
 
   sequence-manager

className=org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
  attribute attribute-name=autoNaming
 attribute-value=true/
   /sequence-manager
 
 
 also in the mapping file  i have
 
  class-descriptor
 class=com.haystack.emailmarketingchoice.member.MemberVO
 table=tblMember
 
 field-descriptor id=1 name=memberId column=member_id
 jdbc-type=BIGINT  primarykey=true autoincrement=true
 access=readonly /
  
  
  /class-descriptor
 
 i have also tried without the  -- access=readonly
 
 but it generates a new 20 digit  auto-increment number  only for the
 first insert, for the subsequent inserts it generates the same number and
a
 Duplicate Entry error arises.
 
 I have also tried the following sequence managers
 
 SequenceManagerMySQLImpl
 SequenceManagerSeqHiLoImpl
 
 with and without these attributes
attribute attribute-name=grabSize attribute-value=5 /
attribute attribute-name=globalSequenceId attribute-value=true/
   attribute attribute-name=globalSequenceStart
attribute-value=1/
 
 
 
 But ALL Failed.
 Have any one of you tried this. Please let me know.
 Thanks in advance for your interest in my problem.
 
 Regards,
 Arjun.
 
 
 
 
 
 

 _
 From must-see cities to the best beaches, plan a getaway with the Spring
 Travel Guide! http://special.msn.com/local/springtravel.armx


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