how to sum odmgapi

2004-09-07 Thread Johnson
Hi!

How to sum a field in odmgapi

Bestgards

johnson

Re: [PersistentField] ERROR: while set field:

2004-09-07 Thread Wojciech CHMIELEWSKI
On Tue, 7 Sep 2004, Armin Waibel wrote:
Wojciech CHMIELEWSKI wrote:
On Tue, 7 Sep 2004, Armin Waibel wrote:
Hi,
your mapping seems ok. Could you post the generated class-descriptor for
AddressTypeBO and AddressBO too?

there were  send -> point 3) repository.xml - this only fragment of 
repository.xml, only class-descriptor for AddressTypeBO and AddressBO

oh, sorry I overlooked this - too long mail ;-)
The problem could be caused by the extents mapping of the BO object:






Assume BO class is only a base object for your business classes and you never 
want to query "give all BO objects". In this case you shouldn't declare 
AddressBO and AddressTypeBO as extent of BO.
Try to remove this entry and run your test again.

If this solve your problem try determine-extents="false" in AddressBO and 
AddressTypeBO to suppress generation of extent mapping.

many thanks, it helps ...
yes BO is only my base object.
but if BO wasn't only base object and I want query it. why isn't 
it  works in my implementation ?? what was the cause ??

and once more many thanks ...
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [PersistentField] ERROR: while set field:

2004-09-07 Thread Armin Waibel
Wojciech CHMIELEWSKI wrote:
On Tue, 7 Sep 2004, Armin Waibel wrote:
Hi,
your mapping seems ok. Could you post the generated class-descriptor for
AddressTypeBO and AddressBO too?

there were  send -> point 3) repository.xml - this only fragment of 
repository.xml, only class-descriptor for AddressTypeBO and AddressBO

oh, sorry I overlooked this - too long mail ;-)
The problem could be caused by the extents mapping of the BO object:
>>> 
>>> class="com.chw.crm.BusinessObject.BO"
>>>

>>> 
>>> 
>>> 

Assume BO class is only a base object for your business classes and you 
never want to query "give all BO objects". In this case you shouldn't 
declare AddressBO and AddressTypeBO as extent of BO.
Try to remove this entry and run your test again.

If this solve your problem try determine-extents="false" in AddressBO 
and AddressTypeBO to suppress generation of extent mapping.


Did you try without the 'id' attribute (it's optional) set?
Which version do you use?
 ojb 1rc7, oracle 9i, tomcat 5, struts
If you get problems caused by xdoclet-modul try latest version of the 
xdoclet-ojb-modul.jar (or use the version shipped with OJB 1.0).

regards,
Armin

regards,
Armin
Wojciech CHMIELEWSKI wrote:
I'm using ojb since yestarday and I experience  some problems ...
when I use ojb for one class which takes date from one table 
everything is ok, the problem begins when I have object o1 of a type  
AddressBO which has an object o2 of a type AddressTypeBO and I want 
to take o1 and of course have o2 filled.

And of course, when I want to do this I get error.
Any help is appreciated :)
I attached :
1) errorr description
2) java classes
3) repository.xml
1) I get this type of error :
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: Creating 
RsIterator for class [com.chw.crm.BusinessObject.AddressBO]
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: 
getObjectByIdentity com.chw.crm.BusinessObject.BO{2}
[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: com.chw.crm.BusinessObject.AddressBO
target field name: addressType
target field type: class com.chw.crm.BusinessObject.AddressTypeBO
object value class: com.chw.crm.BusinessObject.AddressBO
object value: [EMAIL PROTECTED]
]
null
java.lang.IllegalArgumentException
at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) 
at java.lang.reflect.Field.set(Field.java:519)
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(Unknown 
Source)
at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
at 
com.chw.crm.DAO.BusinessObjectDAO.OracleBusinessObjectDAO.OracleAddressDAO.getAddressBO(OracleAddressDAO.java:44) 
at com.chw.crm.Action.TestAction.execute(TestAction.java:43)

2) java code (not all only needed fragments)
package com.chw.crm.BusinessObject;
import java.io.Serializable;
/**
 * @author Administrator
 *
 * @ojb.class generate-table-info="false"
 */
public class BO implements Serializable {
}
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_T"
 *
 */
public class AddressBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="ADDRESS2STATUS"
 *jdbc-type="BIGINT"
 *id="2"
 */
