Re: How to shutdown OJB when stopping web context.

2005-03-24 Thread Danilo Tommasina
Hi,
we use following two calls to shut it down
  // Release all persistence broker instances
  PersistenceBrokerFactory.releaseAllInstances();
  // Release all pooled db connections
  
ConnectionFactoryFactory.getInstance().createConnectionFactory().releaseAllResources();
however it could be that the DBCP connection factory implementation in OJB 
1.0.1 does not closes the connections when calling the methods above.
I think Martin fixed this in OJB 1.0.2
danilo
Hi all,
I am looked through the source code, through the archives and searched the
OJB site http://db.apache.org/ojb/, but I can still not figure out how OJB
is shutdown.
We have a very serious problem with our connection pool at the moment. Part
of that is to do with the connection pool that OJB uses and how it is shut
down. At the moment when I stop our web application context through the
Tomcat Manager it shuts down cleanly. The application's connection pool
shutdown method is called and all connections are closed. The OJB connection
pool is leaving connections open. Once Tomcat is stopped all connections are
closed as indicated by the Database monitor.
I would like for all connections to be closed when our web context is
stopped. How can this be done for OJB?
Any help greatly appreciated.

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


Re: How to shutdown OJB when stopping web context.

2005-03-24 Thread Martin Kalén
Greetings all,
 first off - all the different hints of how not to leave open 
connections at webapp shutdown (ie using DBCP in Tomcat and supply JNDI 
DataSource to OJB, or explicitly calling release methods in OJB at 
shutdown) are equally good ways of doing.

Danilo Tommasina wrote:
however it could be that the DBCP connection factory implementation in 
OJB 1.0.1 does not closes the connections when calling the methods above.
I think Martin fixed this in OJB 1.0.2
That's correct. So if you are using DBCP as connection factory in 
OJB.properties, releaseAllResources will not close the connections in 
v1.0.1 or earlier.

Finally, for the sake of clarity: using a DBCP Connection pool in Tomcat 
and supplying a JNDI DataSource to OJB is not affected by this since the 
Connection management is then entirely left to Tomcat.

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


RE: How to shutdown OJB when stopping web context.

2005-03-24 Thread Nathan Smith
Thanks for all your very useful replys.

We do all closing of resources in the destroy() method of our setup servlet.

We use the ConnectionFactoryPooledImpl so releasing of the resources used
should work fine.

I would have like to have used the ConnectionFactoryDBCPImpl as that is what
is used for the rest of the application (We have a connection pool used by
OJB and a connection pool for native SQL queries).

I cannot quite remember what the problem was, but it had something to with
Iterators not returning all objects or Collections being returned containing
no objects, but that’s better left for another time at the moment.

Now all I have to do is work out where the connection leak is in the
application connection pool.

The connection pool implementation uses DBCP. The code is similar to other
implementations I have looked at and is based on the OJB version.

It looks as though the leak may be in the code, but I have already gone over
it to match up the use of getConnection() methods with recycleConnection()
methods. All recycles are in finally methods.

I thought that the leak may be occuring in the DBCP code when it is making
sure that the maxIdle value is met and the connection is somehow just not
referenced anymore.

When the web context is shutdown there are connections left open, which can
be seen in the Database monitor. Once Tomcat is shutdown all the leftover
connections are closed. The finalize() methods are being called by the GC,
which in turn closes the connections, I think.

Any more suggestions?



 -Original Message-
 From: Martin Kalén [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, 24 March 2005 8:56 p.m.
 To: OJB Users List
 Subject: Re: How to shutdown OJB when stopping web context.
 
 
 Greetings all,
 
   first off - all the different hints of how not to leave open 
 connections at webapp shutdown (ie using DBCP in Tomcat and 
 supply JNDI 
 DataSource to OJB, or explicitly calling release methods in OJB at 
 shutdown) are equally good ways of doing.
 
 Danilo Tommasina wrote:
  however it could be that the DBCP connection factory 
 implementation in
  OJB 1.0.1 does not closes the connections when calling the 
 methods above.
  I think Martin fixed this in OJB 1.0.2
 
 That's correct. So if you are using DBCP as connection factory in 
 OJB.properties, releaseAllResources will not close the connections in 
 v1.0.1 or earlier.
 
 Finally, for the sake of clarity: using a DBCP Connection 
 pool in Tomcat 
 and supplying a JNDI DataSource to OJB is not affected by 
 this since the 
 Connection management is then entirely left to Tomcat.
 
 Regards,
   Martin
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 




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



RE: Problem retrieving collection.

2005-03-24 Thread Lemke, Wesley
Is my assumption wrong?  In this case:

reference-descriptor name=clientRelationship
class-ref=model.client.ClientRelationship
foreignkey field-ref=objectId/
/reference-descriptor

Isn't objectId supposed to be the primary key field of
model.client.ClientRelationship?

-Original Message-
From: Lemke, Wesley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 1:23 PM
To: OJB Users List
Subject: RE: Problem retrieving collection.


When I change objectId to clientRelationshipId I get this error:  

org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]
rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
s_of_Items=class model.client.NewClientGroup] for class-descriptor
'model.client.ClientRelationship'

objectId is the pk of all our persistent classes (they all extend
AdmObject which contains objectId).  I was under the impression that the
forignkey element should have the pk of the referenced class.  In this
case NewClientGroup has a reference to ClientRelationship, and the pk of
ClientRelationship is objectId.  clientRelationshipId is a field in
NewClientGroup that has the pk of it's parent ClientRelationship (I
don't have clientRelationshipId as anonymous below...I've been switching
back and forth on that one).  


-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 12:27 PM
To: OJB Users List
Subject: Re: Problem retrieving collection.


Hi again,

change

foreignkey field-ref=objectId/

to

foreignkey field-ref=clientRelationshipId/

in

reference-descriptor name=clientRelationship
class-ref=model.client.ClientRelationship
foreignkey field-ref=objectId/
/reference-descriptor

