AW: AW: Object Cache using ObjectCacheJCSImpl

2004-04-26 Thread Dirk Manske (Service Respond)
Hi Armin,

oh I see, great. This simplifies it for me. I have two more questions: If I
do not specify an expiration time of the cached object in cache.ccf, is
there a default 'remove objects from cache implementation" which will be
invoked after a certain time? What about the memory shrinker property? If I
set it to true, what is the exact effect and when does make it sense to use
it?

thank you,
Dirk


-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 26. April 2004 11:47
An: OJB Users List
Betreff: Re: AW: Object Cache using ObjectCacheJCSImpl

Hi Dirk,

you don't need to cache the objects by yourself it will be done by OJB. 
If you want to manipulate the cache use the service method provided by PB:
PB.serviceObjectCache()

or to remove objects from the cache, yu can find methods at PB.

 > broker.beginTransaction();
 >
 > broker.insert(persistObject);
 >
 > broker.commitTransaction();
 > broker.close();

now your persistObject should be in cache.

regards,
Armin

Dirk Manske (Service Respond) wrote:
> thx for your answer Guiiaume. I already did this and use the example 
> (basic) cache.ccf file from the jcs homepage. But I am using JCS the 
> first time and there is no much docu available, so I am wondering how 
> it all works. Is it as easy as
> 
> broker.beginTransaction();
> 
> broker.insert(persistObject);
> 
> broker.commitTransaction();
> 
> Identity ident = new Identity(persistObject, broker);
> 
> broker.close();
> 
> ObjectCacheJCSImpl jcsCache = new
> ObjectCacheJCSImpl("classForPersistedObject");
> 
> jcsCache.cache(ident, persistObject);  ???
> 
> I am wondering about the Identity object which already holds the 
> persistObject and is now "abused" as key (as far as I know the jcs 
> says to use a String object as key)? My second question is: do I 
> really have to create a new jcsCache object each time or is it just 
> for the first time and then I get the same instance again and again 
> (singleton)? I think it must be the second case otherwise how to get the
cached object?
> 
> thx,
> Dirk
> 
> 
> -Ursprüngliche Nachricht-
> Von: Guillaume Nodet [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 26. April 2004 10:42
> An: OJB Users List
> Betreff: RE: Object Cache using ObjectCacheJCSImpl
> 
> I already used it, just configure the right class in ojb.properties 
> for the key ObjectCacheClass, then just configure your cache.ccf file 
> for configuring jcs.
> 
> Guillaume
> 
> -Message d'origine-
> De : Dirk Manske (Service Respond)
> [mailto:[EMAIL PROTECTED]
> Envoye : dimanche 25 avril 2004 21:25
> A : 'OJB Users List'
> Objet : Object Cache using ObjectCacheJCSImpl
> 
> 
> 
> Hi all,
> 
> I am using ojb-1.0rc5 pb api and a db2 version 7 database. Is someone 
> using ObjectCacheJCSImpl and could provide me a little example of how to
use it?
> Would be great!
> 
> thx,
> 
> Dirk
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

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


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



AW: Object Cache using ObjectCacheJCSImpl

2004-04-26 Thread Dirk Manske (Service Respond)
thx for your answer Guiiaume. I already did this and use the example (basic)
cache.ccf file from the jcs homepage. But I am using JCS the first time and
there is no much docu available, so I am wondering how it all works. Is it
as easy as 

broker.beginTransaction();

broker.insert(persistObject);

broker.commitTransaction();

Identity ident = new Identity(persistObject, broker);

broker.close();

ObjectCacheJCSImpl jcsCache = new
ObjectCacheJCSImpl("classForPersistedObject");

jcsCache.cache(ident, persistObject);  ???

I am wondering about the Identity object which already holds the
persistObject and is now "abused" as key (as far as I know the jcs says to
use a String object as key)? My second question is: do I really have to
create a new jcsCache object each time or is it just for the first time and
then I get the same instance again and again (singleton)? I think it must be
the second case otherwise how to get the cached object?

thx,
Dirk


-Ursprüngliche Nachricht-
Von: Guillaume Nodet [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 26. April 2004 10:42
An: OJB Users List
Betreff: RE: Object Cache using ObjectCacheJCSImpl

I already used it, just configure the right class in ojb.properties for the
key ObjectCacheClass, then just configure your cache.ccf file for
configuring jcs.

Guillaume

-Message d'origine-
De : Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED]
Envoye : dimanche 25 avril 2004 21:25
A : 'OJB Users List'
Objet : Object Cache using ObjectCacheJCSImpl



Hi all,

I am using ojb-1.0rc5 pb api and a db2 version 7 database. Is someone using
ObjectCacheJCSImpl and could provide me a little example of how to use it?
Would be great!

thx,

Dirk


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



Object Cache using ObjectCacheJCSImpl

2004-04-25 Thread Dirk Manske (Service Respond)
 
Hi all,

I am using ojb-1.0rc5 pb api and a db2 version 7 database. Is someone using
ObjectCacheJCSImpl and could provide me a little example of how to use it?
Would be great!

thx,

Dirk


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



Any OJB issues when changing from jdbc 2.0 to 1.0?

2004-04-16 Thread Dirk Manske (Service Respond)
 Hi all,

we are using ojb-1.0rc5 pb api and a db2 version 7 database. the used driver
is jdbc 2.0 compatible. Now we are demanded to use a db2 driver which
supports only jdbc 1.0. We are asking if there are some limitations (eg
performance, loss of functionalities within ojb ...) from ojb to be expected
when using a jdbc 1.0 level driver? Or is it irrelevant to ojb which jdbc
level is used?

thx,

Dirk


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



JOIN between tables from different databases?

2004-03-09 Thread Dirk Manske (Service Respond)
 Hi,

we are using PB API with DB2 7. We have two database schemes  where each
database is served by ist own PBKey broker. Now we need to join two tables
from each database. Is this possible when using the OJB Query API?? If so,
can someone provide an example? 

thx,

Dirk


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



AW: AW: AW: Extent

2004-03-02 Thread Dirk Manske (Service Respond)
hm. in my last download of ojb-1.0rc5 (dec. 2003) there was no docu about
the xdoclet support. however I got it from the cvs version  and it works
now. thanks.  

Dirk

-Ursprüngliche Nachricht-
Von: Thomas Dudziak [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 2. März 2004 10:54
An: OJB Users List
Betreff: Re: AW: AW: Extent

On Tue, 2 Mar 2004, Dirk Manske (Service Respond) wrote:

> thanks for the answer Tom. I need more information about the 
> ojb.modify-inherited tag. You say I could control which attribute will 
> be picked up. How? Here is the scenario: The BaseClass holds all the 
> "common attributes". For some objects (extended from BaseClass) all 
> these common attributes have to be persisted while for some other 
> objects (also extended from BaseClass) only a few of them have to be 
> persisted. The problem is, that the generated repository now holds all 
> the common attributes for each class-descriptor but I do not need them 
> for each class. could the ojb.modify-inherited tag help me in this 
> case?  An example of how to exclude an attribute for specific classes 
> would be great. thx,

There is one in the docs for the xdoclet-module. Bascially, you state the
inherited feature that you want to modify (via the name) and then you have
'ignore="true"' for it.
You should be careful with modification (though ignore should be safe) as
the xdoclet-module probably allows far more than OJB.
 
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]



AW: AW: Extent

2004-03-01 Thread Dirk Manske (Service Respond)
thanks for the answer Tom. I need more information about the
ojb.modify-inherited tag. You say I could control which attribute will be
picked up. How? Here is the scenario: The BaseClass holds all the "common
attributes". For some objects (extended from BaseClass) all these common
attributes have to be persisted while for some other objects (also extended
from BaseClass) only a few of them have to be persisted. The problem is,
that the generated repository now holds all the common attributes for each
class-descriptor but I do not need them for each class. could the
ojb.modify-inherited tag help me in this case?  An example of how to exclude
an attribute for specific classes would be great. thx,

Dirk


-Ursprüngliche Nachricht-
Von: Thomas Dudziak [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 29. Februar 2004 21:03
An: OJB Users List
Betreff: Re: AW: Extent

On Sun, 29 Feb 2004, Dirk Manske (Service Respond) wrote:

> Hi Peter,
> 
> my first repository-user.xml does not contain the extent concept at 
> all. I simply did not set up a class-descriptor for BaseClass - just 
> as you described.
> 
> The extent concept came up to my mind when I thought that XDoclet 
> would be a great time saver to set up the repository. For each 
> attribute in the model class you declare an ojb.field, ojb.reference 
> etc. Since the common attributes are in BaseClass I wondered how to 
> set them up via XDoclet for each model class. That is why I guess U have
to use the extent concept of
> ojb.   

Simply put the required tags (ojb.field, ojb.reference etc.) in the
BaseClass. There is no need to tag the BaseClass with ojb.class, the XDoclet
module will pick up any inherited persistent (tagged) features regardless of
whether their class is persistent (ojb.class) or not, and add them to the
current class descriptor. You can also control which features are picked up
via the ojb.modify-inherited tag, which also allows you to modify them for
the current class.

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]



AW: Extent

2004-02-29 Thread Dirk Manske (Service Respond)
Hi Peter,

my first repository-user.xml does not contain the extent concept at all. I
simply did not set up a class-descriptor for BaseClass - just as you
described.

The extent concept came up to my mind when I thought that XDoclet would be a
great time saver to set up the repository. For each attribute in the model
class you declare an ojb.field, ojb.reference etc. Since the common
attributes are in BaseClass I wondered how to set them up via XDoclet for
each model class. That is why I guess U have to use the extent concept of
ojb.   

Any idea?

Dirk

-Ursprüngliche Nachricht-
Von: Peter Wieland [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 29. Februar 2004 16:47
An: [EMAIL PROTECTED]
Betreff: Re: Extent

Hi Dirk,

I'm not sure whether I understood your problem. Maybe I can help anyway...

First, I'm not sure whether you really need to declare the extents for all
your classes. Wouldn't it be sufficient to simply have all model classes
having the same superclass BaseClass. If this is the case, simply model
write a class-descriptor for each model class without any extent
declarations. The BaseClass doesn't even need an entry in the repository
file.

Of course, if you need to do queries using the BaseClass, this approach
won't work. You would then need to declare the BaseClass in the repository
with all it's extents. This would probably look like


  
  
  ...
  
  
  


In the latter case, I think you would have to redeclare the id and version
fields in each extent class together with the specific attributes for each
extent class:


  
  
  
  


I'm not quite sure, whether it is really necessary to redeclare the common
fields in each extent class, but I'm sure that it works this way as we are
using this approach. The column names for the extent classes do not need to
be the same for the same fields in different extent classes.

Using the extent-approach, you will have one separate table for each model
class, containing all the needed columns, included the "inherited" ones.

Hope that helps,

Peter


> Hi,

> I am using PB-API and DB2 7 for a few weeks now and have a question 
> regarding the ojb extent concept.

> I have a BaseClass which holds common attributes (timestamp, 
> versionnr) for model objects. Each model class has to extent 
> BaseClass. Database tables hold the common attributes and specific 
> attributes for the appropriate model class.

> In the repository-user.xml I declared the common attributes separately 
> for each model class-descriptor. My question is: Did I miss the 
> ojb-extent concept totally? Could I just declare a model class as an 
> extent-class of BaseClass and delete the common attributes from each 
> (model)class-descriptor because of the extent, ojb would handle these 
> attributes automatically for each extended class?

> thx,
> Dirk


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



Extent

2004-02-29 Thread Dirk Manske (Service Respond)
Hi,

I am using PB-API and DB2 7 for a few weeks now and have a question
regarding the ojb extent concept. 

I have a BaseClass which holds common attributes (timestamp, versionnr) for
model objects. Each model class has to extent BaseClass. Database tables
hold the common attributes and specific attributes for the appropriate model
class. 

In the repository-user.xml I declared the common attributes separately for
each model class-descriptor. My question is: Did I miss the ojb-extent
concept totally? Could I just declare a model class as an extent-class of
BaseClass and delete the common attributes from each (model)class-descriptor
because of the extent, ojb would handle these attributes automatically for
each extended class?

thx,
Dirk


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



AW: Delete object in a 1:N assoc only with RemovalAwareCollection?

2004-02-21 Thread Dirk Manske (Service Respond)
Hi Armin,

problem is solved. I do a broker.clearCache after an object has been deleted
and changed the auto-update setting to false. But I guess this is not an
expected behaviour that the object remains in cache after it has been
deleted, does it? Or in general, should one always do a clearCache after
update, insert or delete?

Dirk   

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 21. Februar 2004 13:36
An: OJB Users List
Betreff: Re: Delete object in a 1:N assoc only with RemovalAwareCollection?

Hi Dirk,

Dirk Manske (Service Respond) wrote:
> Hi,
> 
> I am using PB API with DB2. I experience the phenomen that in a 1:N 
> association a N object is not being deleted. I do not use a 
> RemovalAwareCollection. Here is the scenario:
> 
> Table Activity and table Schedule are 1:N related. A user can delete a 
> specific schedule or all schedules of a particular activity object. If 
> the user selects a schedule to delete, the app retrieves the 
> scheduleId and scheduleObject from the DB. Then it simply deletes the 
> object by broker.delete(scheduleObject). So far it is only theory 
> because the scheduleObject remains in the DB. How to delete?
>

hmm, sounds strange. Are your sure that the schedule object wasn't deleted
from DB, or did OJB find this object in cache after delete?
Do you store the Activity object after the delete too and set auto-update
true in collection-descriptor of Activity and do not remove (the deleted)
schedule object from collection?


regards,
Armin

> I could not find anything in the faqs. However, the testcases always 
> use RemovalAwareCollection. Can someone point out the concept behind this?
> 
> thx,
> Dirk
> 
> 
> -
> 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]



AW: AW: auto... not possible when using multiple databases?

2004-02-18 Thread Dirk Manske (Service Respond)
Hi,

>>hmm, indeed in theory this should work for read, but I never test it.
>>Do I understand you:
>>- Get object from DB1 using broker_1
>>- Get broker_2 (using PBKey for DB2) and do
broker2.retrieveReference(object, "attributeName")

>>This cause an exception?

No exception. There are just no objects referenced. I try for db1
broker1.getObjectPerson. ObjectPerson is materialized. Then I do
broker2.retrieveAllReferences(ObjectPerson). broker2 (using PBKey) is
configured for a different database of course. Today we had to change the
database model. We have now two schemas, this is why I have to use to
brokers. Before the database model has been changed OJB handled the
reference stuff automagically and it worked. If retrieveAllReferences for
objects across multiple databases should work I would be glad to see a
little example as I struggled with this. Currently I retrieve all cross
db-references manually which is a nightmare... 

Dirk

 

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 19. Februar 2004 00:25
An: OJB Users List
Betreff: Re: AW: auto... not possible when using multiple databases?

Hi,

Dirk Manske (Service Respond) wrote:

> Hi Armin,
> 
> I am using PB and do not need any distributed transactions. I asked 
> this question because I experience some difficulties with 1:N 
> references where one object is stored in db1 and the n objects are 
> stored in db2. in this case auto-retrieve="true" of course fails.

right, this is the exception you have to disable the auto-XXX flags.

> but even when I try to get the
> object from db1 and do a broker.retrieveAllReferences(object) it is 
> not working. But I guess this should work. In the mail-archives I 
> found this message from Thomas:
> 

hmm, indeed in theory this should work for read, but I never test it.
Do I understand you:
- Get object from DB1 using broker_1
- Get broker_2 (using PBKey for DB2) and do
broker2.retrieveReference(object, "attributeName")

This cause an exception?

>  >Can I store parts of an object in one DB and other parts in another? 
> If so,
> 

This can't be handled by OJB. Here you need an additional layer on top of
OJB and you need distributed transaction an store/delete.
The layer detect where to store the main object and all references. On read
the layer does things described above.

regards,
Armin

>>how do I
>>then build the complete object during lookup?
> 
> 
>>Say you have databases A and B. You also have two classes ClassA 
>>(mapped to A) and ClassB (mapped to B).
> 
> 
>>ClassA holds a reference to a ClassB object.
> 
> 
>>now follow these steps:
>>1. obtain two broker instances brokerA and brokerB working against the 
>>A and B database respectively.
> 
> 
>>2. call
>>ClassA a = (ClassA) brokerA.getObjectByQuery(...);
> 
> 
>>to load the instance a. To avoid automatic (and in this case wrong) 
>>retrieval of the ClassB reference the respective reference-descriptor 
>>must be set to auto-retrieve="false"
> 
> 
>>3. call
>>brokerB.retrieveAllReferences(a);
>>to use the brokerB to retrieve the ClassB reference explicitely.
> 
> 
>>cheers,
>>Thomas
> 
> 
> 
> I am not sure if I mix something up and understand you right, but you 
> mentioned that this cannot be handled by OJB?
> 
> Dirk
> 
> 
> 
> -Ursprüngliche Nachricht-
> Von: Armin Waibel [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 18. Februar 2004 18:02
> An: OJB Users List
> Betreff: Re: auto... not possible when using multiple databases?
> 
> Hi Dirk,
> 
> Dirk Manske (Service Respond) wrote:
> 
>>Hi,
>>
>>for reference attributes you can declare auto-retrieve, auto-update 
>>and auto-delete to true in the respective descriptor. My question is:
>>Do I have to set these properties to false when using multiple 
>>databases and do all the work manually?
>>
> 
> 
> Why? These attributes has in effect nothing to do with multiple DB 
> connections (except see below).
> 
> But there are some pitfalls:
> - take care of ObjectCache when same classes used in different DB
> - if you need distributed tx, you have to run OJB in a managed 
> environment (JTA support)
> - say class A has a collection of B's and A should be stored in DB A, 
> all B's in DB B. OJB can't handle this for you internal (need of 
> distributed tx). Handle this on a higher level (in managed environment).
> In fact, then you have to disable the auto-XXX flags.
> 
> regards,
> Armin
> 
> 
>>Dirk
>>
>>
>>
>>
>>---

AW: auto... not possible when using multiple databases?

2004-02-18 Thread Dirk Manske (Service Respond)
Hi Armin,

I am using PB and do not need any distributed transactions. I asked this
question because I experience some difficulties with 1:N references where
one object is stored in db1 and the n objects are stored in db2. in this
case auto-retrieve="true" of course fails. but even when I try to get the
object from db1 and do a broker.retrieveAllReferences(object) it is not
working. But I guess this should work. In the mail-archives I found this
message from Thomas:

 >Can I store parts of an object in one DB and other parts in another? If
so,
> how do I
> then build the complete object during lookup?

>Say you have databases A and B. You also have two classes ClassA (mapped 
>to A) and ClassB (mapped to B).

>ClassA holds a reference to a ClassB object.

>now follow these steps:
>1. obtain two broker instances brokerA and brokerB working against the A 
>and B database respectively.

>2. call
>ClassA a = (ClassA) brokerA.getObjectByQuery(...);

>to load the instance a. To avoid automatic (and in this case wrong) 
>retrieval of the ClassB reference the respective reference-descriptor 
>must be set to auto-retrieve="false"

>3. call
>brokerB.retrieveAllReferences(a);
>to use the brokerB to retrieve the ClassB reference explicitely.

>cheers,
>Thomas


I am not sure if I mix something up and understand you right, but you
mentioned that this cannot be handled by OJB?

Dirk



-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 18. Februar 2004 18:02
An: OJB Users List
Betreff: Re: auto... not possible when using multiple databases?

Hi Dirk,

Dirk Manske (Service Respond) wrote:
> Hi,
> 
> for reference attributes you can declare auto-retrieve, auto-update 
> and auto-delete to true in the respective descriptor. My question is: 
> Do I have to set these properties to false when using multiple 
> databases and do all the work manually?
>

Why? These attributes has in effect nothing to do with multiple DB
connections (except see below).

But there are some pitfalls:
- take care of ObjectCache when same classes used in different DB
- if you need distributed tx, you have to run OJB in a managed environment
(JTA support)
- say class A has a collection of B's and A should be stored in DB A, all
B's in DB B. OJB can't handle this for you internal (need of distributed
tx). Handle this on a higher level (in managed environment). 
In fact, then you have to disable the auto-XXX flags.

regards,
Armin

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



auto... not possible when using multiple databases?

2004-02-18 Thread Dirk Manske (Service Respond)
Hi,

for reference attributes you can declare auto-retrieve, auto-update and
auto-delete to true in the respective descriptor. My question is: Do I have
to set these properties to false when using multiple databases and do all
the work manually?

Dirk 




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



Delete object in a 1:N assoc only with RemovalAwareCollection?

2004-02-16 Thread Dirk Manske (Service Respond)
Hi,

I am using PB API with DB2. I experience the phenomen that in a 1:N
association a N object is not being deleted. I do not use a
RemovalAwareCollection. Here is the scenario:

Table Activity and table Schedule are 1:N related. A user can delete a
specific schedule or all schedules of a particular activity object. If the
user selects a schedule to delete, the app retrieves the scheduleId and
scheduleObject from the DB. Then it simply deletes the object by
broker.delete(scheduleObject). So far it is only theory because the
scheduleObject remains in the DB. How to delete?

I could not find anything in the faqs. However, the testcases always use
RemovalAwareCollection. Can someone point out the concept behind this?

thx,
Dirk


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



Function sequence Error using DB2 UDB 7

2004-02-10 Thread Dirk Manske (Service Respond)
 Hi,

I am using OJB-PB and DB2 7.2. I deployed the web-app on two different
computer. At home, I use Db2 7 Personal Edition and everything works without
complains. At my company we have DB2 UDB 7 and I deployed the app there too.
However, when I try to do any database operation I get the following
exception:


Caused by: org.apache.ojb.broker.PersistenceBrokerSQLException:
COM.ibm.db2.jdbc.DB2Exception: [IBM] 
[CLI Driver] CLI0125E  Function sequence error. SQLSTATE=HY010 
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source) 
at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source)

at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown
Source) 
at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown
Source) 
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unkn
own Source) 
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknow
n Source) 
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source) 
... 50 more 
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0125E
Function sequence error. SQLST 
ATE=HY010 
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGe
nerator.java: 
250) 
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGe
nerator.java: 
193) 
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGen
erator.java:4 
32) 
at
COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java
:1124) 