private long address2status;
/**
 * @ojb.reference 
class-ref="com.chw.crm.BusinessObject.AddressTypeBO"
 * foreignkey="address2addressType"
 *
 */
private AddressTypeBO addressType;

/**
 *
 * @ojb.field column="ADDRESS2ADDRESS_TYPE"
 *jdbc-type="BIGINT"
 *id="3"
 *
 */
private long address2addressType;
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_TYPE_T"
 *include-inherited="true"
 */
public class AddressTypeBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="DESCRIPTION"
 *jdbc-type="VARCHAR"
 *id="2"
 */
private String description;

Re: [PersistentField] ERROR: while set field:

2004-09-07 Thread Wojciech CHMIELEWSKI
On Tue, 7 Sep 2004, Armin Waibel wrote:
Hi,
your mapping seems ok. Could you post the generated class-descriptor for
AddressTypeBO and AddressBO too?
there were  send -> point 3) repository.xml - this only fragment 
of repository.xml, only class-descriptor for AddressTypeBO and 
AddressBO

Did you try without the 'id' attribute (it's optional) set?
Which version do you use?
 ojb 1rc7, oracle 9i, tomcat 5, struts
regards,
Armin
Wojciech CHMIELEWSKI wrote:
I'm using ojb since yestarday and I experience  some problems ...
when I use ojb for one class which takes date from one table everything is 
ok, the problem begins when I have object o1 of a type  AddressBO which 
has an object o2 of a type AddressTypeBO and I want to take o1 and of 
course have o2 filled.

And of course, when I want to do this I get error.
Any help is appreciated :)
I attached :
1) errorr description
2) java classes
3) repository.xml
1) I get this type of error :
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: Creating 
RsIterator for class [com.chw.crm.BusinessObject.AddressBO]
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: 
getObjectByIdentity com.chw.crm.BusinessObject.BO{2}
[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: com.chw.crm.BusinessObject.AddressBO
target field name: addressType
target field type: class com.chw.crm.BusinessObject.AddressTypeBO
object value class: com.chw.crm.BusinessObject.AddressBO
object value: [EMAIL PROTECTED]
]
null
java.lang.IllegalArgumentException
at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) 
at java.lang.reflect.Field.set(Field.java:519)
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(Unknown 
Source)
at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
at 
com.chw.crm.DAO.BusinessObjectDAO.OracleBusinessObjectDAO.OracleAddressDAO.getAddressBO(OracleAddressDAO.java:44) 
at com.chw.crm.Action.TestAction.execute(TestAction.java:43)

2) java code (not all only needed fragments)
package com.chw.crm.BusinessObject;
import java.io.Serializable;
/**
 * @author Administrator
 *
 * @ojb.class generate-table-info="false"
 */
public class BO implements Serializable {
}
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_T"
 *
 */
public class AddressBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="ADDRESS2STATUS"
 *jdbc-type="BIGINT"
 *id="2"
 */
private long address2status;
/**
 * @ojb.reference class-ref="com.chw.crm.BusinessObject.AddressTypeBO"
 * foreignkey="address2addressType"
 *
 */
private AddressTypeBO addressType;
/**
 *
 * @ojb.field column="ADDRESS2ADDRESS_TYPE"
 *jdbc-type="BIGINT"
 *id="3"
 *
 */
private long address2addressType;
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_TYPE_T"
 *include-inherited="true"
 */
public class AddressTypeBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="DESCRIPTION"
 *jdbc-type="VARCHAR"
 *id="2"
 */
private String description;
/**
 * @ojb.field column="VALUE"
 *jdbc-type="VARCHAR"
 *id="3"
 */
private String value;