of class NewClientGroup.

regards,
Armin


Lemke, Wesley wrote:
 I apologize for sending so many messages to the list, but this one
 really has me scratching my head.  Here is the data stored in the
 database:
 
 mysql select group_id, client_id, name, parent_id, class_name from
 client_group;
 +--+---+-+---+
 +--+---+-+---+--
 ---+
 | group_id | client_id | name| parent_id | class_name
 |
 +--+---+-+---+
 +--+---+-+---+--
 ---+
 |1 | 1 | First Client Group  |  NULL |
 model.client.NewClientGroup |
 |4 | 1 | Second Client Group |  NULL |
 model.client.NewClientGroup |
 +--+---+-+---+
 +--+---+-+---+--
 ---+
 2 rows in set (0.00 sec)
 
 mysql select * from client;
 +---+--++
 | client_id | agr_approver | last_modified_user |
 +---+--++
 | 1 | Zeus | N0079911   |
 +---+--++
 1 row in set (0.01 sec)
 
 Here is my mapping (It worked fine for storing the items):
 
 class-descriptor
   class=model.AdmObject
   extent-class class-ref=model.client.ClientRelationship /
   extent-class class-ref=model.client.GenericGroup /
 /class-descriptor
 
 class-descriptor
   class=model.client.GenericGroup
   extent-class class-ref=model.client.NewClientGroup /
 /class-descriptor
 
 class-descriptor
   class=model.client.ClientRelationship
   table=client
 field-descriptor
 name=objectId
 column=client_id
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
 access=readonly
 /
 field-descriptor
   name=nameOfApproverOfNoContract
   column=agr_approver
   jdbc-type=VARCHAR
   /  
   collection-descriptor
   name=clientGroups
   element-class-ref=model.client.NewClientGroup
   auto-delete=true
   auto-update=true
   
   inverse-foreignkey field-ref=clientRelationshipId /
   /collection-descriptor
 /class-descriptor
 
 class-descriptor
   class=model.client.NewClientGroup
   table=client_group
   field-descriptor
   name=objectId
   column=group_id
   jdbc-type=INTEGER
   primarykey=true
   autoincrement=true
   access=readonly
   /
   field-descriptor
   name=clientRelationshipId
   column=client_id
   jdbc-type=INTEGER
   /  
   field-descriptor
   name=name
   column=NAME
   jdbc-type=VARCHAR
   /
   field-descriptor
   name=ojbConcreteClass
   column=CLASS_NAME
   jdbc-type=VARCHAR
   /
   reference-descriptor 

Re: Problem retrieving collection.

2005-03-24 Thread Armin Waibel
Hi Wes,
 Is my assumption wrong?  In this case:

 reference-descriptor name=clientRelationship
 class-ref=model.client.ClientRelationship
foreignkey field-ref=objectId/
 /reference-descriptor

 Isn't objectId supposed to be the primary key field of
 model.client.ClientRelationship?
sorry I'm a little confused after all the posts to this thread. Could 
you please post the class hierarchy (with all (important) fields of the 
classes, no get/setter) and the actual mapping of the classes again.

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


RE: Problem retrieving collection.

2005-03-24 Thread Gelhar, Wallace Joseph
No.  OJB currently only joins on the related object primary key (which
it already knows from the mapping), so what is needed is the foreign key
field in NewClientGroup that relates to ClientRelationship.

Remember that in Reference or Collection Descriptors it is always
looking for the foreign key.

Hope this helps.


-Original Message-
From: Lemke, Wesley [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 8:01 AM
To: OJB Users List
Subject: RE: Problem retrieving collection.

Is my assumption wrong?  In this case:

reference-descriptor name=clientRelationship
class-ref=model.client.ClientRelationship
foreignkey field-ref=objectId/
/reference-descriptor

Isn't objectId supposed to be the primary key field of
model.client.ClientRelationship?

-Original Message-
From: Lemke, Wesley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 23, 2005 1:23 PM
To: OJB Users List
Subject: RE: Problem retrieving collection.


When I change objectId to clientRelationshipId I get this error:  

org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]
rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
s_of_Items=class model.client.NewClientGroup] for class-descriptor
'model.client.ClientRelationship'

objectId is the pk of all our persistent classes (they all extend
AdmObject which contains objectId).  I was under the impression that the
forignkey element should have the pk of the referenced class.  In this
case NewClientGroup has a reference to ClientRelationship, and the pk of
ClientRelationship is objectId.  clientRelationshipId is a field in
NewClientGroup that has the pk of it's parent ClientRelationship (I
don't have clientRelationshipId as anonymous below...I've been switching
back and forth on that one).  


-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 12:27 PM
To: OJB Users List
Subject: Re: Problem retrieving collection.


Hi again,

change

foreignkey field-ref=objectId/

to

foreignkey field-ref=clientRelationshipId/

in

reference-descriptor name=clientRelationship
class-ref=model.client.ClientRelationship
foreignkey field-ref=objectId/
/reference-descriptor

of class NewClientGroup.

regards,
Armin


