how to keep repository-user.xml mappings separate from ojb.sar?

2004-02-24 Thread Michael Mogley
Hi all,

I'm trying to deploy an application on JBoss 3.2.3 using latest OJB.  I've followed 
the steps to create an ojb.sar in the deployment dir.

I would like to keep the xml mapping definitions and DAOs local to the specific .ear 
I'm deploying.  Is this possible?  Or must I keep all the mappings for all 
applications in one repository-user.xml in the ojb.sar?

Thanks for any help/advice.

Michael

Re: p6spy in webapp

2004-02-24 Thread Charles N. Harvey III
Thanks so much Cory.
This helped a great deal.  Little tip though, use p6spy-1.1.jar and not 
1.2 or
1.3.  1.2 and 1.3 log "resultset" and not just "result".  "result" can be
turned off (like in 1.1) but "resultset" cannot.  So it fills up your 
log file
to an un-openable point with only a few queries.  Especially if that 
query returns
even a few hundred results.

Since you work three desks away from me I guess I should have just asked 
you first
instead of the list.  But maybe someone else benefited from our 
conversation so
its not all bad.

Charlie

Cory L Hubert wrote:

	http://www.p6spy.com/documentation/install.htm#tomcat

The properties file is the spy.properties file (a sample should be in your
p6spy download).  You can put that anywhere in the classpath.   P6Spy will
use the classloader to pick it up.
In the spy.properties you'd specify your "real" JDBC driver (example Mysql
or SQLServer driver).
In OJB you'd edit your repository.xml and specify p6spy (not your
realdriver) as your driver in your jdbc descriptor.
So p6spy is just a wrapper around your real driver, it'll catch your OJB
generated queries and print them out to where ever you told it too in your
spy.properties file.
-Original Message-
From: Gerhard Hipfinger [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 19, 2004 6:22 PM
To: OJB Users List
Subject: Re: p6spy in webapp
hi charlie,

take a look at http://www.p6spy.com/

there you can get much more information about p6spy than on the ojb
site.
the properties file you mentioned is thy spy.properties. put it to your
classpath (i.e. WEB-INF/classes). you can get an example from the url
above. the file is documented very well, you should have no problems
whith.
gerhard

Am Fre, den 20.02.2004 schrieb Charles N. Harvey III um 00:32:
 

Hello.
I looked for this on mail-archive.com but could not find exactly what I
was looking for.  The FAQ on the site explains how to setup p6spy when
running test cases.  I want to run it in my webapp.  Put the p6spy-1.3.jar
in my WEB-INF/lib/ directory and set some settings in some properties
file.  Well, which properties file?  I'm just uncertain of what to change
and where.
If someone can maybe send me a link to where this has been explained
   

before
 

I would be greatful.  Thanks.

Charlie

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



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


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


 

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


Re: [OTM] can not delete from dependent collection

2004-02-24 Thread Oleg Nitz
Hello Joerg,

Thanks for the bug reports, I will try to prepare a junit test and 
then to make it run successfully :)

Regards,
 Oleg