public class OracleAddressDAO implements AddressDAO {
public AddressBO getAddressBO(int objid){
AddressBO bo = new AddressBO();
PersistenceBroker broker;
try {
broker = OracleDAOFactory.getTheBroker();
broker.beginTransaction();
Criteria c = new Criteria();
c.addEqualTo("objid", new Integer( objid ) );
Query query = new QueryByCriteria( AddressBO.class , c );
-- error IS  HERE  !!!
try {
bo = (AddressBO)broker.getObjectByQuery( query );
} catch (PersistenceBrokerException e1) {
Sys

Re: Unable to use xdoclet-ojb-module.

2004-09-07 Thread David Durham
Magnus wrote:
I just tried my file with suns JDK-1.5-rc on debian-amd64 and works
fine, thus it must have been a bug in IBM's JVM ( since all the other
components are the same ).
So, are you going to be able to use the JDK or are you stuck using IBM's 
JVM?

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


Re: [PersistentField] ERROR: while set field:

2004-09-07 Thread Armin Waibel
Hi,
your mapping seems ok. Could you post the generated class-descriptor for
AddressTypeBO and AddressBO too?
Did you try without the 'id' attribute (it's optional) set?
Which version do you use?
regards,
Armin
Wojciech CHMIELEWSKI wrote:
I'm using ojb since yestarday and I experience  some problems ...
when I use ojb for one class which takes date from one table everything 
is ok, the problem begins when I have object o1 of a type  AddressBO 
which has an object o2 of a type AddressTypeBO and I want to take o1 and 
of course have o2 filled.

And of course, when I want to do this I get error.
Any help is appreciated :)
I attached :
1) errorr description
2) java classes
3) repository.xml
1) I get this type of error :
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: Creating 
RsIterator for class [com.chw.crm.BusinessObject.AddressBO]
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: 
getObjectByIdentity com.chw.crm.BusinessObject.BO{2}
[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: com.chw.crm.BusinessObject.AddressBO
target field name: addressType
target field type: class com.chw.crm.BusinessObject.AddressTypeBO
object value class: com.chw.crm.BusinessObject.AddressBO
object value: [EMAIL PROTECTED]
]
null
java.lang.IllegalArgumentException
at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) 

at java.lang.reflect.Field.set(Field.java:519)
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(Unknown 
Source)
at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
at 
com.chw.crm.DAO.BusinessObjectDAO.OracleBusinessObjectDAO.OracleAddressDAO.getAddressBO(OracleAddressDAO.java:44) 

at com.chw.crm.Action.TestAction.execute(TestAction.java:43)
2) java code (not all only needed fragments)
package com.chw.crm.BusinessObject;
import java.io.Serializable;
/**
 * @author Administrator
 *
 * @ojb.class generate-table-info="false"
 */
public class BO implements Serializable {
}
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_T"
 *
 */
public class AddressBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="ADDRESS2STATUS"
 *jdbc-type="BIGINT"
 *id="2"
 */
private long address2status;
/**
 * @ojb.reference class-ref="com.chw.crm.BusinessObject.AddressTypeBO"
 * foreignkey="address2addressType"
 *
 */
private AddressTypeBO addressType;
/**
 *
 * @ojb.field column="ADDRESS2ADDRESS_TYPE"
 *jdbc-type="BIGINT"
 *id="3"
 *
 */
private long address2addressType;
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_TYPE_T"
 *include-inherited="true"
 */
public class AddressTypeBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="DESCRIPTION"
 *jdbc-type="VARCHAR"
 *id="2"
 */
private String description;
/**
 * @ojb.field column="VALUE"
 *jdbc-type="VARCHAR"
 *id="3"
 */
private String value;