Lemke, Wesley wrote:
 I apologize for sending so many messages to the list, but this one
 really has me scratching my head.  Here is the data stored in the
 database:
 
 mysql select group_id, client_id, name, parent_id, class_name from
 client_group;
 +--+---+-+---+
 +--+---+-+---+--
 ---+
 | group_id | client_id | name| parent_id | class_name
 |
 +--+---+-+---+
 +--+---+-+---+--
 ---+
 |1 | 1 | First Client Group  |  NULL |
 model.client.NewClientGroup |
 |4 | 1 | Second Client Group |  NULL |
 model.client.NewClientGroup |
 +--+---+-+---+
 +--+---+-+---+--
 ---+
 2 rows in set (0.00 sec)
 
 mysql select * from client;
 +---+--++
 | client_id | agr_approver | last_modified_user |
 +---+--++
 | 1 | Zeus | N0079911   |
 +---+--++
 1 row in set (0.01 sec)
 
 Here is my mapping (It worked fine for storing the items):
 
 class-descriptor
   class=model.AdmObject
   extent-class class-ref=model.client.ClientRelationship /
   extent-class class-ref=model.client.GenericGroup /
 /class-descriptor
 
 class-descriptor
   class=model.client.GenericGroup
   extent-class class-ref=model.client.NewClientGroup /
 /class-descriptor
 
 class-descriptor
   class=model.client.ClientRelationship
   table=client
 field-descriptor
 name=objectId
 column=client_id
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
 access=readonly
 /
 field-descriptor
   name=nameOfApproverOfNoContract
   column=agr_approver
   jdbc-type=VARCHAR
   /  
   collection-descriptor
   name=clientGroups
   element-class-ref=model.client.NewClientGroup
   auto-delete=true
   auto-update=true
   
   inverse-foreignkey field-ref=clientRelationshipId /
   /collection-descriptor
 /class-descriptor
 
 class-descriptor
   class=model.client.NewClientGroup
   table=client_group
   field-descriptor
   name=objectId
   column=group_id
   jdbc-type=INTEGER
   primarykey=true
 

RE: Problem retrieving collection.

2005-03-24 Thread Lemke, Wesley
No problem.  I think this is everything needed:

package model;
// All persistent Object extend this class, the unique object ID
// is from this class along with some other fields
public class AdmObject implements Serializable{

private int objectId = -1;
// A few other fields, removed for simplification
}

package model.client;
// Abstract class that NewClientGroup and Subgroup extend.
// Both NewClientGroup and Subgroup are stored in the 
// client_group table.
public abstract class GenericGroup extends AdmObject {

private String name;
// A few other fields, removed for simplification
private String ojbConcreteClass;
}

package model.client;
// Contains Collection of NewClientGroups.
// Persisted in client.
public class ClientRelationship extends AdmObject {

private String nameOfApproverOfNoContract;
private List clientGroups = new ArrayList();***
}

package model.client;
// One of two classes that extend GenericGroup.
// Contains collection of Subgroups and reference
// to ClientRelationship
// Persisted in client_group.
public class NewClientGroup extends GenericGroup {

// A few other fields, removed for simplification
private List subgroups = new ArrayList();***
private ClientRelationship clientRelationship;
}

***The problem occurs when retrieving the clientGroups collection from
ClientRelationship.  I am having the same problem when retrieving the
subgroups collection from NewClientGroup, but I'll leave that part out
to simplify the problem.

Here are the class descriptors:

class-descriptor
class=model.AdmObject
extent-class class-ref=model.client.ClientRelationship /
extent-class class-ref=model.client.GenericGroup /
/class-descriptor

class-descriptor
class=model.client.GenericGroup
extent-class class-ref=model.client.NewClientGroup /
/class-descriptor

class-descriptor
class=model.client.ClientRelationship
table=client
field-descriptor
name=objectId
column=client_id
jdbc-type=INTEGER
primarykey=true
autoincrement=true
access=readonly
/
field-descriptor
name=nameOfApproverOfNoContract
column=agr_approver
jdbc-type=VARCHAR
/  
collection-descriptor
name=clientGroups
element-class-ref=model.client.NewClientGroup
auto-delete=true
auto-update=true

inverse-foreignkey field-ref=clientRelationshipId /
/collection-descriptor
/class-descriptor

class-descriptor
class=model.client.NewClientGroup
table=client_group
field-descriptor
name=objectId
column=group_id
jdbc-type=INTEGER
primarykey=true
autoincrement=true
access=readonly
/
field-descriptor
name=clientRelationshipId
column=client_id
jdbc-type=INTEGER
access=anonymous
/  
field-descriptor
name=name
column=NAME
jdbc-type=VARCHAR
/
field-descriptor
name=ojbConcreteClass
column=CLASS_NAME
jdbc-type=VARCHAR
/
reference-descriptor name=clientRelationship
class-ref=model.client.ClientRelationship
foreignkey field-ref=clientRelationshipId/
/reference-descriptor 
/class-descriptor

The objects persist fine.  Here is the data in the tables after a store:

mysql select * from client;
+---+--++
| client_id | agr_approver | last_modified_user |
+---+--++
| 1 | Zeus | NULL   |
+---+--++
1 row in set (0.00 sec)

mysql select group_id, client_id, name, parent_id, class_name from
client_group;
+--+---+-+---+--
---+
| group_id | client_id | name| parent_id | class_name
|
+--+---+-+---+--
---+
|1 | 1 | First Client Group  |  NULL |
model.client.NewClientGroup |
|2 | 1 | Second Client Group |  NULL |
model.client.NewClientGroup |
+--+---+-+---+--
---+
2 rows in set (0.00 sec)

When I try to retrieve an object, this is the error I get:

Error 500: Server caught unhandled exception from servlet
[servlets.InheritanceServlet]:
org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]

Re: Problem retrieving collection.

2005-03-24 Thread Armin Waibel
Hi Wes,
comments see below
Lemke, Wesley wrote:
No problem.  I think this is everything needed:
package model;
// All persistent Object extend this class, the unique object ID
// is from this class along with some other fields
public class AdmObject implements Serializable{

private int objectId = -1;
// A few other fields, removed for simplification
}
package model.client;
// Abstract class that NewClientGroup and Subgroup extend.
// Both NewClientGroup and Subgroup are stored in the 
// client_group table.
public abstract class GenericGroup extends AdmObject {

private String name;
// A few other fields, removed for simplification
private String ojbConcreteClass;
}