Does anyone have a clue why this exception is being thrown?


for more information I provide an excerpt of the collection-descriptor:

 
 
-  


 


Dirk


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



AW: foreign key is not being updated...

2004-02-09 Thread Dirk Manske (Service Respond)
Wally you are a live saver!!! I just forgot to set the reference object
person in class activity. Now it works! thanks for your hint. 

-Ursprüngliche Nachricht-
Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 9. Februar 2004 15:27
An: OJB Users List
Betreff: RE: foreign key is not being updated...
Vertraulichkeit: Persönlich

Hi Dirk,

It looks like you are setting the FK and not the reference object.
Therefore, on an update, OJB is resolving and updating the FK of the set
reference object (null!).  If you want to continue setting the FK, you must
call pb.resolveReference("reference"); to set the object prior to the store
call.

Hope this helps,

Wally

-Original Message-----
From: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED]
Sent: Monday, February 09, 2004 5:38 AM
To: 'OJB Users List'
Subject: AW: foreign key is not being updated...
Sensitivity: Personal


I am still struggling to update a foreign key (see below). I try


pm.beginTransaction;

while(thereAreMoreSchedules){
schedule.set(startDate);
schedule.set(endDate);

activity.setTimestamp(...)
activity.setPersonId(personId); //1:N reference from person to
activity

schedule.set(activity); //1:N reference from schedule to activity

pm.store(schedule);
}