public class OracleAddressDAO implements AddressDAO {
public AddressBO getAddressBO(int objid){
AddressBO bo = new AddressBO();
PersistenceBroker broker;
try {
broker = OracleDAOFactory.getTheBroker();
broker.beginTransaction();
Criteria c = new Criteria();
c.addEqualTo("objid", new Integer( objid ) );
Query query = new QueryByCriteria( AddressBO.class , c );
-- error IS  HERE  !!!
try {
bo = (AddressBO)broker.getObjectByQuery( query );
} catch (PersistenceBrokerException e1) {
System.out.println("" );
System.out.println( e1.getMessage() );
System.out.println("" );
System.out.println( e1.getSourceExcep

Re: OJB fails during load testing

2004-09-07 Thread Armin Waibel
Hi Rick,
Rick Banerjee wrote:
Hi Armin, Hello Everyone,
Sorry to take so long to reply! Was trying as many combinations
as possible!
I'm using OJB within a servlet in a managed environment. That is
to say, I'm using OJB in the DAO layer of a Struts application
running in the SunONE application server.
As for the stack trace, I'm getting stuff in the stack trace saying:
org.apache.ojb.broker.PBFactoryException: 
Borrow broker from pool failed, 
using PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=, user=null, password=null

It looks like I'm running out of brokers? So, where do I set the
maxActive? In OJB.properties? In repository.xml?
In OJB.properties section PersistenceBroker pool.
Do you run a massive multithreaded test (default size of broker pool is 
100)? If not, please check your code maybe you forget to call PB.close() 
 in source.


If I comment out all the values in OJB.properties related to the
broker pool and have the entries only in repository.xml, is that
OK?
No, the broker pool can only be set in OJB.properties file.

Also, the entries in the OJB.properties & repository.xml, like 
maxActive, maxIdle are related to the broker pool or the 
database connection pool?

In repository.xml you can set properties for the connection pool using 
the 'connection-pool' element within the jdbc-connection-descriptor, if 
the used ConnectionFactory (specified in OJB.properties file) support 
connection pooling (the broker pool and the connection pool are 
completely different!).


And, since I'm running OJB within an app server and using a
JNDI lookup for the datasource, should I neccessarily use
#ConnectionFactoryClass=
org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl?
Above you say that you use OJB in a managed environment (transaction, 
security, and connection management done by the appServer), thus the 
serlets use JTA to manage transactions and the used DataSource was 
"bound to" JTA (tx-management is done by the appServer and you use 
UserTransaction or similar stuff in your servlets)? If this is the case, 
the answer is yes.
Then tx-demarcation/management for OJB should be done via JTA(/JTS) too 
and UserTransation should be used instead of the local tx-demarcation by 
PB.beginTransaction/.
In OJB.properties file you should set properties for use in managed 
environments described here
http://db.apache.org/ojb/docu/guides/deployment.html#Configure+OJB+for+managed+environments+considering+as+JBoss+example

If you only use the appServer connection pool and nothing more, the 
answer is no.


As you can see, I'm really confused. :-)
hope I don't force up confusion ;-)
regards,
Armin

Could you please help me?
I'm at my wits end and still haven't fixed this problem. Have to move to 
production soon! :-((

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


[PersistentField] ERROR: while set field:

2004-09-07 Thread Wojciech CHMIELEWSKI
I'm using ojb since yestarday and I experience  some problems ...
when I use ojb for one class which takes date from one table 
everything is ok, the problem begins when I have object o1 of a 
type  AddressBO which has an object o2 of a type AddressTypeBO 
and I want to take o1 and of course have o2 filled.

And of course, when I want to do this I get error.
Any help is appreciated :)
I attached :
1) errorr description
2) java classes
3) repository.xml
1) I get this type of error :
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: 
Creating RsIterator for class 
[com.chw.crm.BusinessObject.AddressBO]
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: 
getObjectByIdentity com.chw.crm.BusinessObject.BO{2}
[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: com.chw.crm.BusinessObject.AddressBO
target field name: addressType
target field type: class com.chw.crm.BusinessObject.AddressTypeBO
object value class: com.chw.crm.BusinessObject.AddressBO
object value: [EMAIL PROTECTED]
]
null
java.lang.IllegalArgumentException
	at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
	at java.lang.reflect.Field.set(Field.java:519)
	at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown 
Source)
	at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
	at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(Unknown 
Source)
	at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(Unknown 
Source)
	at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown 
Source)
	at 
org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
	at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown 
Source)
	at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
	at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown 
Source)
	at 
com.chw.crm.DAO.BusinessObjectDAO.OracleBusinessObjectDAO.OracleAddressDAO.getAddressBO(OracleAddressDAO.java:44)
	at 
com.chw.crm.Action.TestAction.execute(TestAction.java:43)

2) java code (not all only needed fragments)
package com.chw.crm.BusinessObject;
import java.io.Serializable;
/**
 * @author Administrator
 *
 * @ojb.class generate-table-info="false"
 */
public class BO implements Serializable {
}
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_T"
 *
 */
public class AddressBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="ADDRESS2STATUS"
 *jdbc-type="BIGINT"
 *id="2"
 */
private long address2status;
/**
 * @ojb.reference 
class-ref="com.chw.crm.BusinessObject.AddressTypeBO"
 * 
foreignkey="address2addressType"
 *
 */
private AddressTypeBO addressType;

/**
 *
 * @ojb.field column="ADDRESS2ADDRESS_TYPE"
 *jdbc-type="BIGINT"
 *id="3"
 *
 */
private long address2addressType;
package com.chw.crm.BusinessObject;
/**
 * @ojb.class table="ADDRESS_TYPE_T"
 *include-inherited="true"
 */