On Tuesday 24 February 2004 17:45, Joerg Heinicke wrote:
> Hello,
>
> I'm extending our application prototype more and more to test the OJB/OTM
> features. It's nearly fun to just stay on the object level - OTM does the
> rest for me. But now I came across a major and two minor problems:
>
> 1. The major one: I have an object 'Debitor' with a reference to an
> abstract 'Person' with a collection 'addresses'. Everything works wonderful
> besides the deleting (and the first minor problem). I get an exception when
> an element from the collection is missing and so should be deleted from the
> database:
>
> org.apache.ojb.otm.core.TransactionAbortedException: markDelete failed: the
> dependent object Address{22} is not in the editing context.
>
> As I can not read more than "could not delete" from this error message I
> don't know what's wrong and how to fix it. I also googled for this message
> and found exactly one page: the commit of the corresponding code :-(
>
> 2. The first minor problem: The documentation on the repository.xml states
> more than clearly that auto-update must be set to false if
> otm-dependent="true", OTM would behave as the auto-update would be set to
> true then. My problem is that this is neither correct nor working without
> auto-update="true".
>
> It's about the same relation as above (person to addresses). If the
> auto-update is not set to true, the foreign key column of Address named
> 'personId' is always 0. After adding auto-update="true" it works like
> expected.
>
> 3. The second minor problem: The above mentioned 'Debitor' can either be a
> 'NaturalPerson' or a 'LegalPerson', both extend the 'AbstractPerson', so
> 'Debitor' has a reference to 'AbstractPerson'. Though it might not be
> useful in real life (will maybe be changed in the application, but it's
> helpful for showing my problem) it's possible to switch between the both
> implementations. The problem is that after the switch I have two
> 'AbstractPerson's in the database, the new real one and the old one, that
> is definitely no longer used. Maybe it's only a question of configuration
> but how can I delete the old implementation of 'AbstractPerson' in the DB
> on update of 'Debitor'?
>
> Below you will find the important parts of repository.xml and the Java
> classes. I hope I have not oversimplified it. Of course every object has
> additionally a primary key named 'id'.
>
> Thanks for your help,
>
> Joerg
>
> public class Debitor {
> private AbstractPerson abstractPerson;
> private int abstractPersonId;
> }
>
> public abstract class AbstractPerson {
> protected Collection addresses;
> }
>
> public class Address {
> private int personId;
> }
>
> 
> 
> 
> 
>
> 
>  jdbc-type="INTEGER"/> 
>
> 
>jdbc-type="INTEGER"/>
>class-ref="com.ewerk.erak.model.AbstractPerson"
>   otm-dependent="true">
> 
> 
> 
>
> 
> element-class-ref="com.ewerk.erak.model.Address"
>auto-update="true" otm-dependent="true">
> 
> 
> 
>
>  table="Person"> element-class-ref="com.ewerk.erak.model.Address"
>auto-update="true" otm-dependent="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]



[OTM] can not delete from dependent collection

2004-02-24 Thread Joerg Heinicke
Hello,

I'm extending our application prototype more and more to test the OJB/OTM
features. It's nearly fun to just stay on the object level - OTM does the rest
for me. But now I came across a major and two minor problems:

1. The major one: I have an object 'Debitor' with a reference to an abstract
'Person' with a collection 'addresses'. Everything works wonderful besides the
deleting (and the first minor problem). I get an exception when an element from
the collection is missing and so should be deleted from the database:

org.apache.ojb.otm.core.TransactionAbortedException: markDelete failed: the
dependent object Address{22} is not in the editing context.

As I can not read more than "could not delete" from this error message I don't
know what's wrong and how to fix it. I also googled for this message and found
exactly one page: the commit of the corresponding code :-(

2. The first minor problem: The documentation on the repository.xml states more
than clearly that auto-update must be set to false if otm-dependent="true", OTM
would behave as the auto-update would be set to true then. My problem is that
this is neither correct nor working without auto-update="true".

It's about the same relation as above (person to addresses). If the auto-update
is not set to true, the foreign key column of Address named 'personId' is always
0. After adding auto-update="true" it works like expected.

3. The second minor problem: The above mentioned 'Debitor' can either be a
'NaturalPerson' or a 'LegalPerson', both extend the 'AbstractPerson', so
'Debitor' has a reference to 'AbstractPerson'. Though it might not be useful in
real life (will maybe be changed in the application, but it's helpful for
showing my problem) it's possible to switch between the both implementations.
The problem is that after the switch I have two 'AbstractPerson's in the
database, the new real one and the old one, that is definitely no longer used.
Maybe it's only a question of configuration but how can I delete the old
implementation of 'AbstractPerson' in the DB on update of 'Debitor'?

Below you will find the important parts of repository.xml and the Java classes.
I hope I have not oversimplified it. Of course every object has additionally a
primary key named 'id'.

Thanks for your help,

Joerg

public class Debitor {
private AbstractPerson abstractPerson;
private int abstractPersonId;
}

public abstract class AbstractPerson {
protected Collection addresses;
}

public class Address {
private int personId;
}






























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



Bug (and Fix) with a custom RowReader and PB.getObjectByQuery()

2004-02-24 Thread Clute, Andrew
I have implemented a custom RowReader that filters out deleted items for
me. I have a "deleted_date" column on all my tables, and this RowReader
checks to see if this column is not null, and if it is null, returns the
object, otherwise returns null.

Easy and effective way for me to "soft" delete items -- still in the
database, but not in my object model.

However, in the getObjectByQuery() call, it assumes the first result
that is returned from the RsIterator is the only result, and returns
that.

I have a situation where an item with a certain criteria is in my
database twice -- once deleted, and then a non-deleted version of it.
When I do a PB.getObjectByQuery(), the RsIterator get's both results
from the database, but the first row is the deleted row, so my RowReader
filters it out, and do not get the right result.

The current code in PersistenceBrokerImpl looks like this:

OJBIterator it = getIteratorFromQuery(query, cld);
  Object result = null;
  if (it.hasNext())
  {
result = it.next();
  }
  it.releaseDbResources();
  return result;

As you can see, there are distinct cases where the user will not get the
right results if using a custom RowReader, since the assumption is the
first one will always be the case.

I would like to change the code to the following:

 OJBIterator it = getIteratorFromQuery(query, cld);
   Object result = null;
   while (result==null && it.hasNext())
   {
result = it.next();
   }
   it.releaseDbResources();
   return result;

This will ensure that if there are multiple possible results for a
query, that a custom RowReader will have a chance to find the first
instance of a result that will work.

Any thoughts or reasons why we could not change this?

-Andrew

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



using nullable in field descriptor

2004-02-24 Thread Ori Shen
Hi Folks,

1) Can anybody explain me the purpose of using nullable ?
2) I want a field descriptor to be a nullable, and when using it in a wrong way 
exception
 will be thrown. However, when using the field descriptor badly it inserts a 0 to 