package model.client;
// Contains Collection of NewClientGroups.
// Persisted in client.
public class ClientRelationship extends AdmObject {
private String nameOfApproverOfNoContract;
private List clientGroups = new ArrayList();***
}
package model.client;
// One of two classes that extend GenericGroup.
// Contains collection of Subgroups and reference
// to ClientRelationship
// Persisted in client_group.
public class NewClientGroup extends GenericGroup {
// A few other fields, removed for simplification
private List subgroups = new ArrayList();***
private ClientRelationship clientRelationship;
}
***The problem occurs when retrieving the clientGroups collection from
ClientRelationship.  I am having the same problem when retrieving the
subgroups collection from NewClientGroup, but I'll leave that part out
to simplify the problem.
Here are the class descriptors:
class-descriptor
class=model.AdmObject
extent-class class-ref=model.client.ClientRelationship /
extent-class class-ref=model.client.GenericGroup /
/class-descriptor
class-descriptor
class=model.client.GenericGroup
extent-class class-ref=model.client.NewClientGroup /
/class-descriptor
class-descriptor
	class=model.client.ClientRelationship
	table=client
field-descriptor
name=objectId
column=client_id
jdbc-type=INTEGER
primarykey=true
autoincrement=true
access=readonly
/
field-descriptor
	name=nameOfApproverOfNoContract
	column=agr_approver
	jdbc-type=VARCHAR
	/	
 	collection-descriptor
 		name=clientGroups
 		element-class-ref=model.client.NewClientGroup
 		auto-delete=true
 		auto-update=true
 	
 		inverse-foreignkey field-ref=clientRelationshipId /
 	/collection-descriptor
/class-descriptor

class-descriptor
class=model.client.NewClientGroup
table=client_group
field-descriptor
name=objectId
column=group_id
jdbc-type=INTEGER
primarykey=true
autoincrement=true
access=readonly
/
field-descriptor
name=clientRelationshipId
column=client_id
jdbc-type=INTEGER
access=anonymous
/   
Field clientRelationshipId was used by a 1:n relationship, so using an 
anonymous key can be problematic. See
http://db.apache.org/ojb/docu/guides/advanced-technique.html#How+do+

Try to make this field a normal field in NewClientGroup. If you using 
PersistentFieldDirectAccessImplNew as PersistentField implementation in 
OJB.properties file (default setting), no get/setter needed.

The error message is strange I can't find a typo or incorrect mapping.
Armin

field-descriptor
name=name
column=NAME
jdbc-type=VARCHAR
/
field-descriptor
name=ojbConcreteClass
column=CLASS_NAME
jdbc-type=VARCHAR
/
reference-descriptor name=clientRelationship
class-ref=model.client.ClientRelationship
foreignkey field-ref=clientRelationshipId/
/reference-descriptor   
/class-descriptor
The objects persist fine.  Here is the data in the tables after a store:
mysql select * from client;
+---+--++
| client_id | agr_approver | last_modified_user |
+---+--++
| 1 | Zeus | NULL   |
+---+--++
1 row in set (0.00 sec)
mysql select group_id, client_id, name, parent_id, class_name from
client_group;
+--+---+-+---+--
---+
| group_id | client_id | name| parent_id | class_name
|
+--+---+-+---+--
---+
|1 | 1 | First Client Group  |  NULL |
model.client.NewClientGroup |
|2 | 1 | Second Client Group |  NULL |
model.client.NewClientGroup |

RE: Problem retrieving collection.

2005-03-24 Thread Lemke, Wesley
I added the (int) clientRelationshipId to NewClientGroup and removed the
access=anonymous from the field-descriptor.  I am still getting the
same error.

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 9:04 AM
To: OJB Users List
Subject: Re: Problem retrieving collection.


Hi Wes,

comments see below

Lemke, Wesley wrote:
 No problem.  I think this is everything needed:
 
 package model;
 // All persistent Object extend this class, the unique object ID // is

 from this class along with some other fields public class AdmObject 
 implements Serializable{
   
   private int objectId = -1;
   // A few other fields, removed for simplification
 }
 
 package model.client;
 // Abstract class that NewClientGroup and Subgroup extend.
 // Both NewClientGroup and Subgroup are stored in the
 // client_group table.
 public abstract class GenericGroup extends AdmObject {
 
   private String name;
   // A few other fields, removed for simplification
   private String ojbConcreteClass;
 }
   
 package model.client;
 // Contains Collection of NewClientGroups.
 // Persisted in client.
 public class ClientRelationship extends AdmObject {
 
   private String nameOfApproverOfNoContract;
   private List clientGroups = new ArrayList();***
 }
 
 package model.client;
 // One of two classes that extend GenericGroup.
 // Contains collection of Subgroups and reference
 // to ClientRelationship
 // Persisted in client_group.
 public class NewClientGroup extends GenericGroup {
 
   // A few other fields, removed for simplification
   private List subgroups = new ArrayList();***
   private ClientRelationship clientRelationship;
 }
 
 ***The problem occurs when retrieving the clientGroups collection from

 ClientRelationship.  I am having the same problem when retrieving the 
 subgroups collection from NewClientGroup, but I'll leave that part out

 to simplify the problem.
 
 Here are the class descriptors:
 
 class-descriptor
   class=model.AdmObject
   extent-class class-ref=model.client.ClientRelationship /
   extent-class class-ref=model.client.GenericGroup / 
 /class-descriptor
 
 class-descriptor
   class=model.client.GenericGroup
   extent-class class-ref=model.client.NewClientGroup / 
 /class-descriptor

 class-descriptor
   class=model.client.ClientRelationship
   table=client
 field-descriptor
 name=objectId
 column=client_id
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
 access=readonly
 /
 field-descriptor
   name=nameOfApproverOfNoContract
   column=agr_approver
   jdbc-type=VARCHAR
   /  
   collection-descriptor
   name=clientGroups
   element-class-ref=model.client.NewClientGroup
   auto-delete=true
   auto-update=true
   
   inverse-foreignkey field-ref=clientRelationshipId /
   /collection-descriptor
 /class-descriptor
 
 class-descriptor
   class=model.client.NewClientGroup
   table=client_group
   field-descriptor
   name=objectId
   column=group_id
   jdbc-type=INTEGER
   primarykey=true
   autoincrement=true
   access=readonly
   /
   field-descriptor
   name=clientRelationshipId
   column=client_id
   jdbc-type=INTEGER
   access=anonymous
   /  