pm.commitTransaction;

pm.close();

On the first time and insert is done succesfully. When I try an update, only
the field timestamp is being updated, personId not. I can't believe, OJB
cannot handle this. Why is it not working

Dirk


 

-Ursprüngliche Nachricht-
Von: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 9. Februar 2004 02:12
An: 'OJB Users List'
Betreff: foreign key is not being updated...
Vertraulichkeit: Persönlich

Hi,

I am using the PB-API and struggle with update fk references in the db.

There are three tables Person --> Activity --> Schedule.
Person has a 1:N assoc to Activity. Activity has a 1:N assoc to Schedule.

While you plan the schedule you have to select a person which will be
assigned to the selected activity. For the first time, doing an insert works
well. If you want to change the person, an update fails. There is no error
message though, everything seems fine. I tested it by setting some values
and did an update to the db. All values had been updated, except the fk for
personid in table Activity. Here are the facts:

Activity holds a fk for table Person. Schedule holds a fk for table
Activity. The repository excerpt is as follows:




...










...

...















...








The pk's are primitive integers. I just store the collection
'allAssignedSchedules' in a while loop with broker.store(scheduleObject).
Again, this works well for all attributes except the fk of personId in table
Activity. I do not why. Does someone have an idea?

thx,
Dirk 


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



AW: foreign key is not being updated...

2004-02-09 Thread Dirk Manske (Service Respond)
I am still struggling to update a foreign key (see below). I try


pm.beginTransaction;

while(thereAreMoreSchedules){
schedule.set(startDate);
schedule.set(endDate);

activity.setTimestamp(...)
activity.setPersonId(personId); //1:N reference from person to
activity

schedule.set(activity); //1:N reference from schedule to activity

pm.store(schedule);
}

pm.commitTransaction;

pm.close();

On the first time and insert is done succesfully. When I try an update, only
the field timestamp is being updated, personId not. I can't believe, OJB
cannot handle this. Why is it not working

Dirk


 

-Ursprüngliche Nachricht-
Von: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 9. Februar 2004 02:12
An: 'OJB Users List'
Betreff: foreign key is not being updated...
Vertraulichkeit: Persönlich

Hi,

I am using the PB-API and struggle with update fk references in the db.

There are three tables Person --> Activity --> Schedule.
Person has a 1:N assoc to Activity. Activity has a 1:N assoc to Schedule.

While you plan the schedule you have to select a person which will be
assigned to the selected activity. For the first time, doing an insert works
well. If you want to change the person, an update fails. There is no error
message though, everything seems fine. I tested it by setting some values
and did an update to the db.
All values had been updated, except the
fk for personid in table Activity. Here are the facts:

Activity holds a fk for table Person. Schedule holds a fk for table
Activity. The repository excerpt is as follows:




...










...

...















...








The pk's are primitive integers. I just store the collection
'allAssignedSchedules' in a while loop with broker.store(scheduleObject).
Again, this works well for all attributes except the fk of personId in table
Activity. I do not why. Does someone have an idea?

thx,
Dirk 


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



foreign key is not being updated...

2004-02-08 Thread Dirk Manske (Service Respond)
Hi,

I am using the PB-API and struggle with update fk references in the db.

There are three tables Person --> Activity --> Schedule.
Person has a 1:N assoc to Activity. Activity has a 1:N assoc to Schedule.

While you plan the schedule you have to select a person which will be
assigned to the selected activity. For the first time,
doing an insert works well. If you want to change the person, an update
fails. There is no error message though, everything
seems fine. I tested it by setting some values and did an update to the db.
All values had been updated, except the
fk for personid in table Activity. Here are the facts:

Activity holds a fk for table Person. Schedule holds a fk for table
Activity. The repository excerpt is as follows:




...










...

...















...








The pk's are primitive integers. I just store the collection
'allAssignedSchedules' in a
while loop with broker.store(scheduleObject). Again, this works well for all
attributes except the fk of personId in
table Activity. I do not why. Does someone have an idea?

thx,
Dirk 


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



AW: How to setup this query with OJB-PB

2004-02-01 Thread Dirk Manske (Service Respond)
hi rob. 

your example does not work for me because I have no attribute 'schedule' in
table Activity, only an attribute 'activityId' in table schedule as fk.
However, your code inspired me so I was able to set it up by myself,
although I still use the IN query. thanks. 

-Ursprüngliche Nachricht-
Von: Coup, Robert Muir [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 1. Februar 2004 23:59
An: OJB Users List
Betreff: RE: How to setup this query with OJB-PB

Hi,

Minor assumption/clarification - you want to find all activities with no
schedules (where activities is on the 1 side and schedules are on the N
side). 

I'm struggling with something similar (only its nasty m:n) so you're in
luck:

crit.addIsNull("schedules.uid");// pk of
schedule
newQuery = QueryFactory.newQuery(Activity.class, crit, true);
newQuery.setPathOuterJoin("schedules"); // collection name as
declared in repository

This will effectively do a
  SELECT activity.*
  FROM activity LEFT OUTER JOIN schedule ON (activity.id =
schedule.activity_id)
  WHERE (schedule.id IS NULL)
Which should return what you want. Also much nicer/faster than an IN query.

Good luck,
Rob :)    

> -Original Message-
> From: Dirk Manske (Service Respond)
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, 2 February 2004 11:49 a.m.
> To: 'OJB Users List'
> Subject: How to setup this query with OJB-PB
> 
> 
> Hi,
> 
> I am using PB API and have two classes Activity and Schedule with 1:N 
> association. Both are declared in the repository-user.xml with a 
> collection-descriptor as reference.  Now I want to process a query 
> which results in a collection with all activities where no schedule 
> has been set. I have read the Query examples carefully but I just 
> don't get it. Could someone help me with the following sql statement:
> 
> SELECT * FROM Activity As act
> 
> WHERE act.ACTIVITY_ID NOT IN
> 
> (SELECT ACTIVITY_ID FROM SCHEDULE WHERE ACTIVITY_ID NOT NULL);
> 
> 
> Looks so simple, but I cannot figure it out. How to set up this 
> statement using the Criteria class?
> 
> Hope someone can help. thanks,
> 
> Dirk
> 
> 
> -
> 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]



How to setup this query with OJB-PB

2004-02-01 Thread Dirk Manske (Service Respond)
Hi,

I am using PB API and have two classes Activity and Schedule with 1:N
association. Both are declared in the repository-user.xml with a
collection-descriptor as reference.  Now I want to process a query which
results in a collection with all activities where no schedule has been set.
I have read the Query examples carefully but I just don't get it. Could
someone help me with the following sql statement:

SELECT * FROM Activity As act

WHERE act.ACTIVITY_ID NOT IN

(SELECT ACTIVITY_ID FROM SCHEDULE);


Looks so simple, but I cannot figure it out. How to set up this statement
using the Criteria class?

Hope someone can help. thanks,

Dirk


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



AW: exception: cannot request auto-commit state

2004-01-20 Thread Dirk Manske (Service Respond)
ok, I patched the current ConnectionManagerImpl  class. I already supposed a
timeout problem, but to see the first exception message will make things
clearer... thx.

Dirk

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 20. Januar 2004 18:08
An: OJB Users List
Betreff: Re: exception: cannot request auto-commit state

Hi Dirk,

[EMAIL PROTECTED] wrote:

> Hi,
> 
> I am using PB with DB2 7. auto-commit is set off and also declared in 
> the jdbc-connection descriptor. When I try to store/retrieve a object 
> I get the message that ojb cannot request autoCommit state on the
connection?
> This happens after some time the app is running. any idea?
> 