the
 db instead of throwing an exception. what can I do?

thanks in advance



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



Re: ConnectinPooling

2004-02-24 Thread Tino Schöllhorn
Hi,

thanks. I wasn't aware of the PeristenceBrokerPool concept.

regards
Tino
Armin Waibel wrote:

Hi Tino,

Tino Schöllhorn wrote:

Hi,

I am using OJB(cvs head from 2 weeks ago) in Tomcat 5.0. There I have 
several PersistenceBroker which I close after each request with 
PersistenceBrokerFactory.realeaseAll().

Why you do that?
This will kill the PB pool (PB pool NOT connection pool) each time you 
call it.

After some time I get the following error:

Maybe it's because you kill the PB-pool or you don't close the PB 
instances after use with PB.close() and the PB-pool gets exhausted.

...

But the thing is: I don't even use connection pooling (or so I think). 
I activated the line

ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl 

in the OJB.properties file. So I think, that ConnectionPooling is 
switched off. Or do I have to change these settings in the 
connection-descriptors?

Do you have any suggestions?


If you don't want to use Connection pooling set the property in 
OJB.properties (you do that). Now connections will not be pooled. 
Connections will be closed after use on PB.commitTransaction, 
PB.abortTransaction or PB.close().
So if you need a PB instance get it from PBF, do your work and *close* 
the used PB instance (internal OJB return the used PB instance to PB-pool).

regards,
Armin
Tino



-
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: ConnectinPooling

2004-02-24 Thread Armin Waibel
Hi Tino,

Tino Schöllhorn wrote:
Hi,

I am using OJB(cvs head from 2 weeks ago) in Tomcat 5.0. There I have 
several PersistenceBroker which I close after each request with 
PersistenceBrokerFactory.realeaseAll().

Why you do that?
This will kill the PB pool (PB pool NOT connection pool) each time you 
call it.

After some time I get the following error:

Maybe it's because you kill the PB-pool or you don't close the PB 
instances after use with PB.close() and the PB-pool gets exhausted.

...
But the thing is: I don't even use connection pooling (or so I think). I 
activated the line

ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl 

in the OJB.properties file. So I think, that ConnectionPooling is 
switched off. Or do I have to change these settings in the 
connection-descriptors?

Do you have any suggestions?
If you don't want to use Connection pooling set the property in 
OJB.properties (you do that). Now connections will not be pooled. 
Connections will be closed after use on PB.commitTransaction, 
PB.abortTransaction or PB.close().
So if you need a PB instance get it from PBF, do your work and *close* 
the used PB instance (internal OJB return the used PB instance to PB-pool).

regards,
Armin
Tino



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


ConnectinPooling

2004-02-24 Thread Tino Schöllhorn
Hi,

I am using OJB(cvs head from 2 weeks ago) in Tomcat 5.0. There I have 
several PersistenceBroker which I close after each request with 
PersistenceBrokerFactory.realeaseAll().

After some time I get the following error:

org.apache.ojb.broker.PBFactoryException: Borrow broker from pool 
failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=intranet_tk, 
user=sa, password=*
	at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(PersistenceBrokerFactoryDefaultImpl.java:156)
	at 
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(PersistenceBrokerFactory.java:125)
	at kos.wnetz.system.Parameter.getPBFromName(Parameter.java:945)
	at kos.wnetz.system.Parameter.getTokenPB(Parameter.java:289)
	at kos.wnetz.om.Adapter.getInstance(Adapter.java:36)
	at kos.wnetz.system.Parameter.createInstance(Parameter.java:842)
	at kos.wnetz.system.Parameter.createInstance(Parameter.java:781)
	at kos.wnetz.system.Parameter.createInstance(Parameter.java:865)
	at kos.wnetz.servlets.WNetz.doRequest(WNetz.java:91)
	at kos.wnetz.servlets.WNetz.doGet(WNetz.java:61)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	.

But the thing is: I don't even use connection pooling (or so I think). I 
activated the line

ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl

in the OJB.properties file. So I think, that ConnectionPooling is 
switched off. Or do I have to change these settings in the 
connection-descriptors?

Do you have any suggestions?
Tino


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