Field clientRelationshipId was used by a 1:n relationship, so using an

anonymous key can be problematic. See
http://db.apache.org/ojb/docu/guides/advanced-technique.html#How+do+

Try to make this field a normal field in NewClientGroup. If you using 
PersistentFieldDirectAccessImplNew as PersistentField implementation in 
OJB.properties file (default setting), no get/setter needed.

The error message is strange I can't find a typo or incorrect mapping.

Armin


   field-descriptor
   name=name
   column=NAME
   jdbc-type=VARCHAR
   /
   field-descriptor
   name=ojbConcreteClass
   column=CLASS_NAME
   jdbc-type=VARCHAR
   /
   reference-descriptor name=clientRelationship 
 class-ref=model.client.ClientRelationship
   foreignkey field-ref=clientRelationshipId/
   /reference-descriptor 
 /class-descriptor
 
 The objects persist fine.  Here is the data in the tables after a 
 store:
 
 mysql select * from client;
 +---+--++
 | client_id | agr_approver | last_modified_user |
 +---+--++
 | 1 | Zeus | NULL   |
 +---+--++
 1 row in set (0.00 sec)
 
 mysql select group_id, client_id, name, parent_id, class_name from
 client_group;
 

Re: How to shutdown OJB when stopping web context.

2005-03-24 Thread Martin Kaln
Nathan Smith wrote:
I cannot quite remember what the problem was, but it had something to with
Iterators not returning all objects or Collections being returned containing
no objects, but thats better left for another time at the moment.
Aha, this smells like objects of class OJBIterator returned when using 
PB-API and report-queries or iterating Collections that are using proxy 
objects in OJB.

In OJB 1.0.x the API will specify Iterator as return type so you have to 
do a somewhat ugly cast to (OJBIterator) and call #releaseDbResources() 
if you want to free resources from unexhausted [*] iterators before 
#finalize() and auto-release.

[*] You can also exhaust the iterator by always iterating to the end, 
which will also trigger a fast release of any DB-resources (including 
ResultSet and thus implicitly Connection) when the iterator reaches the end.

It could be because of constructs like:
while (ojbiter.hasNext()) {
ojbiter.next();
if (condition) {
break out; == late release, did not exhaust iterator
}
}
Or:
ojbiter = broker.getReportQueryIteratorByCriteria(crit);
Object onlyOneExpected = ojbiter.next();
// late release, did not exhaust iterator
If you are using Oracle it should become obvious very fast if you have 
delayed release of resources in some Iterator objects, as this will keep 
the Oracle server-side cursors allocated and you will very fast get an 
SQLException with MAX_CURSORS_EXCEEDED.

Any more suggestions?
You could also try using the abandoned-config in DBCP and set a very 
short threshold time to log connection leaks, although it's difficult to 
say what the threshold should be if you really want to hold on to some 
connections a bit longer.

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


Re: Problem retrieving collection.

2005-03-24 Thread Armin Waibel
Lemke, Wesley wrote:
I added the (int) clientRelationshipId to NewClientGroup and removed the
access=anonymous from the field-descriptor.  I am still getting the
same error.
Damned! What a nasty problem ;-)
The error message seems to be clear
Error 500: Server caught unhandled exception from servlet
[servlets.InheritanceServlet]:
org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]
rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
s_of_Items=class model.client.NewClientGroup] for class-descriptor
'model.client.ClientRelationship'
When OJB lookup the field 'clientRelationshipId' it's not found in 
'model.client.ClientRelationship' class-descriptor.

Do your application really use the new mapping files, do you manipulate 
OJB metadata at runtime?

regards,
Armin

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 9:04 AM
To: OJB Users List
Subject: Re: Problem retrieving collection.

Hi Wes,
comments see below
Lemke, Wesley wrote:
No problem.  I think this is everything needed:
package model;
// All persistent Object extend this class, the unique object ID // is

from this class along with some other fields public class AdmObject 
implements Serializable{
	
	private int objectId = -1;
	// A few other fields, removed for simplification
}

package model.client;
// Abstract class that NewClientGroup and Subgroup extend.
// Both NewClientGroup and Subgroup are stored in the
// client_group table.
public abstract class GenericGroup extends AdmObject {
private String name;
// A few other fields, removed for simplification
private String ojbConcreteClass;
}

package model.client;
// Contains Collection of NewClientGroups.
// Persisted in client.
public class ClientRelationship extends AdmObject {
private String nameOfApproverOfNoContract;
private List clientGroups = new ArrayList();***
}
package model.client;
// One of two classes that extend GenericGroup.
// Contains collection of Subgroups and reference
// to ClientRelationship
// Persisted in client_group.
public class NewClientGroup extends GenericGroup {
// A few other fields, removed for simplification
private List subgroups = new ArrayList();***
private ClientRelationship clientRelationship;
}
***The problem occurs when retrieving the clientGroups collection from

ClientRelationship.  I am having the same problem when retrieving the 
subgroups collection from NewClientGroup, but I'll leave that part out

to simplify the problem.
Here are the class descriptors:
class-descriptor
	class=model.AdmObject
	extent-class class-ref=model.client.ClientRelationship /
	extent-class class-ref=model.client.GenericGroup / 
/class-descriptor

class-descriptor
	class=model.client.GenericGroup
	extent-class class-ref=model.client.NewClientGroup / 
/class-descriptor