public class AddressTypeBO extends BO {
/**
 * @ojb.field column="OBJID"
 *jdbc-type="BIGINT"
 *primarykey="true"
 *id="1"
 */
private long objid;
/**
 * @ojb.field column="DESCRIPTION"
 *jdbc-type="VARCHAR"
 *id="2"
 */
private String description;
/**
 * @ojb.field column="VALUE"
 *jdbc-type="VARCHAR"
 *id="3"
 */
private String value;

public class OracleAddressDAO implements AddressDAO {
public AddressBO getAddressBO(int objid){
AddressBO bo = new AddressBO();
PersistenceBroker broker;
try {
broker = OracleDAOFactory.getTheBroker();
broker.beginTransaction();
			Criteria c = new Criteria();
			c.addEqualTo("objid", new Integer( objid 
) );
			Query query = new QueryByCriteria( 
AddressBO.class , c );

-- error IS  HERE  !!!
			try {
bo = 
(AddressBO)broker.getObjectByQuery( query );
			} catch (PersistenceBrokerException e1) {

System.out.println("" );
System.out.println( 
e1.getMessage() );

System.out.println("" );
System.out.println( 
e1.getSourceException().toString() );

System.out.println("" );
System.out.println( e1.getCause() 
);

System.out.println("" );
e1.printStackTrace();
}
			/*Iterator iter = 
broker.getItera

RE: Pbm With OJB Platform : Apolgy

2004-09-07 Thread Thierry Hanot
All what I ask for is in the source code ( also in javadoc ) of each
platform. 
Sorry .

Thierry 

-Original Message-
From: Thierry Hanot [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 06, 2004 8:55 AM
To: 'OJB Users List'
Subject: Pbm With OJB Platform


Hello 
Just For Info :
In our application we are  mixing OJB and JDBC access in the front of an
Oracle 9i RDBMS. Our use of jdbc is for doing batch update/insert in an
optimal way. We use standard batching instead of oracle batching. Since we
use the oracle9i plateform our process dump some very strange errors, very
hard to debug.

After looking the code of the oracle9i plateform, we just realized that the
oracle9i plateform use the oracle batching which is not compatbile with the
standard batching.

There is 2 points here :
- is it possible to have in the OJB documentation a description of
each RDBMS supported, which optimization are used and mostly which
limitation they have .
- May be i 'm a bit to strict, but forbid the use of standard
batching is not the philosophy of ojb. Ojb want to be generic in the front
of many RDBM but the use of a plateform( oracle 9i) introduce some
restrictions (do not use the Batch update or use plateform specific batch
update in my case) which seems to be too limiting.


Since we have reverting the plateform description to standard Oracle , we
have no more problem. But we can do this because we did our own
implementation of Blob management( because we want to use streaming for
avoiding to have the full blob in memory ... ).


Anyway thanks for OJB. Except this few point everything our project is
working fine...

B.R 

Thierry Hanot 


-
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: Unable to use xdoclet-ojb-module.

2004-09-07 Thread Magnus
David Durham wrote:
psamathos wrote:

"The  type doesn't support the nested "ojbrepository" 
element."

Does anyone know why? I've tried everything I could think of, but it
never works.









I'm using ojbdoclet and I might be able to help you out.  What does 
your taskdef look like?  As I recall, there's a problem wherein you 
have to put the taskdef in each target that uses it.


- Dave
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I just tried my file with suns JDK-1.5-rc on debian-amd64 and works 
fine, thus it must have been a bug in IBM's JVM ( since all the other 
components are the same ).

regards
/Magnus Sjöstrand
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: OJB fails during load testing

2004-09-07 Thread Rick Banerjee
Hi Armin, Hello Everyone,

Sorry to take so long to reply! Was trying as many combinations
as possible!

I'm using OJB within a servlet in a managed environment. That is
to say, I'm using OJB in the DAO layer of a Struts application
running in the SunONE application server.

As for the stack trace, I'm getting stuff in the stack trace saying:

org.apache.ojb.broker.PBFactoryException: 
Borrow broker from pool failed, 
using PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=, user=null, password=null

It looks like I'm running out of brokers? So, where do I set the
maxActive? In OJB.properties? In repository.xml?

If I comment out all the values in OJB.properties related to the
broker pool and have the entries only in repository.xml, is that
OK?

Also, the entries in the OJB.properties & repository.xml, like 
maxActive, maxIdle are related to the broker pool or the 
database connection pool?

And, since I'm running OJB within an app server and using a
JNDI lookup for the datasource, should I neccessarily use
#ConnectionFactoryClass=
org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl?

As you can see, I'm really confused. :-)

Could you please help me?
I'm at my wits end and still haven't fixed this problem. Have to move to 
production soon! :-((


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



Re: Massive concurrency problems under high server load

2004-09-07 Thread Gerhard Grosse
On Sat, 21 Aug 2004 15:53:30 +0200, Armin Waibel <[EMAIL PROTECTED]>
wrote:

Hi Armin,

>Hi again,
>
> >
> > I think this one happend during lazy loading of a list proxy. So would
> > this mean that
> > - we should not use reference and collection proxies when working with
> > the ODMG API (this would be a heavy blow)
>
>In a normal servlet environment this should be work. Only when using OJB 
>within EJB it is not possible to use lazy loading, because the client 
>(e.g. webserver in 3-tier environment) does not know about OJB (or the 
>collection proxy itself has to be a bean).
>
>
> > - or that we should not use objects with unmaterialized proxies
> > outside of a transaction? (I think we don't do that normally, but
> > there might be some cases where we do.)
>
>hmm, this should work. Could you describe more exactly what your test 
>do? Does the test operate on the same objects, does insert new object, 
>read, delete,... Were does the issue happen?
>
>It will be time-consuming but we first need to reproduce your issue with 
>an standalone unit-test.
>
>regards,
>Armin
>

Sorry for not responding earlier. 

We are trying to fix our problems piece by piece, and a good part of
them seems to be due to the quirky locking behavior of DB2. (And
another part to the quirky v4 connection pool in WebSphere.)

But we also had to work around some issues with OJB, which might be of
interest for the list:

1) Occassionally we run into a thread deadlock situation when the
connection pool of the app server is exhausted. The reason is that the
LockManagerDefaultImpl is completely synchronized: When constructing
an Identity for a new object, it has to obtain a connection from the
pool to get a sequence number from the database. Now the pool blocks,
because it is exhausted and the LockManager blocks all other threads
that could release their locks (and afterwards their connections).
Looking at the LockManagerDefaultImpl code, I actually see no reason
why its methods need to be synchronized. Am I overlooking something?

2) As a workaround to resolve deadlocks between DB2 and the Java App
we are trying to use timeouts on the statement level
(Statement.setQueryTimeout()). In principle this works, but another
quirk of DB2 (or its JDBC driver) is that the resulting timeout
exception is not thrown in the stmt.executeQuery() method but later
when iterating through the resultset. Now OJB's RsIterator simply
ignores exceptions thrown from the rs.next() call and treats them
exactly the same as if rs.next() had simply returned false. The result
is that the application has no notion that a timeout occurred and
simply gets an incomplete query result. Patching RsIterator to
propagate exceptions from rs.next() solved this problem. Was there a
reason to ingore all exceptions there? 

3) When resolving issue (2) we found the best place to set the
statment timeout in the afterStatementCreate method of the Platform
interface. However, although almost everything in OJB seems to be
configurable, the platform to class mapping is hardcoded in a pretty
ugly manner (sorry for that... ;-) in the PlatformFactory. Are there
any plans to make the PlatformFactory as nicely configurable as most
other factories?

Thanks,
Gerhard



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



Re: Massive concurrency problems under high server load

2004-09-07 Thread Gerhard Grosse
On Fri, 20 Aug 2004 16:30:27 -0400, Jason Mihalick
<[EMAIL PROTECTED]> wrote:

>Gerhard,
>
>Which object cache are you using?  ObjectCacheDefaultImpl or 
>ObjectCachePerBrokerImpl?  As the doc states, the ObjectCacheDefaultImpl 
>does have some drawbacks pertaining to dirty reads.  We use OJB in 
>servlet environment with an extremely query intensive application, but 
>it's a very low load.
>
>We recently upgraded from RC4 to 1.0 and so far haven't seen any new 
>problems that were due to changes between the versions. 

Hi Jason,

we are using our own cache implementation which is roughly equivalent
to ObjectCachePerBroker. In theory this should be the safest choice,
but your idea was right: there was a problem with the cache: For some
reason (this might have been fixed in 1.0) OJB occassionally uses a
second PersistenceBroker instance within a single ODMG transaction and
hence had two different copies of the same persistent object in its
two caches, which caused some optimistic lock exceptions. We are now
using something like a ObjectCachePerThreadImpl and this problem seems
to be gone.

Thanks for the tip!

Gerhard


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