OJB throws OJBRuntimeException if two applications are deployed on AppServer

2004-02-24 Thread Rick
Hi,

We have developed two applications. Both use OJB for persistence. When we 
deploy them together on Sun One Application server, we find the one deployed 
last doesn't work. It throws the org.apache.ojb.broker.OJBRuntimeException 
exception when trying to load the objects that represent the tables in the 
database.

We searched around a little and found this occurs in the Orion application 
server as well.

Could anyone suggest any steps to be taken to get around this problem?

By the way, we rebuild our applications as .WAR files, deployed them on Tomcat 
and found them to work fine.

Here's (part of) the stack trace from Sun One:

Root Cause 
org.apache.ojb.broker.OJBRuntimeException: Class, TCIS_ASC.valueobject.Person, 
could not be found.
at 
org.apache.ojb.broker.metadata.DescriptorRepository.discoverDescriptor(Unknown 
Source)
at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor
(Unknown Source)
at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor
(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorByQuery
(Unknown Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery
(Unknown Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery
(Unknown Source)
at TCIS_ASC.dataaccess.ApplicationOJBDAO.getAllApplications
(ApplicationOJBDAO.java:97)
at TCIS_ASC.service.SearchService.searchApplicant
(SearchService.java:64)
at TCIS_ASC.action.AppStatusSearchAction.execute
(AppStatusSearchAction.java:79)
at org.apache.struts.action.RequestProcessor.processActionPerform
(RequestProcessor.

Caused by: java.lang.ClassNotFoundException: TCIS_ASC.valueobject.Person
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)


Thanks & Regards

Rick



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



select oql query

2004-02-24 Thread Ori Shen
Hi,
I'm trying to use the following query :
select all from TABLES_NAME where first_colume = second_colume 

Instead of getting only the recordes which both columes values are equal, I get all 
records
in the table.
Can anyone knows why? and what should I do?

thanks in advance



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



Re: Error : Can not init Identity for given object

2004-02-24 Thread Armin Waibel
Hi Fernando,

is this the whole stack trace? If not please post the complete one.

regards,
Armin
Fernando Queiroz Fonseca wrote:
Hi.
I made download of ojb and I installed, I create the archives of repositories and I configured following tables in the archive repository_user.xml 




  







  

  


  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


  



e the archive repository_database.xml this of the following skill: 

 platform="MsSQLServer"
 jdbc-level="2.0" 
 driver="com.microsoft.jdbc.sqlserver.SQLServerDriver" 
 protocol="jdbc"
 subprotocol="microsoft"
 dbalias="sqlserver://feeltserver2.eletrica.ufu.br:1433;DatabaseName=sgbd" 
 username="java" 
 password="jsenha"
 eager-release="false"
 useAutoCommit="1"
 ignoreAutoCommitExceptions="false"
 batch-mode="false">

 
 
 







however when trying to insert without set the primary key (id) that I declared as auto-increment occurs the following error: 
br.com.fernandoqueiroz.exceptions.ParameterException: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object [EMAIL PROTECTED]
at br.com.fernandoqueiroz.sgbd.persistencia.OJBDaoFactory.insere(OJBDaoFactory.java:152)
at br.com.fernandoqueiroz.Teste.main(Teste.java:48)
please they help me?

---
Fernando Queiroz Fonseca
Analista e Programador Java/J2EE
Uberlândia - MG - Brasil
+55-0xx34-8801-9072
www.fernandoqueiroz.com.br
[EMAIL PROTECTED]
---
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Progress ?

2004-02-24 Thread eric barbe
Hi,

What do you mean with "you will have to generate the schema from Progress" ?
Does it mean that the driver does not support DDL ?

Thanks

Éric

-Message d'origine-
De : Mark Berry [mailto:[EMAIL PROTECTED]
Envoyé : lundi 23 février 2004 21:13
À : OJB Users List
Objet : Re: Progress ?


There are no free ones that I am aware of.
V9.1 Ships with one that works very well with OJB.
Unfortunatly you will have to generate the schema from Progress.

Regards

Mark

- Original Message -
From: "eric barbe" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, February 24, 2004 6:23 AM
Subject: RE: Progress ?


> JDBC driver exists, but is there a free version ?
> And does it work with OJB ?
>
> Thanks
>
> Éric
>
> -Message d'origine-
> De : eric barbe [mailto:[EMAIL PROTECTED]
> Envoyé : lundi 23 février 2004 17:52
> À : OJB
> Objet : Progress ?
>
>
> Hi,
>
> I want to know if somebody has worked with OJB and Progress V 8.
> If yes, can this persons give me where to found the jdbc driver and mail
us
> the repository.
>
> Thanks,
>
> Éric
>
>
> -
> 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]