class-descriptor
	class=model.client.ClientRelationship
	table=client
   field-descriptor
   name=objectId
   column=client_id
   jdbc-type=INTEGER
   primarykey=true
   autoincrement=true
   access=readonly
   /
   field-descriptor
   	name=nameOfApproverOfNoContract
   	column=agr_approver
   	jdbc-type=VARCHAR
   	/	
	collection-descriptor
		name=clientGroups
		element-class-ref=model.client.NewClientGroup
		auto-delete=true
		auto-update=true
	
		inverse-foreignkey field-ref=clientRelationshipId /
	/collection-descriptor
/class-descriptor

class-descriptor
class=model.client.NewClientGroup
table=client_group
field-descriptor
name=objectId
column=group_id
jdbc-type=INTEGER
primarykey=true
autoincrement=true
access=readonly
/
field-descriptor
name=clientRelationshipId
column=client_id
jdbc-type=INTEGER
access=anonymous
/   

Field clientRelationshipId was used by a 1:n relationship, so using an
anonymous key can be problematic. See
http://db.apache.org/ojb/docu/guides/advanced-technique.html#How+do+
Try to make this field a normal field in NewClientGroup. If you using 
PersistentFieldDirectAccessImplNew as PersistentField implementation in 
OJB.properties file (default setting), no get/setter needed.

The error message is strange I can't find a typo or incorrect mapping.
Armin

	field-descriptor
		name=name
		column=NAME
		jdbc-type=VARCHAR
	/
	field-descriptor
		name=ojbConcreteClass
		column=CLASS_NAME
		jdbc-type=VARCHAR
	/
	reference-descriptor name=clientRelationship 
class-ref=model.client.ClientRelationship
		foreignkey field-ref=clientRelationshipId/
	/reference-descriptor 		
/class-descriptor

The objects persist fine.  Here is the data in the tables after a 
store:

mysql select * from client;

Re: Problem retrieving collection.

2005-03-24 Thread Armin Waibel
forget my previous post, the error message isn't clear. Why does OJB 
lookup 'clientRelationshipId' in class 'ClientRelationship' instead of 
'NewClientGroup'?

Could you post the whole stack trace?
Armin
Armin Waibel wrote:
Lemke, Wesley wrote:
I added the (int) clientRelationshipId to NewClientGroup and removed the
access=anonymous from the field-descriptor.  I am still getting the
same error.
Damned! What a nasty problem ;-)
The error message seems to be clear
Error 500: Server caught unhandled exception from servlet
[servlets.InheritanceServlet]:
org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]
rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
s_of_Items=class model.client.NewClientGroup] for class-descriptor
'model.client.ClientRelationship'
When OJB lookup the field 'clientRelationshipId' it's not found in 
'model.client.ClientRelationship' class-descriptor.

Do your application really use the new mapping files, do you manipulate 
OJB metadata at runtime?

regards,
Armin

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Thursday, March 
24, 2005 9:04 AM
To: OJB Users List
Subject: Re: Problem retrieving collection.

Hi Wes,
comments see below
Lemke, Wesley wrote:
No problem.  I think this is everything needed:
package model;
// All persistent Object extend this class, the unique object ID // is


from this class along with some other fields public class AdmObject 
implements Serializable{

private int objectId = -1;
// A few other fields, removed for simplification
}

package model.client;
// Abstract class that NewClientGroup and Subgroup extend.
// Both NewClientGroup and Subgroup are stored in the
// client_group table.
public abstract class GenericGroup extends AdmObject {
private String name;
// A few other fields, removed for simplification
private String ojbConcreteClass;
}

package model.client;
// Contains Collection of NewClientGroups.
// Persisted in client.
public class ClientRelationship extends AdmObject {

private String nameOfApproverOfNoContract;
private List clientGroups = new ArrayList();***
}
package model.client;
// One of two classes that extend GenericGroup.
// Contains collection of Subgroups and reference
// to ClientRelationship
// Persisted in client_group.
public class NewClientGroup extends GenericGroup {
// A few other fields, removed for simplification
private List subgroups = new ArrayList();***
private ClientRelationship clientRelationship;
}
***The problem occurs when retrieving the clientGroups collection from


ClientRelationship.  I am having the same problem when retrieving the 
subgroups collection from NewClientGroup, but I'll leave that part out


to simplify the problem.
Here are the class descriptors:
class-descriptor
class=model.AdmObject
extent-class class-ref=model.client.ClientRelationship /
extent-class class-ref=model.client.GenericGroup / 
/class-descriptor

class-descriptor
class=model.client.GenericGroup
extent-class class-ref=model.client.NewClientGroup / 
/class-descriptor

class-descriptor
class=model.client.ClientRelationship
table=client
   field-descriptor
   name=objectId
   column=client_id
   jdbc-type=INTEGER
   primarykey=true
   autoincrement=true
   access=readonly
   /
   field-descriptor
   name=nameOfApproverOfNoContract
   column=agr_approver
   jdbc-type=VARCHAR
   /   
collection-descriptor
name=clientGroups
element-class-ref=model.client.NewClientGroup
auto-delete=true
auto-update=true

inverse-foreignkey field-ref=clientRelationshipId /
/collection-descriptor/class-descriptor

class-descriptor
class=model.client.NewClientGroup
table=client_group
field-descriptor
name=objectId
column=group_id
jdbc-type=INTEGER
primarykey=true
autoincrement=true
access=readonly
/
field-descriptor
name=clientRelationshipId
column=client_id
jdbc-type=INTEGER
access=anonymous
/   

Field clientRelationshipId was used by a 1:n relationship, so using an
anonymous key can be problematic. See
http://db.apache.org/ojb/docu/guides/advanced-technique.html#How+do+
Try to make this field a normal field in NewClientGroup. If you using 
PersistentFieldDirectAccessImplNew as PersistentField implementation 
in OJB.properties file (default setting), no get/setter needed.

The error message is strange I can't find a typo or incorrect mapping.
Armin

field-descriptor
name=name
column=NAME
jdbc-type=VARCHAR
/
field-descriptor
name=ojbConcreteClass
column=CLASS_NAME
jdbc-type=VARCHAR
/
reference-descriptor name=clientRelationship 
class-ref=model.client.ClientRelationship