This exception was thrown by ConnectionManagerImpl class when try to read
the autoCommit state of current used connection. If an SQLException was
thrown while calling method con.getAutoCommit(), a
PersistenceBrokerException was thrown.
Unfortunately the first thrown SQLException was discard, so you don't see
the real problem behind this (maybe a used connection will become timed out
and DB doesn't support reconnect of timed out connections, ...) I checked in
a fix in CVS HEAD. Now you will see the underlying SQLException in stack
trace of PersistenceBrokerException.

regards,
Armin

> thx,
> Dirk
> 
> 
> org.apache.ojb.broker.PersistenceBrokerException:
org.apache.ojb.broker.PersistenceBrokerException:
> Cannot request autoCommit state on the connection
> at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
> at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
> at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
> at 
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionBy
> Query(Unknown Sourc
> e)
> at 
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionBy
> Query(Unknown Sourc
> e)
> at 
> de.premiere.plato.app.dao.ojb.OJBPBPersistenceManager.getLatestStoredO
> bject(Unknown Sourc
> e)
> at 
> de.premiere.plato.app.navigation.control.NavigationHandlerAction.getLa
> testStoredObject(Un
> known Source)
> at 
> de.premiere.plato.app.navigation.control.NavigationHandlerAction.compa
> reTimestamps(Unknow
> n Source)
> at
de.premiere.plato.app.navigation.control.NavigationHandlerAction.execute(Unk
nown Source)
> at 
> org.apache.struts.action.RequestProcessor.processActionPerform(Request
> Processor.java:484)
> 
> at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
> at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 
> 
> 
> 
> 
> 
> -
> 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]



AW: How to get a generated ID before an object is stored?

2004-01-18 Thread Dirk Manske (Service Respond)
so did I understand you right? If using  SequenceNativeImplManager, my
workaround is the only solution being available and when I want to have a
"little bit more comfort" with my id's I shall use
SequenceMangerNextValImpl? Or should one consider to always use
SequenceMangerNextValImpl when operating on a db2 with autoincrement?

greetz
Dirk

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 18. Januar 2004 23:57
An: OJB Users List
Betreff: Re: How to get a generated ID before an object is stored?

Hi Dirk,

Dirk Manske (Service Respond) wrote:

> Hi,
>  
> I am using PB with DB2 and autoincrement set on. OJB is setup with the 
> SequenceNativeImplManager. My question is, I know that there is a way 
> to retrieve an ID for an object before it gets stored!

yep, OJB use intern an unique Identity object for each pc object.

> I read it somewhere but
> - unfortunately - cannot find the source anymore.

Maybe in docs for SequenceManagerNativeImpl
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager

> I assume I have to use the
> class Identity? Any help is appreciated. My temporary workaround is to 
> store the object and retrieve it back immediately (with the oid), but 
> this seems not to be the best way...

It's the only way I know get the real UID of the Identity column. That's one
reason why I don't like Identity columns. As far as I know does DB2 also
supports database based sequence key generation (SequenceMangerNextValImpl).
This also guarantee the consistence of the data (when other applications as
OJB do operate on the DB) and has the advantage that we can request a unique
id before the object will be written to DB.

regards,
Armin

>  
> thx,
> Dirk
> 



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



How to get a generated ID before an object is stored?

2004-01-18 Thread Dirk Manske (Service Respond)
Hi,
 
I am using PB with DB2 and autoincrement set on. OJB is setup with the
SequenceNativeImplManager. My question is, I know that there is a way to
retrieve an ID for an object before it gets stored! I read it somewhere but
- unfortunately - cannot find the source anymore. I assume I have to use the
class Identity? Any help is appreciated. My temporary workaround is to store
the object and retrieve it back immediately (with the oid), but this seems
not to be the best way...
 
thx,
Dirk


AW: AW: AW: AW: AW: Two 1:N mappings to one table

2004-01-15 Thread Dirk Manske (Service Respond)
thank you both. you helped me a lot in understanding ojb. I'll give it a
try.

Dirk  

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 18:06
An: OJB Users List
Betreff: Re: AW: AW: AW: AW: Two 1:N mappings to one table

Hi Dirk,

if you use Identity columns from database you can't use the default
SequenceManager (SequenceManagerHighLowImpl). Have a look in
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager

 > can all do for me. In the repository-user.xml I set every pk column with
> primarykey="true" and autoincrement="true" for "declarative reasons",

When using SequenceManagerNativeImpl you have to set access="readonly" too.

regards,
Armin

Dirk Manske (Service Respond) wrote:

> hm. our db2 database tables are configured with an autoincrement for 
> the primary keys by default. (for exampl: activityId INTEGER NOT NULL 
> GENERATED BY DEFAULT AS IDENTITY (STARTS WITH 1, INCREMENT BY 1, NO 
> CACHE, PRIMARY KEY).  this is my first time using ojb. Meanwhile I get 
> aware of what ojb can all do for me. In the repository-user.xml I set 
> every pk column with primarykey="true" and autoincrement="true" for 
> "declarative reasons", because I thought OJB must get to know which 
> columns in db2 are set to pk's... Now I am wondering if the best 
> practice would be to set up the physical database with no pk's, fk's 
> etc at all and declare everything in the repository and let ojb control
it?
> 
> Furthermore I  already declared a high/low sequence manager in the 
> repository without actually knowing what I was doing (I copied it from 
> somewhere). So please could you tell me what happend behind the 
> scenes? I guess OJB generated an id and tried to store it with the 
> object but then,
> db2 overwrote the id via autoincrement. After the second store 
> operation, OJB looks for its generated id, cannot find it and stores 
> it as a new activity instead of updating it. hm. what would be the 
> best advised? I haven't asked yet but I am pretty sure that I am not 
> allowed to set autoincrement off in db2, because other apps might use 
> these tables as well...
> 
> -Ursprüngliche Nachricht-
> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 15. Januar 2004 16:44
> An: OJB Users List
> Betreff: Re: AW: AW: AW: Two 1:N mappings to one table
> 
> Ah hah! You are allowing DB2 to add the ID via a trigger, aren't you? 
> OJB doesn't play super nicely with the database doing that for it 
> behind the scenes, unfortunately. If you are allowed, try using one of 
> the OJB auto increment modules. I suggest the one that pulls from a db 
> sequence if that is what you are using in DB2 now. Basically it will 
> have OJB pull from the sequence and populate the id prior to the insert so
that OJB knows the id.
> 
> -Brian
> 
> On Jan 15, 2004, at 10:25 AM, Dirk Manske (Service Respond) wrote:
> 
> 
>>Unfortunately I cannot provide a testcase for this. But in general, 
>>after I stored the activity with pm.store(venture), the second 
>>operation
>>pm.store(person) should automagically update activity and not save it 
>>as a new entry, right? Or will it be only updated, if the activityId 
>>is known?
>>Because I use DB2 with autoincrement for pk's and therefore on the 
>>first store operation I have no id yet. hm. any idea?
>>
>>Dirk
>>
>>-Ursprüngliche Nachricht-
>>Von: Brian McCallister [mailto:[EMAIL PROTECTED]
>>Gesendet: Donnerstag, 15. Januar 2004 04:28
>>An: OJB Users List
>>Betreff: Re: AW: AW: Two 1:N mappings to one table
>>
>>Hmm, fun one. I suspect you may have run into the weird edge case.
>>
>>I don't have an immediate answer on this -- need to play and dig.
>>
>>Anyone else hit this before? Any chance you can create a unit test 
>>that demonstrates the behavior? If so send it to me and I'll check it 
>>in and dig in (or start prodding).
>>
>>-Brian
>>
>>On Jan 14, 2004, at 1:21 PM, Dirk Manske (Service Respond) wrote:
>>
>>
>>>Hi Brian,
>>>
>>>exactly. Due to copy & paste I assigned a wrong column to the 
>>>attribute activityId in class Person. But know I experience the 
>>>problem, that each created activity is stored twice (with different 
>>>id's). I mean, I know why, I add activity once to the 'person 
>>>collection' and to the 'venture collection' and do then
>>>pm.store(venture) and pm.store(person). I guess I have to follow a 
>>>different app

AW: AW: AW: AW: Two 1:N mappings to one table

2004-01-15 Thread Dirk Manske (Service Respond)
hm. our db2 database tables are configured with an autoincrement for the
primary keys by default. (for exampl: activityId INTEGER NOT NULL GENERATED
BY DEFAULT AS IDENTITY (STARTS WITH 1, INCREMENT BY 1, NO CACHE, PRIMARY
KEY).  this is my first time using ojb. Meanwhile I get aware of what ojb
can all do for me. In the repository-user.xml I set every pk column with
primarykey="true" and autoincrement="true" for "declarative reasons",
because I thought OJB must get to know which columns in db2 are set to
pk's... Now I am wondering if the best practice would be to set up the
physical database with no pk's, fk's etc at all and declare everything in
the repository and let ojb control it? 

Furthermore I  already declared a high/low sequence manager in the
repository without actually knowing what I was doing (I copied it from
somewhere). So please could you tell me what happend behind the scenes? I
guess OJB generated an id and tried to store it with the object but then,
db2 overwrote the id via autoincrement. After the second store operation,
OJB looks for its generated id, cannot find it and stores it as a new
activity instead of updating it. hm. what would be the best advised? I
haven't asked yet but I am pretty sure that I am not allowed to set
autoincrement off in db2, because other apps might use these tables as
well...

-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 16:44
An: OJB Users List
Betreff: Re: AW: AW: AW: Two 1:N mappings to one table

Ah hah! You are allowing DB2 to add the ID via a trigger, aren't you? 
OJB doesn't play super nicely with the database doing that for it behind the
scenes, unfortunately. If you are allowed, try using one of the OJB auto
increment modules. I suggest the one that pulls from a db sequence if that
is what you are using in DB2 now. Basically it will have OJB pull from the
sequence and populate the id prior to the insert so that OJB knows the id.

-Brian

On Jan 15, 2004, at 10:25 AM, Dirk Manske (Service Respond) wrote:

> Unfortunately I cannot provide a testcase for this. But in general, 
> after I stored the activity with pm.store(venture), the second 
> operation
> pm.store(person) should automagically update activity and not save it 
> as a new entry, right? Or will it be only updated, if the activityId 
> is known?
> Because I use DB2 with autoincrement for pk's and therefore on the 
> first store operation I have no id yet. hm. any idea?
>
> Dirk
>
> -Ursprüngliche Nachricht-
> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 15. Januar 2004 04:28
> An: OJB Users List
> Betreff: Re: AW: AW: Two 1:N mappings to one table
>
> Hmm, fun one. I suspect you may have run into the weird edge case.
>
> I don't have an immediate answer on this -- need to play and dig.
>
> Anyone else hit this before? Any chance you can create a unit test 
> that demonstrates the behavior? If so send it to me and I'll check it 
> in and dig in (or start prodding).
>
> -Brian
>
> On Jan 14, 2004, at 1:21 PM, Dirk Manske (Service Respond) wrote:
>
>> Hi Brian,
>>
>> exactly. Due to copy & paste I assigned a wrong column to the 
>> attribute activityId in class Person. But know I experience the 
>> problem, that each created activity is stored twice (with different 
>> id's). I mean, I know why, I add activity once to the 'person 
>> collection' and to the 'venture collection' and do then
>> pm.store(venture) and pm.store(person). I guess I have to follow a 
>> different approach?! Say, store first venture, then retrieve activity 
>> to store it with person? or how does it work?
>>
>> thx,
>> Dirk
>>
>> -Ursprüngliche Nachricht-
>> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
>> Gesendet: Mittwoch, 14. Januar 2004 18:33
>> An: OJB Users List
>> Betreff: Re: AW: Two 1:N mappings to one table
>>
>> It sounds like there is actually a problem in the mapping from class
>> -> table where the activityId is listed.
>>
>> Any chance you could post the full mapping for these classes, along 
>> with the database schema?
>>
>> -Brian
>>
>> On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:
>>
>>> Hi,
>>>
>>> yes, i am using pb.  Setting auto-retrieve="true" in the 
>>> collection-descriptor has not the desired effect, I still get the 
>>> following two strange error messages:
>>>
>>> within browser it shows a null pointer execption for Venture when it 
>>> tried to retrieve all venture objects associated with activ

AW: AW: AW: Two 1:N mappings to one table

2004-01-15 Thread Dirk Manske (Service Respond)
Unfortunately I cannot provide a testcase for this. But in general, after I
stored the activity with pm.store(venture), the second operation
pm.store(person) should automagically update activity and not save it as a
new entry, right? Or will it be only updated, if the activityId is known?
Because I use DB2 with autoincrement for pk's and therefore on the first
store operation I have no id yet. hm. any idea?

Dirk 

-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 04:28
An: OJB Users List
Betreff: Re: AW: AW: Two 1:N mappings to one table

Hmm, fun one. I suspect you may have run into the weird edge case.

I don't have an immediate answer on this -- need to play and dig.

Anyone else hit this before? Any chance you can create a unit test that
demonstrates the behavior? If so send it to me and I'll check it in and dig
in (or start prodding).

-Brian

On Jan 14, 2004, at 1:21 PM, Dirk Manske (Service Respond) wrote:

> Hi Brian,
>
> exactly. Due to copy & paste I assigned a wrong column to the 
> attribute activityId in class Person. But know I experience the 
> problem, that each created activity is stored twice (with different 
> id's). I mean, I know why, I add activity once to the 'person 
> collection' and to the 'venture collection' and do then 
> pm.store(venture) and pm.store(person). I guess I have to follow a 
> different approach?! Say, store first venture, then retrieve activity 
> to store it with person? or how does it work?
>
> thx,
> Dirk
>
> -Ursprüngliche Nachricht-
> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 14. Januar 2004 18:33
> An: OJB Users List
> Betreff: Re: AW: Two 1:N mappings to one table
>
> It sounds like there is actually a problem in the mapping from class 
> -> table where the activityId is listed.
>
> Any chance you could post the full mapping for these classes, along 
> with the database schema?
>
> -Brian
>
> On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:
>
>> Hi,
>>
>> yes, i am using pb.  Setting auto-retrieve="true" in the 
>> collection-descriptor has not the desired effect, I still get the 
>> following two strange error messages:
>>
>> within browser it shows a null pointer execption for Venture when it 
>> tried to retrieve all venture objects associated with activity and in 
>> the tomcat console I get a SQL Exception for class PERSON, state that 
>> activityId is not valid in the context where it is used (db2 database 
>> error message).
>>
>> When I set auto-retrieve="false" for PERSON in the 
>> reference-descriptor of class ACTIVITY, the venture objects are 
>> retrieved. no error message.
>> everything works fine, except - of course I have no person objects 
>> then.
>>
>> any idea?
>>
>> Dirk
>>
>>
>>
>>
>> -Ursprüngliche Nachricht-
>> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
>> Gesendet: Mittwoch, 14. Januar 2004 15:13
>> An: OJB Users List
>> Betreff: Re: Two 1:N mappings to one table
>>
>> Mapping to 1:N's to the same table is fine, heack mapping 1:N's form 
>> one class to itself multiple times works fine.
>>
>>  From looking at your configs I will venture that you are using the 
>> PB API and one of the collections isn't loading -- try setting 
>> auto-retrieve on the collections, or (these are exclusive) try using 
>> the ODMG API (which will retrieve them automagically)
>>
>> -Brian
>>
>> On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:
>>
>>> Hi,
>>>
>>> how can I map two tables with each having a 1:N relation to the same 
>>> table?
>>> I always get a null pointer exception for class Person.
>>>
>>> I have three tables:
>>>
>>> PERSON with a 1:N relation to ACTIVITY
>>>
>>> and
>>>
>>> VENTURE with a 1:N relation to ACTIVITY
>>>
>>> Table PERSON and VENTURE both references activityId from table 
>>> ACTIVITY. In the repository-user.xml for each table which relates to 
>>> ACTIVITY the collection-descriptor is setup
>>>
>>> for table VENTURE:
>>>
>>> >> name="allAssignedActivities"
>>> element-class-ref="de.plato.Activity"
>>> orderBy="activityId"
>>> sort="DESC"
>>> auto-update="true" >
>>>  
>>> 
>>>
>>> and for table PERSON:
>>>
>>> >> name="

AW: AW: Two 1:N mappings to one table

2004-01-14 Thread Dirk Manske (Service Respond)
Hi Brian,

exactly. Due to copy & paste I assigned a wrong column to the attribute
activityId in class Person. But know I experience the problem, that each
created activity is stored twice (with different id's). I mean, I know why,
I add activity once to the 'person collection' and to the 'venture
collection' and do then pm.store(venture) and pm.store(person). I guess I
have to follow a different approach?! Say, store first venture, then
retrieve activity to store it with person? or how does it work?

thx,
Dirk

-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 14. Januar 2004 18:33
An: OJB Users List
Betreff: Re: AW: Two 1:N mappings to one table

It sounds like there is actually a problem in the mapping from class ->
table where the activityId is listed.

Any chance you could post the full mapping for these classes, along with the
database schema?

-Brian

On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:

> Hi,
>
> yes, i am using pb.  Setting auto-retrieve="true" in the 
> collection-descriptor has not the desired effect, I still get the 
> following two strange error messages:
>
> within browser it shows a null pointer execption for Venture when it 
> tried to retrieve all venture objects associated with activity and in 
> the tomcat console I get a SQL Exception for class PERSON, state that 
> activityId is not valid in the context where it is used (db2 database 
> error message).
>
> When I set auto-retrieve="false" for PERSON in the 
> reference-descriptor of class ACTIVITY, the venture objects are 
> retrieved. no error message.
> everything works fine, except - of course I have no person objects 
> then.
>
> any idea?
>
> Dirk
>
>
>
>
> -Ursprüngliche Nachricht-
> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 14. Januar 2004 15:13
> An: OJB Users List
> Betreff: Re: Two 1:N mappings to one table
>
> Mapping to 1:N's to the same table is fine, heack mapping 1:N's form 
> one class to itself multiple times works fine.
>
>  From looking at your configs I will venture that you are using the PB 
> API and one of the collections isn't loading -- try setting 
> auto-retrieve on the collections, or (these are exclusive) try using 
> the ODMG API (which will retrieve them automagically)
>
> -Brian
>
> On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:
>
>> Hi,
>>
>> how can I map two tables with each having a 1:N relation to the same 
>> table?
>> I always get a null pointer exception for class Person.
>>
>> I have three tables:
>>
>> PERSON with a 1:N relation to ACTIVITY
>>
>> and
>>
>> VENTURE with a 1:N relation to ACTIVITY
>>
>> Table PERSON and VENTURE both references activityId from table 
>> ACTIVITY. In the repository-user.xml for each table which relates to 
>> ACTIVITY the collection-descriptor is setup
>>
>> for table VENTURE:
>>
>> > name="allAssignedActivities"
>> element-class-ref="de.plato.Activity"
>> orderBy="activityId"
>> sort="DESC"
>> auto-update="true" >
>>  
>>
>> and for table PERSON:
>>
>> > name="allAssignedActivities"
>> element-class-ref="de.plato.Activity"
>> orderBy="activityId"
>> sort="DESC"
>> auto-update="true" >
>>  
>>
>> for ACTIVITY, both tables are referenced:
>>
>> 
>> class-ref="de.plato.Person"
>> refresh="true"
>> auto-retrieve="true">
>> 
>>
>> and
>>
>>  class-ref="de.plato.Venture"
>> refresh="true"
>> auto-retrieve="true">
>> 
>>
>> Unfortunately, this does not work. What do I have to do?
>>
>> thx,
>> Dirk
>>
>>
>> -
>> 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]



AW: Two 1:N mappings to one table

2004-01-14 Thread Dirk Manske (Service Respond)
Hi,

yes, i am using pb.  Setting auto-retrieve="true" in the
collection-descriptor has not the desired effect, I still get the following
two strange error messages:

within browser it shows a null pointer execption for Venture when it tried
to retrieve all venture objects associated with activity and in the tomcat
console I get a
SQL Exception for class PERSON, state that activityId is not valid in the
context where it is used (db2 database error message).

When I set auto-retrieve="false" for PERSON in the reference-descriptor of
class ACTIVITY, the venture objects are retrieved. no error message.
everything works fine, except - of course I have no person objects then.

any idea?

Dirk 




-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 14. Januar 2004 15:13
An: OJB Users List
Betreff: Re: Two 1:N mappings to one table

Mapping to 1:N's to the same table is fine, heack mapping 1:N's form one
class to itself multiple times works fine.

 From looking at your configs I will venture that you are using the PB API
and one of the collections isn't loading -- try setting auto-retrieve on the
collections, or (these are exclusive) try using the ODMG API (which will
retrieve them automagically)

-Brian

On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:

> Hi,
>
> how can I map two tables with each having a 1:N relation to the same 
> table?
> I always get a null pointer exception for class Person.
>
> I have three tables:
>
> PERSON with a 1:N relation to ACTIVITY
>
> and
>
> VENTURE with a 1:N relation to ACTIVITY
>
> Table PERSON and VENTURE both references activityId from table 
> ACTIVITY. In the repository-user.xml for each table which relates to 
> ACTIVITY the collection-descriptor is setup
>
> for table VENTURE:
>
>  name="allAssignedActivities"
> element-class-ref="de.plato.Activity"
> orderBy="activityId"
> sort="DESC"
> auto-update="true" >
>  
>
> and for table PERSON:
>
>  name="allAssignedActivities"
> element-class-ref="de.plato.Activity"
> orderBy="activityId"
> sort="DESC"
> auto-update="true" >
>  
>
> for ACTIVITY, both tables are referenced:
>
> 
> class-ref="de.plato.Person"
> refresh="true"
> auto-retrieve="true">
> 
>
> and
>
> 
> class-ref="de.plato.Venture"
> refresh="true"
> auto-retrieve="true">
> 
>
> Unfortunately, this does not work. What do I have to do?
>
> thx,
> Dirk
>
>
> -
> 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]



Two 1:N mappings to one table

2004-01-13 Thread Dirk Manske
Hi,

how can I map two tables with each having a 1:N relation to the same table?
I always get a null pointer exception for class Person. 

I have three tables:

PERSON with a 1:N relation to ACTIVITY 

and

VENTURE with a 1:N relation to ACTIVITY

Table PERSON and VENTURE both references activityId from table ACTIVITY. In
the repository-user.xml for each table which relates to ACTIVITY the
collection-descriptor is setup 

for table VENTURE:





and for table PERSON:





for ACTIVITY, both tables are referenced:


class-ref="de.plato.Person"
refresh="true"
auto-retrieve="true">


and


class-ref="de.plato.Venture"
refresh="true"
auto-retrieve="true">


Unfortunately, this does not work. What do I have to do?

thx,
Dirk


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



Two 1:N mappings to one table

2004-01-13 Thread Dirk Manske
Hi,

how can I map two tables with each having a 1:N relation to the same table?
I always get a null pointer exception for class Person. 

I have three tables:

PERSON with a 1:N relation to ACTIVITY 

and

VENTURE with a 1:N relation to ACTIVITY

Table PERSON and VENTURE both references activityId from table ACTIVITY. In
the repository-user.xml for each table which relates to ACTIVITY the
collection-descriptor is setup 

for table VENTURE:





and for table PERSON:





for ACTIVITY, both tables are referenced:


class-ref="de.plato.Person"
refresh="true"
auto-retrieve="true">


and


class-ref="de.plato.Venture"
refresh="true"
auto-retrieve="true">


Unfortunately, this does not work. What do I have to do?

thx,
Dirk


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



AW: integrity constraint violation

2004-01-08 Thread Dirk Manske (Service Respond)
Hi Wally,

thanks for your response. Below you will find ddl and repository.
The relation is not defined as a non-decomposed m:n relation. And yes, I use
a primitive int to store the pk. Should I
give this special attention? For personId there is no reference-descriptor
defined as I have only read-access to this table
so OJB will never be forced to store data in it. that is why there is no
table TPPERSON in the repository. I am not sure if
this can work at all with OJB, I am just a newbie in this area. but, the
excpetion being thrown is an java.sql.SqlException and OJB passes it
through, so I begin thinking this has nothing to do with OJB. I am really
lost, hope you can help me.

Dirk



CREATE TABLE TPPERSON(
PERSON_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,
PERSON_VNAME CHAR(32),
PERSON_NNAME CHAR(32) ...);

CREATE TABLE TPACTIVITY (
ACTIVITY_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,
ACTIVITY_NAME CHAR(32) NOT NULL,
ACT_DEFERRABLE CHAR(3) NOT NULL,
MAN_HOURS INTEGER NOT NULL,
MILESTONE CHAR(3) NOT NULL,
ACTIVITY_TYPE_ID INTEGER NOT NULL,
PRIORITY_ID INTEGER NOT NULL,
PERSON_ID INTEGER,
VENTURE_ID INTEGER NOT NULL,
STATUS_ID INTEGER NOT NULL,
MODULE_ASSIGNED_ID INTEGER NOT NULL,
ACTIVITY_OWNER_ID INTEGER NOT NULL,
CREATION_DATE DATE NOT NULL,
VERSION_NR INTEGER NOT NULL,
VALID_FROM_TIMEPT TIMESTAMP NOT NULL,
VALID_TO_TIMEPT TIMESTAMP NOT NULL,
TIMESTAMP TIMESTAMP NOT NULL,
USERID CHAR(8) NOT NULL,
PROGRAM CHAR(32) NOT NULL,
ACTIVITY_DESC VARCHAR(254));

ALTER TABLE TPACTIVITY ADD CONSTRAINT FK_PERSON FOREIGN KEY (PERSON_ID)
REFERENCES TPPERSON(PERSON_ID);

ALTER TABLE TPACTIVITY ADD CONSTRAINT FK_MODULE_ASSIGNED FOREIGN KEY
(MODULE_ASSIGNED_ID) REFERENCES TMODULE(MODULE_ASSIGNED_ID)







  
  


  
  
  






 
  






 

-Ursprüngliche Nachricht-
Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 8. Januar 2004 15:40
An: OJB Users List
Betreff: RE: integrity constraint violation 
Vertraulichkeit: Persönlich

Hi Dirk,

Can you post the relevant DDL and repository?  Is the person-activity
relation defined as a non-decomposed m-n relation?  I suspect you have a
constraint set in the DDL that prevents the relation from being stored.  As
far as the 0 is concerned, do you use a primitive int or an Integer object
to store your PK?  If you use a primitive, a zero is the default value that
OJB will interpret as null.

Good luck,

Wally Gelhar
  
-Original Message-
From: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 4:54 AM
To: 'OJB Users List'
Subject: AW: integrity constraint violation
Sensitivity: Personal


Hi there,

can anyone give me a hint about my problem (see below)? if I have the
following two tables

*** *
* 
* Table PERSON  *
* Table ACTIVITY*
*-
* _0..1N_   * -
-   *
* personId INTEGER NOT NULL Identity Primary Key*
*  activityId INTEGER NOT NULL Identity Primary Key *
*   *
*  personId INTEGER (foreign key)   *

*...*

with a 0..1-to-many relation. both tables are empty. it should be possible
to create an activity and store it without assigning a person, right?!
However I get a violated constraint exception for table PEERSON, although I
did not setup any value for personId as no row exists in table person. after
traced the exception message I found out, that for the attribute person_id
OJB generated a 0 value and tries to store it and I just read in another
message that there is a 0-null problem for OJB. Am I facing exact this
problem?

help appreciated!

thx,
Dirk


 

-Ursprüngliche Nachricht-
Von: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 7. Januar 2004 18:56
An: [EMAIL PROTECTED]
Betreff: integrity constraint violation 



Hi,
 
I have got a problem with referential integrity. I am using OJB PB API with
HSQLDB and have set up a table 'person' with personId as primary key and a
second table 'activity' with this attribute as foreign key (null allowed).
the datatyp is integer and the association is 0..1 to many. 
 
It should be possible to store an activity and assign a person later to it.
however, when I try to store an activity I get the following exception:
 
org.apache.ojb.broker.

AW: integrity constraint violation

2004-01-08 Thread Dirk Manske (Service Respond)
Hi there,

can anyone give me a hint about my problem (see below)? if I have the
following two tables

*** *
* 
* Table PERSON  *
* Table ACTIVITY*
*-
* _0..1N_   * -
-   *
* personId INTEGER NOT NULL Identity Primary Key*
*  activityId INTEGER NOT NULL Identity Primary Key *
*   *
*  personId INTEGER (foreign key)   *

*...*

with a 0..1-to-many relation. both tables are empty. it should be possible
to create an activity and store it without assigning a person, right?!
However I get a violated constraint exception for table PEERSON, although I
did not setup any value for personId as no row exists in table person. after
traced the exception message I found out, that for the attribute person_id
OJB generated a 0 value and tries to store it and I just read in another
message that there is a 0-null problem for OJB. Am I facing exact this
problem?

help appreciated!

thx,
Dirk


 

-Ursprüngliche Nachricht-
Von: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 7. Januar 2004 18:56
An: [EMAIL PROTECTED]
Betreff: integrity constraint violation 



Hi,
 
I have got a problem with referential integrity. I am using OJB PB API with
HSQLDB and have set up a table 'person' with personId as primary key and a
second table 'activity' with this attribute as foreign key (null allowed).
the datatyp is integer and the association is 0..1 to many. 
 
It should be possible to store an activity and assign a person later to it.
however, when I try to store an activity I get the following exception:
 
org.apache.ojb.broker.KeyConstraintViolatedException 
java.sql.SqlException: integrity constraint violation for table 'person'.
What am I doing wrong?
 
thx,
Dirk
 


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



integrity constraint violation

2004-01-07 Thread Dirk Manske (Service Respond)
Hi,
 
I have got a problem with referential integrity. I am using OJB PB API with
HSQLDB and have set up a table 'person' with personId as primary key and a
second table 'activity' with this attribute as foreign key (null allowed).
the datatyp is integer and the association is 0..1 to many. 
 
It should be possible to store an activity and assign a person later to it.
however, when I try to store an activity I get the following exception:
 
org.apache.ojb.broker.KeyConstraintViolatedException 
java.sql.SqlException: integrity constraint violation for table 'person'.
What am I doing wrong?
 
thx,
Dirk
 


AW: AW: AW: how can i do multiple operations in one transaction?

2003-12-30 Thread Dirk Manske (Service Respond)
Hi Armin,

I solved the issue. It was indeed a second broker connection open... (was
hard to track...). Anyway, I posted the jdbc connection descriptor settings
and the source code. I should mention that we have a
PersistenceManagerFactory which will be called on web-app startup and
initializes a concrete PersistenceManager (in this case OJB-PB).  This
object is stored in servlet context and can be retrieved on request. The
source code reflects a 1:CN relationship between Activity and Module. Can
you advised me, is this the common approach I took or is there a better way?
thx, Dirk












   


source:

try{
pm.beginTransaction();

pm.storeObject(activityModel);
}
catch(Exception e){
//TODO catch-Klausel kommentieren
e.printStackTrace();

if(logger.isDebugEnabled())
logger.debug("INSERT Aktivität failed.");
}

//Attribute für TMODUL setzen
String moduleId =
((String)PropertyUtils.getSimpleProperty(form, "strModuleId"));

if(moduleId != null && !moduleId.equals("-1")){
try{
//Instanz von ActivityModel mit ActivityId
holen
object = pm.getObjectId(activityModel);
}
catch(Exception e){
//TODO catch-Klausel kommentieren
e.printStackTrace();

if(logger.isDebugEnabled())
logger.debug("ObjectId could not be
retrieved.");
}

if(object != null && object instanceof
ActivityModel){
activityModel = (ActivityModel)object;

//checkbox auswerten
String moduleExclusive =
((String)PropertyUtils.getSimpleProperty(form, "strModuleExclusive"));

if(moduleExclusive == null ||
moduleExclusive.length()<1)
moduleExclusive = "no";

moduleModel = new ModuleModel();


moduleModel.setIntModuleId(Integer.parseInt(moduleId));

moduleModel.setStrModuleExclusive(moduleExclusive);
moduleModel.setActivityModel(activityModel);

moduleModel.setValidFromTimepoint(activityModel.getValidFromTimepoint());
moduleModel.setVersionNr(0);

moduleModel.setValidToTimepoint(activityModel.getValidToTimepoint());

moduleModel.setTimestamp(activityModel.getTimestamp());

moduleModel.setStrUserId(activityModel.getStrUserId());

moduleModel.setStrProgram(Constant.PROGRAM_NAME);
}
}

try{
if(moduleModel != null){
pm.storeObject(moduleModel);
}

pm.commitTransaction();

pm.close();
}
catch(Exception e){
//TODO catch-Klausel kommentieren
e.printStackTrace();

pm.rollbackTransaction();

if(logger.isDebugEnabled())
logger.debug("INSERT Activity/Module failed.
Transaction rolled back.");

return
(mapping.findForward(Constant.DATABASE_ERROR_INSERT));
}
finally{
pm.close();
}
 

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 30. Dezember 2003 16:57
An: OJB Users List
Betreff: Re: AW: AW: how can i do multiple operations in one transaction?

more questions:

Armin Waibel wrote:

> Hi Dirk,
> 
> I can't believe that PB-api is the problem. Can you post a junit test 
> (or a modified test from test suite) to reproduce the problem?
> 
> What calculations you are doing, do you use the ConnectionManager?
> Do you set eager-release 'true' in jdbc-connection-descriptor?
> Do you use batch mode?
Could it be a multithreaded problem?
Do you lookup the PB instance twice in your code?

Armin

> 
> regards,
> Armin
> 
> Dirk Manske (Service Respond) wrote:
> 
>> Hi Armin,
>>
>> no, as ConnectionFactoryClass I use ConnectionFactoryPooledImpl. 
>> While the process runs there is only one OJB object (the pm object, 
>> see code
>> snippet)
>&

AW: ClassPersistenceNotCapableException: java.lang.Integer not found ...

2003-12-30 Thread Dirk Manske
Thanks Wally,

it is the information I was in desparate need. 

-Ursprüngliche Nachricht-
Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 29. Dezember 2003 21:22
An: OJB Users List
Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not
found ...
Vertraulichkeit: Persönlich

Hi Dirk,

ModuleModel should have an attribute of type ActivityModel.  This is the
attribute name the reference descriptor is looking for.  It also appears
that your package names do not correspond 

de.premiere.plato.app.activity.entity.ActivityModel !=
de.activity.entity.ActivityModel

I assume this is a C&P oversight.

Public class ModuleModel {
Integer intActivityIdFK;
ActivityModel activity;
...
}


 

Hope this helps.

Wally

-Original Message-
From: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED] On Behalf Of Dirk Manske
Sent: Monday, December 29, 2003 1:14 PM
To: 'OJB Users List'
Subject: AW: ClassPersistenceNotCapableException: java.lang.Integer not
found ...
Sensitivity: Personal


Thanks for your answer. When I change the reference name to   I get a
MetadataException which states that it can't find a member  in
de.plato.app.activity.entity.ModuleModel. Of course there is no member 
in this class since I declared all attributes already in the
class-descriptor. Any idea?

Dirk 


-Ursprüngliche Nachricht-
Von: João Vieira da Luz [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 29. Dezember 2003 19:51
An: 'OJB Users List'
Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not
found ...
Vertraulichkeit: Persönlich

I think your problem is in the name of the reference-descriptor it has the
same name that field 4. Try to change the name and I think it will work
fine.

-Original Message-
From: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED]
Sent: segunda-feira, 29 de Dezembro de 2003 18:43
To: [EMAIL PROTECTED]
Subject: ClassPersistenceNotCapableException: java.lang.Integer not found
...
Sensitivity: Personal

Hi,

Can someone tell me how to set a reference-descriptor for a foreign key?
Below is an excerpt of my repository-user.xml file. I always get the error
message: ClassPersistenceNotCapableException: java.lang.Integer not found in
repository.xml ... I have no clue what to do. Thx,

Dirk




 















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



AW: AW: how can i do multiple operations in one transaction?

2003-12-30 Thread Dirk Manske (Service Respond)
Hi Armin,

no, as ConnectionFactoryClass I use ConnectionFactoryPooledImpl. While the
process runs there is only one OJB object (the pm object, see code snippet)
and I do not use further data sources. All database operations are only
handled by PB.

greets,
Dirk
   

-Ursprüngliche Nachricht-
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 30. Dezember 2003 16:18
An: OJB Users List
Betreff: Re: AW: how can i do multiple operations in one transaction?

Hi Dirk,

hmm, this shouldn't be a problem. Do you use any connection object from OJB
while performing your test?
Do you use ConnectionFactoryManagedImpl in OJB.properties file as
ConnectionFactoryClass?
Do you use DataSource?

regards,
Armin

Dirk Manske (Service Respond) wrote:
> Hi Wally,
> 
> auto-commit is set to "2" = off. I still get an
> org.apache.ojb.broker.TransactionNotInProgressException: 
> ConnectionManager is NOT in transaction. This exception is thrown 
> after pm.commitTransaction() is executed. However, if I comment this 
> out, it runs well, both objects are stored. I really got stucked on this.
Any idea?
> 
> thx,
> Dirk
>   
> 
> -Ursprüngliche Nachricht-
> Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 30. Dezember 2003 05:07
> An: OJB Users List
> Betreff: RE: how can i do multiple operations in one transaction?
> 
> Hi Dirk,
> 
> PB transactions are database transactions (as opposed to the object 
> level transactions provided by ODMG, OTM, and JDO).  Check your 
> database connection descriptor to make sure you have autocommit turned 
> off.  I suspect that the JDBC connection is autocommiting the 
> transaction for you on the store operation.
> 
> Wally
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 29, 2003 6:27 PM
> To: [EMAIL PROTECTED]
> Subject: how can i do multiple operations in one transaction?
> 
> Hi,
> 
> I am using the PersistenceBroker (OJB 1.0 rc5) and have some problems 
> to store 2 objects within a single transaction. The problem is, that I 
> want to have the whole transaction comitted if and only if a 
> calculation between these two store operations has been successfull, 
> otherwise the first store operation will be rolled back.  Consider the 
> following code
> snippet:
> 
> try{
>pm = PersistenceBrokerFactory.defaultPersistenceBroker();
> 
>pm.beginTransaction();
>pm.store(object1);
> }
> catch ...
> 
> followed by some calculations then retrieve the first object to get 
> the id (which was set by OJB via autoincrement) ...
> 
> try{
>   pm.getObjectId(object1);
> }
> catch ...
> 
> follwed by another operation and if succeeded then store object2 and 
> finish the transaction:
> 
> try{
>   pm.store(object2);
>   pm.comitTransaction();
>   pm.close();
> }
> catch...
> 
> I always get a TransactionNotInProgressException. How can I solve this 
> problem?
> 
> thx,
> Dirk
> 
>   
> 
> 
> 
> 
> 
> 
> -
> 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]



AW: how can i do multiple operations in one transaction?

2003-12-30 Thread Dirk Manske (Service Respond)
Hi Wally,

auto-commit is set to "2" = off. I still get an
org.apache.ojb.broker.TransactionNotInProgressException: ConnectionManager
is NOT in transaction. This exception is thrown after pm.commitTransaction()
is executed. However, if I comment this out, it runs well, both objects are
stored. I really got stucked on this. Any idea?

thx,
Dirk
  

-Ursprüngliche Nachricht-
Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 30. Dezember 2003 05:07
An: OJB Users List
Betreff: RE: how can i do multiple operations in one transaction?

Hi Dirk,

PB transactions are database transactions (as opposed to the object level
transactions provided by ODMG, OTM, and JDO).  Check your database
connection descriptor to make sure you have autocommit turned off.  I
suspect that the JDBC connection is autocommiting the transaction for you on
the store operation.

Wally

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, December 29, 2003 6:27 PM
To: [EMAIL PROTECTED]
Subject: how can i do multiple operations in one transaction?

Hi,

I am using the PersistenceBroker (OJB 1.0 rc5) and have some problems to
store 2 objects within a single transaction. The problem is, that I want to
have the whole transaction comitted if and only if a calculation between
these two store operations has been successfull, otherwise the first store
operation will be rolled back.  Consider the following code
snippet:

try{
   pm = PersistenceBrokerFactory.defaultPersistenceBroker();

   pm.beginTransaction();
   pm.store(object1);
}
catch ...

followed by some calculations then retrieve the first object to get the id
(which was set by OJB via autoincrement) ...

try{
  pm.getObjectId(object1);
}
catch ...

follwed by another operation and if succeeded then store object2 and finish
the transaction:

try{
  pm.store(object2);
  pm.comitTransaction();
  pm.close();
}
catch...

I always get a TransactionNotInProgressException. How can I solve this
problem?

thx,
Dirk

  






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



AW: AW: ClassPersistenceNotCapableException: java.lang.Integer not found ...

2003-12-29 Thread Dirk Manske (Service Respond)
 Hi Edson,

 this information was exactly what I have been looking for. Now it is
working. Thanks a lot.

Dirk

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 29. Dezember 2003 20:59
An: OJB Users List
Betreff: Re: AW: ClassPersistenceNotCapableException: java.lang.Integer not
found ...

Look, as you defined



you can't have (or you will always get ClassCastException!!!)





But you can create an attribute intActivityIdFk (of type int) AND activityFk
(of type
ActivityModel) in your beean, and your class descriptor should be like (and
this should work
fine)

 













Best regards,

Edson Richter

> Thanks for your answer. When I change the reference name to   I 
> get a MetadataException which states that it can't find a member  
> in de.plato.app.activity.entity.ModuleModel. Of course there is no 
> member  in this class since I declared all attributes already in 
> the class-descriptor. Any idea?
>
> Dirk
>
>
> -Ursprüngliche Nachricht-
> Von: João Vieira da Luz [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 29. Dezember 2003 19:51
> An: 'OJB Users List'
> Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer 
> not found ...
> Vertraulichkeit: Persönlich
>
> I think your problem is in the name of the reference-descriptor it has 
> the same name that field 4. Try to change the name and I think it will 
> work fine.
>
> -Original Message-
> From: Dirk Manske (Service Respond)
> [mailto:[EMAIL PROTECTED]
> Sent: segunda-feira, 29 de Dezembro de 2003 18:43
> To: [EMAIL PROTECTED]
> Subject: ClassPersistenceNotCapableException: java.lang.Integer not 
> found ...
> Sensitivity: Personal
>
> Hi,
>
> Can someone tell me how to set a reference-descriptor for a foreign key?
> Below is an excerpt of my repository-user.xml file. I always get the 
> error
> message: ClassPersistenceNotCapableException: java.lang.Integer not 
> found in repository.xml ... I have no clue what to do. Thx,
>
> Dirk
>
>
>  table="TPACTIVITY" >
>jdbc-type="INTEGER" primarykey="true" autoincrement="true" />
>column="ACTIVITY_NAME"  jdbc-type="CHAR" /> 
>
>
> 
>column="MODUL_ASSIGNED_ID" jdbc-type="INTEGER" primarykey="true"
> autoincrement="true" />
>jdbc-type="INTEGER" />
>column="SIMULTAN_WORK" jdbc-type="CHAR" />
>jdbc-type="INTEGER" />
>
>   
> class-ref="de.premiere.plato.app.activity.entity.ActivityModel"
>   refresh="true"
>   auto-retrieve="true">
>   
>   
> 
>
>
> -
> 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]



AW: ClassPersistenceNotCapableException: java.lang.Integer not found ...

2003-12-29 Thread Dirk Manske
Thanks for your answer. When I change the reference name to   I get a
MetadataException which states that it can't find a member  in
de.plato.app.activity.entity.ModuleModel. Of course there is no member 
in this class since I declared all attributes already in the
class-descriptor. Any idea?

Dirk 


-Ursprüngliche Nachricht-
Von: João Vieira da Luz [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 29. Dezember 2003 19:51
An: 'OJB Users List'
Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not
found ...
Vertraulichkeit: Persönlich

I think your problem is in the name of the reference-descriptor it has the
same name that field 4. Try to change the name and I think it will work
fine.

-Original Message-----
From: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED]
Sent: segunda-feira, 29 de Dezembro de 2003 18:43
To: [EMAIL PROTECTED]
Subject: ClassPersistenceNotCapableException: java.lang.Integer not found
...
Sensitivity: Personal

Hi,

Can someone tell me how to set a reference-descriptor for a foreign key?
Below is an excerpt of my repository-user.xml file. I always get the error
message: ClassPersistenceNotCapableException: java.lang.Integer not found in
repository.xml ... I have no clue what to do. Thx,

Dirk




 















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



ClassPersistenceNotCapableException: java.lang.Integer not found ...

2003-12-29 Thread Dirk Manske (Service Respond)
Hi,

Can someone tell me how to set a reference-descriptor for a foreign key?
Below is an excerpt of my repository-user.xml file. I always get the error
message: ClassPersistenceNotCapableException: java.lang.Integer not found in
repository.xml ... I have no clue what to do. Thx,

Dirk




 















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



AW: Re: InitializerError + OJBRuntimeException

2003-12-28 Thread Dirk Manske
great! now, after some endless hours of (mis)configuration  OJB is set up.
... at least for PersistenceBroker. thanks!

-Ursprüngliche Nachricht-
Von: Coup, Robert Muir [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 23. Dezember 2003 20:37
An: OJB Users List
Betreff: RE: Re: InitializerError + OJBRuntimeException

Of course, this is OJB :)

OJB.properties location & name can be specified through a call to
System.setProperty("OJB.properties", ) before anything is done.
In the OJB.properties file you can specify the location and name of the
repository.xml file.

Have fun,
Rob :)


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, 24 December 2003 7:07 a.m.
To: [EMAIL PROTECTED]
Subject: Aw: Re: InitializerError + OJBRuntimeException


Hi Armin,

thanks for your hint. OJB.properties has not been on the classpath
indeed. Now it works. However, I do not feel very comfortable with so
many property files (ojb, repository.xml ...) on the classpath. Is there
another way, so I can store these files where ever I want in my web
application and reference them?

greets,
Dirk


- Original Nachricht 
Von: Armin Waibel <[EMAIL PROTECTED]>
An:  OJB Users List <[EMAIL PROTECTED]>
Datum:   23.12.2003 09:51
Betreff: Re: InitializerError + OJBRuntimeException

> Hi Dirk,
> 
>  > I am wondering about the OJBRuntimeExeception: what kind of 
> property
> key is
>  > missed?
> 
>  > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for 
> key  > 'PersistenceBrokerFactoryClass' can not be found in properties 
> file  > at 
> org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknow
> nSourc
> 
> 
> Seems OJB can't find OJB.properties file. Make sure that you include 
> all
> configuration files in classpath.
> 
> regards,
> Armin
> 
> Dirk Manske (mobil) wrote:
> > Hi,
> >  
> > I am new to OJB and get stuck with the following exception message:
> >  
> > java.lang.ExceptionInInitializerError
> >  at
> >
> org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroke
> r(Unkn
> 
> > own Source)
> >  at
> >
> de.premiere.plato.app.dao.ojb.OJBPBPersistenceManager.storeObject(OJBP
> BPersi
> 
> > stenceManager.java:159)
> >  at
> >
> de.premiere.plato.test.activity.control.TestDatabase.testStoreObject(T
> estDat
> 
> > abase.java:56)
> >  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> ava:39
> 
> > )
> >  at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> orImpl
> 
> > .java:25)
> >  at java.lang.reflect.Method.invoke(Method.java:324)
> >  at junit.framework.TestCase.runTest(TestCase.java:154)
> >  at junit.framework.TestCase.runBare(TestCase.java:127)
> >  at junit.framework.TestResult$1.protect(TestResult.java:106)
> >  at junit.framework.TestResult.runProtected(TestResult.java:124)
> >  at junit.framework.TestResult.run(TestResult.java:109)
> >  at junit.framework.TestCase.run(TestCase.java:118)
> >  at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >  at junit.framework.TestSuite.run(TestSuite.java:203)
> >  at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> TestRu
> 
> > nner.java:392)
> >  at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestR
> unner.
> 
> > java:276)
> >  at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> Runner
> 
> > .java:167)
> > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for 
> > key 'PersistenceBrokerFactoryClass' can not be found in properties 
> > file  at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknow
> n
> > Source)
> >  at
> >
> org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Un
> known
> > Source)
> >  ... 18 more
> >  
> >  
> > it happens after executing this method:
> > 
> > public void storeObject(Object object) throws 
> > PersistenceServiceException
> {
> > try{
> > broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
> > 
> > broker.store(object);
> > }
> > catch(Exception e){
> > //TODO Catch Klausel kommentieren
> > throw new PersistenceServiceException("storeObject
failed");
> > 
> > }
> > finally{
> > broker.close();
&g

InitializerError + OJBRuntimeException

2003-12-23 Thread Dirk Manske (mobil)
Hi,
 
I am new to OJB and get stuck with the following exception message:
 
java.lang.ExceptionInInitializerError
 at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
own Source)
 at
de.premiere.plato.app.dao.ojb.OJBPBPersistenceManager.storeObject(OJBPBPersi
stenceManager.java:159)
 at
de.premiere.plato.test.activity.control.TestDatabase.testStoreObject(TestDat
abase.java:56)
 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 junit.framework.TestCase.runTest(TestCase.java:154)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:392)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:276)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:167)
Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
'PersistenceBrokerFactoryClass' can not be found in properties file
 at org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown
Source)
 at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unknown
Source)
 ... 18 more
 
 
it happens after executing this method:

public void storeObject(Object object) throws PersistenceServiceException {
try{
broker =
PersistenceBrokerFactory.defaultPersistenceBroker();

broker.store(object);
}
catch(Exception e){
//TODO Catch Klausel kommentieren
throw new PersistenceServiceException("storeObject failed");

}
finally{
broker.close();
}
}

I am wondering about the OJBRuntimeExeception: what kind of property key is
missed?

thx,
Dirk
 


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



InitializerError + OJBRuntimeException

2003-12-22 Thread Dirk Manske (Service Respond)
Hi,
 
I am new to OJB and get stuck with the following exception message:
 
java.lang.ExceptionInInitializerError
 at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
own Source)  at
de.premiere.plato.app.dao.ojb.OJBPBPersistenceManager.storeObject(OJBPBPersi
stenceManager.java:159)
 at
de.premiere.plato.test.activity.control.TestDatabase.testStoreObject(TestDat
abase.java:56)
 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 junit.framework.TestCase.runTest(TestCase.java:154)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:392)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:276)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:167)
Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
'PersistenceBrokerFactoryClass' can not be found in properties file  at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(UnknownSourc
e)  at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unknown
Source)  ... 18 more
 
 
it happens after executing this method:

public void storeObject(Object object) throws PersistenceServiceException {
try{
broker =
PersistenceBrokerFactory.defaultPersistenceBroker();

broker.store(object);
}
catch(Exception e){ 
throw new PersistenceServiceException("storeObject failed");
}
finally{
broker.close();
}
}

I am wondering about the OJBRuntimeExeception: what kind of property key is
missed?

thx,
Dirk
 


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



DATABASE.OPEN causes TOMCAT to reload my web-application !?

2003-12-22 Thread Dirk Manske (Service Respond)
Hi,
 
I am trying to use OJB ODMG in a STRUTS application on TOMCAT 4.1.29. ODMG
and Database objects are setup at the start of the application via plug-in
and then both will be referenced from a business object for any database
manipulations. The startup processes without any complaints. When I follow a
link, the first jsp is shown though. After submit a form I encounter the
following ServletException:

javax.servlet.ServletExcpetion: Servlet.init() for servlet action threw
exception
at org.apache.catalina.core...
...
root cause:

java.lang.NoClassDefFoundError
at org.apache.ojb.broker.util.BrokerHelper.crossCheckPBKey(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersist
enceBroker(Unknown Source)
at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unkno
wn Source)
at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source)
at
de.premiere.plato.app.dao.ojb.OJBPersistenceService.initService(Unknown
Source)
at de.premiere.plato.app.dao.ojb.OJBPersistenceService.(Unknown
Source)
at
de.premiere.plato.app.dao.ojb.OJBPersistenceService.getOJBPersistenceService
(Unknown Source)
at
de.premiere.plato.app.dao.PersistenceFactory.createPersistenceService(Unknow
n Source)
at de.premiere.plato.plugin.PersistenceManagerPlugIn.init(Unknown
Source)
at
org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:
1158)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:210)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:666)
at java.lang.Thread.run(Thread.java:534)


After looking up the log files for TOMCAT and STRUTS I found out that my
STRUTS app got reloaded and everything has been re-initiliazed. I have no
clue what is wrong, do I miss a class? When I comment out
database.open("repository.xml", Database.OPEN_READ_WRITE); everything works
fine. 

Can anyone help? Thanks.

Dirk 




 


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