null child object references

2005-03-24 Thread Laran Evans
I have a ParentObject which owns a ChildObject. The ChildObject is not 
null, but contains all null fields. The constructor of the ParentObject 
creates a ChildObject which is not null, but contains all null fields.

When OJB loads ParentObject, it calls the default constructor which 
creates a ChildObject. During the load process OJB then specifically 
sets ChildObject = null.

Is there a way to turn this off. In other words I want OJB to not 
specifically set ChildObject = null when loading.

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


RE: Problem retrieving collection.

2005-03-24 Thread Lemke, Wesley
Hehe, that was my originally question when I changed it from objectId to
clientRelationshipId :)

Here is the entire stack trace:

[3/24/05 9:08:43:844 CST]  1985c96 SystemOut O
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.agr_approver,A0.client_id FROM client A0
[3/24/05 9:08:43:874 CST]  1985c96 ConnectionFac I J2CA0122I: Resource
reference jdbc/ao79 could not be located, so default values of the
following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level:  0 (TRANSACTION_NONE)
res-sharing-scope:true (SHAREABLE)
res-resolution-control:   999 (undefined)
[Other attributes]

isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)

[3/24/05 9:08:44:064 CST]  1985c96 SystemOut O
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.CLASS_NAME,A0.group_id,A0.NAME,A0.client_id FROM
client_group A0 WHERE ( A0.client_id = ?) AND  (A0.CLASS_NAME = ?)
[3/24/05 9:08:44:094 CST]  1985c96 SystemErr R
org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]
rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
s_of_Items=class model.client.NewClientGroup] for class-descriptor
'model.client.ClientRelationship'
at
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFi
eldDescriptors(Unknown Source)
at
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyVa
lues(Unknown Source)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.associateBatched(
Unknown Source)
at
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Un
known Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Un
known Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
known Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
at
servlets.InheritanceServlet.printGroups(InheritanceServlet.java:123)
at
servlets.InheritanceServlet.doPost(InheritanceServlet.java:75)
at servlets.InheritanceServlet.doGet(InheritanceServlet.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictSe
rvletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLi
fecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycle
Servlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLif
ecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.
java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(Vali
dServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(Servle
tInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
tch(WebAppRequestDispatcher.java:948)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRe
questDispatcher.java:530)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppReq
uestDispatcher.java:176)
at
com.ibm.ws.webcontainer.servlet.InvokerServlet.service(InvokerServlet.ja
va:255)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictSe
rvletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLi
fecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycle
Servlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLif
ecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.
java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(Vali
dServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(Servle
tInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa

Re: Problem retrieving collection.

2005-03-24 Thread Armin Waibel

Lemke, Wesley wrote:
Hehe, that was my originally question when I changed it from objectId to
clientRelationshipId :)
I run a test case with same mapping (1:n with 1:1 back-reference and 
shared FK) with latest from OJB_1_0_RELEASE branch. The test pass 
without problems.
Maybe the problem is the inheritance, I haven't tried this in my test case.

class-descriptor
class=model.AdmObject
extent-class class-ref=model.client.ClientRelationship /
extent-class class-ref=model.client.GenericGroup /
/class-descriptor
class-descriptor
class=model.client.GenericGroup
extent-class class-ref=model.client.NewClientGroup /
/class-descriptor
Remove these mapping and run your test again.
regards,
Armin

Here is the entire stack trace:
[3/24/05 9:08:43:844 CST]  1985c96 SystemOut O
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.agr_approver,A0.client_id FROM client A0
[3/24/05 9:08:43:874 CST]  1985c96 ConnectionFac I J2CA0122I: Resource
reference jdbc/ao79 could not be located, so default values of the
following are used: [Resource-ref settings]
res-auth: 1 (APPLICATION)
res-isolation-level:  0 (TRANSACTION_NONE)
res-sharing-scope:true (SHAREABLE)
res-resolution-control:   999 (undefined)
[Other attributes]
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)
[3/24/05 9:08:44:064 CST]  1985c96 SystemOut O
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.CLASS_NAME,A0.group_id,A0.NAME,A0.client_id FROM
client_group A0 WHERE ( A0.client_id = ?) AND  (A0.CLASS_NAME = ?)
[3/24/05 9:08:44:094 CST]  1985c96 SystemErr R
org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found field
reference name 'clientRelationshipId' in descriptor
[EMAIL PROTECTED]
rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
s_of_Items=class model.client.NewClientGroup] for class-descriptor
'model.client.ClientRelationship'
at
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFi
eldDescriptors(Unknown Source)
at
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyVa
lues(Unknown Source)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.associateBatched(
Unknown Source)
at
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Un
known Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Un
known Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
known Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
at
servlets.InheritanceServlet.printGroups(InheritanceServlet.java:123)
at
servlets.InheritanceServlet.doPost(InheritanceServlet.java:75)
at servlets.InheritanceServlet.doGet(InheritanceServlet.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictSe
rvletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLi
fecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycle
Servlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLif
ecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.
java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(Vali
dServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(Servle
tInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
tch(WebAppRequestDispatcher.java:948)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRe
questDispatcher.java:530)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppReq
uestDispatcher.java:176)
at
com.ibm.ws.webcontainer.servlet.InvokerServlet.service(InvokerServlet.ja
va:255)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictSe
rvletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLi

RE: Problem retrieving collection.

2005-03-24 Thread Lemke, Wesley
That worked Armin, thanks!

One question though, those mappings were correct, and should work,
right?  Will it hurt anything to not have them in there?

I created a Junit Test.  It works with those mappings removed, but fails
when the lines are there.  Would you like me to send it to you?

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 10:25 AM
To: OJB Users List
Subject: Re: Problem retrieving collection.




Lemke, Wesley wrote:
 Hehe, that was my originally question when I changed it from objectId 
 to clientRelationshipId :)


I run a test case with same mapping (1:n with 1:1 back-reference and 
shared FK) with latest from OJB_1_0_RELEASE branch. The test pass 
without problems.
Maybe the problem is the inheritance, I haven't tried this in my test
case.

class-descriptor
class=model.AdmObject
extent-class class-ref=model.client.ClientRelationship /
extent-class class-ref=model.client.GenericGroup /
/class-descriptor

class-descriptor
class=model.client.GenericGroup
extent-class class-ref=model.client.NewClientGroup /
/class-descriptor

Remove these mapping and run your test again.

regards,
Armin


 Here is the entire stack trace:
 
 [3/24/05 9:08:43:844 CST]  1985c96 SystemOut O
 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:

 SQL:SELECT A0.agr_approver,A0.client_id FROM client A0 [3/24/05 
 9:08:43:874 CST]  1985c96 ConnectionFac I J2CA0122I: Resource 
 reference jdbc/ao79 could not be located, so default values of the 
 following are used: [Resource-ref settings]
 
   res-auth: 1 (APPLICATION)
   res-isolation-level:  0 (TRANSACTION_NONE)
   res-sharing-scope:true (SHAREABLE)
   res-resolution-control:   999 (undefined)
 [Other attributes]
 
 isCMP1_x: false (not CMP1.x)
 isJMS: false (not JMS)
 
 [3/24/05 9:08:44:064 CST]  1985c96 SystemOut O
 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:

 SQL:SELECT A0.CLASS_NAME,A0.group_id,A0.NAME,A0.client_id FROM 
 client_group A0 WHERE ( A0.client_id = ?) AND  (A0.CLASS_NAME = ?)
 [3/24/05 9:08:44:094 CST]  1985c96 SystemErr R
 org.apache.ojb.broker.OJBRuntimeException: Incorrect or not found 
 field reference name 'clientRelationshipId' in descriptor 
 [EMAIL PROTECTED]
 et

rieve=true,cascade_store=object,cascade_delete=object,is_lazy=false,clas
 s_of_Items=class model.client.NewClientGroup] for class-descriptor
 'model.client.ClientRelationship'
   at

org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFi
 eldDescriptors(Unknown Source)
   at

org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyVa
 lues(Unknown Source)
   at

org.apache.ojb.broker.accesslayer.CollectionPrefetcher.associateBatched(
 Unknown Source)
   at

org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Un
 known Source)
   at

org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Un
 known Source)
   at

org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
 nown Source)
   at

org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
 nown Source)
   at

org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
 nown Source)
   at

org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
 known Source)
   at

org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
 ery(Unknown Source)
   at

org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
 ery(Unknown Source)
   at
 servlets.InheritanceServlet.printGroups(InheritanceServlet.java:123)
   at
 servlets.InheritanceServlet.doPost(InheritanceServlet.java:75)
   at servlets.InheritanceServlet.doGet(InheritanceServlet.java:44)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at

com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictSe
 rvletInstance.java:110)
   at

com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLi
 fecycleServlet.java:174)
   at

com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycle
 Servlet.java:313)
   at

com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLif
 ecycleServlet.java:116)
   at

com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.
 java:283)
   at

com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(Vali
 dServletReferenceState.java:42)
   at

com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(Servle
 tInstanceReference.java:40)
   at

com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
 tch(WebAppRequestDispatcher.java:948)
   at


Re: Problem retrieving collection.

2005-03-24 Thread Armin Waibel
Lemke, Wesley wrote:
That worked Armin, thanks!
puh! This is a good news.
One question though, those mappings were correct, and should work,
right?  
In impulse, yep it should work. But there can be a problem with 
inheritance and the use of SequenceManagerNativeImpl, because this SM is 
not extent aware
http://db.apache.org/ojb/docu/guides/sequencemanager.html#Identity+based+sequence+manager
http://db.apache.org/ojb/docu/guides/sequencemanager.html#What+to+hell+does%0A

Will it hurt anything to not have them in there?
I don't think that it will cause problems. Only queries like give all 
AdmObject are no longer possible. In this case you have to do separate 
queries for all inherited classes.

I created a Junit Test.  It works with those mappings removed, but fails
when the lines are there.  Would you like me to send it to you?
Yes please, will have a look at it and ...
Good luck!
regards,
Armin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


status on 1.02 release?

2005-03-24 Thread Ryan Vanderwerf
Just checking if anyone knows the target date for 1.02? I am looking to
upgrade but am afraid of the cache problem in 1.01.

 

Ryan



Re: status on 1.02 release?

2005-03-24 Thread Armin Waibel
Ryan Vanderwerf wrote:
Just checking if anyone knows the target date for 1.02? I am looking to
upgrade but am afraid of the cache problem in 1.01.
Last mail from Brian announce the release for today or tomorrow (when he 
has a change to build the release).

regards,
Armin

 

Ryan

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


Re: status on 1.02 release?

2005-03-24 Thread Robert S. Sfeir
Brian is working on the release as we speak.
R
On Mar 24, 2005, at 12:08 PM, Ryan Vanderwerf wrote:
Just checking if anyone knows the target date for 1.02? I am  
looking to
upgrade but am afraid of the cache problem in 1.01.


Ryan

!DSPAM:42434831247681776579306!
Robert S. Sfeir
robert(at)codepuccinoNOSPAM.com
Make everything as simple as possible,
but not simpler - Einstein
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: status on 1.02 release?

2005-03-24 Thread Brian McCallister
Am pushing it tonight. Won't announce until tomorrow night though so 
that it can mirror out first =)

-Brian
On Mar 24, 2005, at 12:08 PM, Ryan Vanderwerf wrote:
Just checking if anyone knows the target date for 1.02? I am looking to
upgrade but am afraid of the cache problem in 1.01.

Ryan

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