RC1 Junit test results for SQL Server

2003-03-05 Thread Mark Rowell
Hi

i thought the following would be useful. I ran the unit tests for SQLServer
using boith the MS JDBC driver and the 
JSQLConnect driver. The results are as follows (N.B this is a straight out
of teh box run):

MS JDBC Driver
[junit] Running org.apache.ojb.broker.AllTests
[junit] Tests run: 187, Failures: 0, Errors: 0, Time elapsed: 92.844 sec
[junit] Running org.apache.ojb.odmg.AllTests
[junit] [BOOT] INFO: OJB.properties:
file:/D:/apps/db-ojb-1.0.rc1/target/test/ojb/OJB.properties
[junit] Tests run: 150, Failures: 1, Errors: 0, Time elapsed: 40.172 sec
[junit] TEST org.apache.ojb.odmg.AllTests FAILED
[junit] Running org.apache.ojb.soda.AllTests
[junit] [BOOT] INFO: OJB.properties:
file:/D:/apps/db-ojb-1.0.rc1/target/test/ojb/OJB.properties
[junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 3.891 sec

As you can see there was on test failure for the ODMG test suite:

Testcase: testUpdateWithProxy took 4.766 sec
FAILED
Should have found article with name OneToManyUpdateTest
junit.framework.AssertionFailedError: Should have found article with name
OneToManyUpdateTest
at
org.apache.ojb.odmg.OneToManyTest.testUpdateWithProxy(OneToManyTest.java:181
)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

This was something to do with it
org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR: Commit on object level
failed for tx [EMAIL PROTECTED]
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Violation of UNIQUE
KEY constraint 'UQ__SITE__5A7B181B'. Cannot insert duplicate key in object
'SITE'.
[

For JSQLConnect it is another matter -- I get lots of problems, mostly to do
with the JDBC driver not being able to connect
to the server (interestingly, I did not get these errors on v 0.9.9):

junit-no-compile-no-prepare:
[junit] Running org.apache.ojb.broker.AllTests
[junit] Tests run: 187, Failures: 3, Errors: 3, Time elapsed: 49.813 sec
[junit] TEST org.apache.ojb.broker.AllTests FAILED
[junit] Running org.apache.ojb.odmg.AllTests
[junit] [BOOT] INFO: OJB.properties:
file:/D:/apps/db-ojb-1.0.rc1/target/test/ojb/OJB.properties
[junit] Tests run: 150, Failures: 0, Errors: 28, Time elapsed: 10.297
sec
snip
[junit] TEST org.apache.ojb.odmg.AllTests FAILED
[junit] Running org.apache.ojb.soda.AllTests
[junit] [BOOT] INFO: OJB.properties:
file:/D:/apps/db-ojb-1.0.rc1/target/test/ojb/OJB.properties
[junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 3.032 sec


The errors seem to happen due to rollbacks on underlying connections
failing. It all seems to do with getting autoincrement values
on sequence generators:

Testcase: testMultipleAutoincrement took 0.062 sec
Caused an ERROR
DBComms.transmit exception:[java.net.SocketException: Socket closed]
context:[(2) [Thread[main,5,main], IO:a73bf, Dbc:1429]]]
com.jnetdirect.jsql.x: DBComms.transmit exception:[java.net.SocketException:
Socket closed] context:[(2) [Thread[main,5,main], IO:a73bf, Dbc:1429]]]
at com.jnetdirect.jsql.h.a(Unknown Source)
at com.jnetdirect.jsql.au.a(Unknown Source)
at com.jnetdirect.jsql.JSQLConnection.prePrepare(Unknown Source)
at
com.jnetdirect.jsql.JSQLConnection.getPreparedStatementHandle(Unknown
Source)
at com.jnetdirect.jsql.ap.executeQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.materializeObject(JdbcAcces
sImpl.java:494)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker
Impl.java:640)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.store(DelegatingP
ersistenceBroker.java:152)
at
org.apache.ojb.broker.sequence.SequenceManagerTest.testMultipleAutoincrement
(SequenceManagerTest.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
rethrown as org.apache.ojb.broker.PersistenceBrokerSQLException:
DBComms.transmit exception:[java.net.SocketException: Socket closed]
context:[(2) [Thread[main,5,main], IO:a73bf, Dbc:1429]]]
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.materializeObject(JdbcAcces
sImpl.java:515)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker
Impl.java:640)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.store(DelegatingP
ersistenceBroker.java:152)
at
org.apache.ojb.broker.sequence.SequenceManagerTest.testMultipleAutoincrement
(SequenceManagerTest.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

Re: using OJB with Struts and Eclipse

2003-03-05 Thread Joerg Lensing
[EMAIL PROTECTED] schrieb:

Philippe, 

Another solution is:
create a new folder and put the conf files here
configure this folder as a source folder
when you build the project, your conf files will be automatically copied in 
WEB-INF/classes
Regards
Sylvain
 

this solution is not compliant  to the structure of  webApps. (see 
manual ojb). I think the tomcat-container needs
the conf-files in the WEB-INF/classes. To solve your problem, you can 
uncheck the option allow to clean output folders
for a full build in /preferences/java/compiler/build path (This works 
in Eclipse 2.1!!)

joerg



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


Re: automatically mapping inherited fields

2003-03-05 Thread Joerg Lensing
hi thomas,
this was exactly my question.
joerg
Thomas Mahler schrieb:

Hi Joerg,

I'm not quite sure if I got your question.
Are you asking if the field-descriptors for name and number must 
be present in the class-descriptors for the concrete classes, or if it 
is possible to just define them once in the base-classes descriptor?

The answer to this question is: No,they have to be defined in each 
concrete classes class-descriptor!

Thomas

Joerg Lensing wrote:

hi,
is it possible to map base-fields from a base-class?
Base-class: BaseX.class
   fields: name, number
(concrete) inherited classes: --ExtendedBaseX_A
--ExtendedBaseX_B
.|_-ExtendedBaseX_B_xyz
all Classes need the same fields name and number. They allways 
use the same
tablefieldnames (same and separate tables). Is there a way to map 
these two fields
automatically to the tables?

joerg



-
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: 1-1-Mapping: Referenced field must be primaryKey???

2003-03-05 Thread Joerg Lensing
Thomas Mahler schrieb:

Hi Joerg,

Joerg Lensing wrote:

Hi,
junit: Article - Produktgroup
Article holds an ID from Productgroup. In the  example it is the 
primaryKey from table Kategorien.


foreign keys from one table alway reference primary keys of another 
(or the same in case of self-join) table.

Can I use different field for it?


only by declaring it as primary key in the repository.

Thomas

i get the message:

WARN: OJB broker could not materialize AbstractPersistent{1332}

The number shown is the fieldvalue i want to use for referencing the 
productgroup.
But the IndirectionHanler uses the primaryKey (which in my case can't 
fit)

joerg



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

hi thomas,
is the primary key in the repository allways primary key of the 
database-table?
or do they only have to be unique values?

joerg



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


RE: 1-1-Mapping: Referenced field must be primaryKey???

2003-03-05 Thread Mahler Thomas
hi again,

snip
 
 hi thomas,
 is the primary key in the repository allways primary key of the 
 database-table?

not required

 or do they only have to be unique values?

Yes, that's sufficient.

cheers,
Thomas

 
 joerg
 
 
 
 -
 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: Does db-ojb-1.0.rc1.tgz depend on j2ee?

2003-03-05 Thread Adam Griffiths
Hi again,
Thanks for your replies Thomas. I downloaded j2sdkee1.3.1, installed it to
c:\j2sdkee1.3.1 and set my CLASSPATH to C:\j2sdkee1.3.1\lib. I tried
bin\build prepare-tutorials  and got the same error as before. I also
tried copying j2ee.jar to my C:\j2sdk1.4.1_01\lib and
C:\j2sdk1.4.1_01\lib\ext but neither work. Is there something I'm not
understanding?

Adam

The error again:

BUILD FAILED
file:C:/db-ojb-1.0.rc1/build.xml:184: j2ee.jar is missing! Please get it
from ht
tp://java.sun.com/j2ee/. Put it in lib or have the ant property j2ee.jars
point
at this jar file.


s_p_a_m_t_r_a_p   from:[EMAIL PROTECTED]
Do not email the above address or remove these two lines 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 05 March 2003 06:55
To: OJB Users List
Subject: Re: Does db-ojb-1.0.rc1.tgz depend on j2ee?



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



Re: using OJB with Struts and Eclipse

2003-03-05 Thread Will Jaynes
Another way to do it is to configure the WEB-INF/classes as a source 
directory (eventhough it is also the target directory) That way it 
doesn't get cleared. This works for me.

Will

[EMAIL PROTECTED] wrote:
Philippe, 

Another solution is:
create a new folder and put the conf files here
configure this folder as a source folder
when you build the project, your conf files will be automatically copied in 
WEB-INF/classes
Regards
Sylvain
-Message d'origine-
De: Christopher C Worley [mailto:[EMAIL PROTECTED]
Date: mardi, 4. mars 2003 19:57
À: OJB Users List
Objet: Re: using OJB with Struts and Eclipse
Philippe,

Change your eclipse build directory from /WEB-INF/classes to /classes.

-chris worley


Hello,

I am currently building a web application based on Tomcat and Struts, using
the Eclipse IDE.
Trying to use OJB as the persistence layer, I have the following problem :

The OJB spec. requires that the config files (OBJ.properties,
repository.xml...) be retrieved from the classpath,
which means, for a Tomcat application, in the WEB-INF/classes directory.
But any files I manually put there are
automatically removed by Eclipse if I rebuild the project, since this
directory is an output folder for class compilation !!
I've tried to work around this by creating another folder in my project
(say obj-config) and adding it to the classpath as a lib folder.
But my application doesn't seem to be able to find repository info there
(although it does if I run the same code as a Java application, i.e.
without Tomcat).
Can anyone help ?

Thanks,

Philippe



-
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: Does db-ojb-1.0.rc1.tgz depend on j2ee?

2003-03-05 Thread Yuji Shinozaki

I believe it is not sufficient to set your CLASSPATH environment, as that
will only affect the CLASSPATH that ant itself sees and not the classpath
that ant sets when it invokes javac.

You will need to put j2ee.jar into the ./lib directory (where it will be
automatically added to the compilation classpath) OR edit build.properties
and assign ${j2ee.jar} to point to the location of the j2ee.jar file.

Hope this helps,

yuji


On Wed, 5 Mar 2003, Adam Griffiths wrote:

 Hi again,
 Thanks for your replies Thomas. I downloaded j2sdkee1.3.1, installed it to
 c:\j2sdkee1.3.1 and set my CLASSPATH to C:\j2sdkee1.3.1\lib. I tried
 bin\build prepare-tutorials  and got the same error as before. I also
 tried copying j2ee.jar to my C:\j2sdk1.4.1_01\lib and
 C:\j2sdk1.4.1_01\lib\ext but neither work. Is there something I'm not
 understanding?

 Adam

 The error again:

 BUILD FAILED
 file:C:/db-ojb-1.0.rc1/build.xml:184: j2ee.jar is missing! Please get it
 from ht
 tp://java.sun.com/j2ee/. Put it in lib or have the ant property j2ee.jars
 point
 at this jar file.

 
 s_p_a_m_t_r_a_p   from:[EMAIL PROTECTED]
 Do not email the above address or remove these two lines

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 05 March 2003 06:55
 To: OJB Users List
 Subject: Re: Does db-ojb-1.0.rc1.tgz depend on j2ee?



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



Yuji Shinozaki  Computer Systems Senior Engineer
[EMAIL PROTECTED]   Advanced Technologies Group
(804)924-7171   Information Technology  Communication
http://www.people.virginia.edu/~ys2nUniversity of Virginia


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



Re: update setting FK to null

2003-03-05 Thread casterx
Tim,

OJB after .9.7 started to set the FK to null if the actual reference object
is null at the time of storage. This behavior broke my programs and I had to
comment out that line from the assertFK...() function inside
PersistaeceBrokerSingleVM.

I suggested making this an optional trait, to be set in the repository on
the reference object, but haven't heard anything from the developers.

Caster
- Original Message -
From: Tim Drury [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 5:32 PM
Subject: Re: update setting FK to null



 I forgot to mention I'm running 0.9.9.  Here is a little more info.  From
 my log:

 [17:08:04,955,OJBORMManager] DEBUG save: class=common.model.Note
 [17:08:04,955,OJBORMManager] DEBUG save:
 o=[Note:id=59,code=NOTE79,subcode=foo,ident=ID2564,desc=this is a debug
 note,ownerId=74,docId=16]
 [17:08:04,965,JdbcAccessImpl] ERROR SQLException during the execution of
 the update (for a common.model.Note): ERROR:  ExecUpdate: Fail to add null
 value in not null attribute documentid

 Note is the object that ties an Invoice and a Person object together in an
 M:N relationship.  It's PK is id=59.  It has two foreign keys, ownerId=74
 points to the Person and docId=16 points to the Invoice.  Upon saving, it
 tries to put null into the DOCUMENTID database column.  Here is my p6spy
 log:

 1046815684955|0|0|statement|SELECT

LASTMODIFIED,DOCUMENTID,TIMECREATED,IDENTIFIER,SUBCODE,OWNERID,CODE,DESCRIPT
ION,ID
 FROM shipnote WHERE ID = ? |SELECT

LASTMODIFIED,DOCUMENTID,TIMECREATED,IDENTIFIER,SUBCODE,OWNERID,CODE,DESCRIPT
ION,ID
 FROM shipnote WHERE ID = '59'

 1046815684965|0|0|statement|UPDATE shipnote SET TIMECREATED=?,
 LASTMODIFIED=?, CODE=?, SUBCODE=?, IDENTIFIER=?, DESCRIPTION=?, OWNERID=?,
 DOCUMENTID=? WHERE ID = ? |UPDATE shipnote SET TIMECREATED='2003-03-04
 17:08:04.154', LASTMODIFIED='2003-03-04 17:08:04.154', CODE='NOTE79',
 SUBCODE='foo', IDENTIFIER='ID2564', DESCRIPTION='this is a debug note',
 OWNERID='', DOCUMENTID='' WHERE ID = '59'

 I also tried making a trivial change to the Invoice object and save the
 invoice, but got the same docId=null error for the note even though I had
 not made any changes to the note object.

 Any ideas (any!) would be appreciated,

 -tim


 
  When I update the link object (the object between to others in an M:N
  relationship), the FKs to the outer objects are being set to null in
  outgoing SQL according to p6spy.  Am I forgetting to do something?  The
  code is the typical,
 
  broker.beginTransaction();
  broker.store(o);
  broker.commitTransaction();
 
  everything works fine when creating the objects the first time, only
  updates show this problem.
 
  I thought there was something on the list earlier about this but, alas,
  the archives (both jakarta and db) don't seem be getting updated since
  mid February.
 
  Thanks,
 
  -tim




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




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



problem with addPrefetchedRelationship

2003-03-05 Thread O'Reilly John
Hi,

I'm seeing what appears to be an issue when using addPrefetchedRelationship.
If I use addPrefetchedRelationship then each time I call
getCollectionByQuery (using the same query) the size of the related
collection increases each time (by the actual size).  

I've traced through the code and the problem seems to be as follows: 

The following is from RsIterator.java - the second time through owners
contains cached versions of the objects still populated with the related
collection.  The call to prefetchRelationship gets these again and adds them
to the already populated collection.

// materialize ALL owners of this Iterator
owners = getOwnerObjects();

// prefetch relationships and associate with owners
for (int i = 0; i  prefetchedRel.size(); i++)
{
prefetchers[i].prefetchRelationship(owners);
}

Rgds,
John




-Original Message-
From: Yuji Shinozaki [mailto:[EMAIL PROTECTED]
Sent: 05 March 2003 14:14
To: OJB Users List
Cc: [EMAIL PROTECTED]
Subject: RE: Does db-ojb-1.0.rc1.tgz depend on j2ee?



I believe it is not sufficient to set your CLASSPATH environment, as that
will only affect the CLASSPATH that ant itself sees and not the classpath
that ant sets when it invokes javac.

You will need to put j2ee.jar into the ./lib directory (where it will be
automatically added to the compilation classpath) OR edit build.properties
and assign ${j2ee.jar} to point to the location of the j2ee.jar file.

Hope this helps,

yuji


On Wed, 5 Mar 2003, Adam Griffiths wrote:

 Hi again,
 Thanks for your replies Thomas. I downloaded j2sdkee1.3.1, installed it to
 c:\j2sdkee1.3.1 and set my CLASSPATH to C:\j2sdkee1.3.1\lib. I tried
 bin\build prepare-tutorials  and got the same error as before. I also
 tried copying j2ee.jar to my C:\j2sdk1.4.1_01\lib and
 C:\j2sdk1.4.1_01\lib\ext but neither work. Is there something I'm not
 understanding?

 Adam

 The error again:

 BUILD FAILED
 file:C:/db-ojb-1.0.rc1/build.xml:184: j2ee.jar is missing! Please get it
 from ht
 tp://java.sun.com/j2ee/. Put it in lib or have the ant property j2ee.jars
 point
 at this jar file.

 
 s_p_a_m_t_r_a_p   from:[EMAIL PROTECTED]
 Do not email the above address or remove these two lines

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 05 March 2003 06:55
 To: OJB Users List
 Subject: Re: Does db-ojb-1.0.rc1.tgz depend on j2ee?



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



Yuji Shinozaki  Computer Systems Senior Engineer
[EMAIL PROTECTED]   Advanced Technologies Group
(804)924-7171   Information Technology 
Communication
http://www.people.virginia.edu/~ys2nUniversity of Virginia


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

This e-mail and any files transmitted with it are confidential and may be
privileged and are intended solely for the individual named/ for the use of
the individual or entity to whom they are addressed.If you are not the
intended addressee, you should not disseminate, distribute or copy this
e-mail.Please notify the sender immediately if you have received this e-mail
by mistake and delete this e-mail from your system.If you are not the
intended recipient, you are notified that reviewing, disclosing, copying,
distributing or taking any action in reliance on the contents of this e-mail
is strictly prohibited.Please note that any views or opinions expressed in
this e-mail are solely those of the author and do not necessarily represent
those of Traventec Limited.E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, or arrive late or incomplete.Traventec Limited therefore does not
accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission.The recipient should
check this e-mail and any attachments for the presence of viruses.This
e-mail has been swept for computer viruses however Traventec Limited accepts
no liability for any damage caused by any virus transmitted by this e-mail.

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



Re: problem with addPrefetchedRelationship

2003-03-05 Thread Jakob Braeuchi
hi john,

this is a really a problem, i'll have a look at it. but if you already 
have a fix just send it to me.

jakob

O'Reilly John wrote:

Hi,

I'm seeing what appears to be an issue when using addPrefetchedRelationship.
If I use addPrefetchedRelationship then each time I call
getCollectionByQuery (using the same query) the size of the related
collection increases each time (by the actual size).  

I've traced through the code and the problem seems to be as follows: 

The following is from RsIterator.java - the second time through owners
contains cached versions of the objects still populated with the related
collection.  The call to prefetchRelationship gets these again and adds them
to the already populated collection.
   // materialize ALL owners of this Iterator
   owners = getOwnerObjects();
   // prefetch relationships and associate with owners
   for (int i = 0; i  prefetchedRel.size(); i++)
   {
   prefetchers[i].prefetchRelationship(owners);
   }
Rgds,
John


-Original Message-
From: Yuji Shinozaki [mailto:[EMAIL PROTECTED]
Sent: 05 March 2003 14:14
To: OJB Users List
Cc: [EMAIL PROTECTED]
Subject: RE: Does db-ojb-1.0.rc1.tgz depend on j2ee?


I believe it is not sufficient to set your CLASSPATH environment, as that
will only affect the CLASSPATH that ant itself sees and not the classpath
that ant sets when it invokes javac.
You will need to put j2ee.jar into the ./lib directory (where it will be
automatically added to the compilation classpath) OR edit build.properties
and assign ${j2ee.jar} to point to the location of the j2ee.jar file.
Hope this helps,

yuji

On Wed, 5 Mar 2003, Adam Griffiths wrote:

 

Hi again,
Thanks for your replies Thomas. I downloaded j2sdkee1.3.1, installed it to
c:\j2sdkee1.3.1 and set my CLASSPATH to C:\j2sdkee1.3.1\lib. I tried
bin\build prepare-tutorials  and got the same error as before. I also
tried copying j2ee.jar to my C:\j2sdk1.4.1_01\lib and
C:\j2sdk1.4.1_01\lib\ext but neither work. Is there something I'm not
understanding?
Adam

The error again:

BUILD FAILED
file:C:/db-ojb-1.0.rc1/build.xml:184: j2ee.jar is missing! Please get it
from ht
tp://java.sun.com/j2ee/. Put it in lib or have the ant property j2ee.jars
point
at this jar file.

s_p_a_m_t_r_a_p   from:[EMAIL PROTECTED]
Do not email the above address or remove these two lines
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 05 March 2003 06:55
To: OJB Users List
Subject: Re: Does db-ojb-1.0.rc1.tgz depend on j2ee?


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

Yuji Shinozaki  Computer Systems Senior Engineer
[EMAIL PROTECTED]   Advanced Technologies Group
(804)924-7171   Information Technology 
Communication
http://www.people.virginia.edu/~ys2nUniversity of Virginia
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This e-mail and any files transmitted with it are confidential and may be
privileged and are intended solely for the individual named/ for the use of
the individual or entity to whom they are addressed.If you are not the
intended addressee, you should not disseminate, distribute or copy this
e-mail.Please notify the sender immediately if you have received this e-mail
by mistake and delete this e-mail from your system.If you are not the
intended recipient, you are notified that reviewing, disclosing, copying,
distributing or taking any action in reliance on the contents of this e-mail
is strictly prohibited.Please note that any views or opinions expressed in
this e-mail are solely those of the author and do not necessarily represent
those of Traventec Limited.E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, or arrive late or incomplete.Traventec Limited therefore does not
accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission.The recipient should
check this e-mail and any attachments for the presence of viruses.This
e-mail has been swept for computer viruses however Traventec Limited accepts
no liability for any damage caused by any virus transmitted by this e-mail.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



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


RE: problem with addPrefetchedRelationship

2003-03-05 Thread O'Reilly John
Hi jakob,
I don't really know the code well enough to offer a suggested fix. Also, I
suppose a difficulty with this is that a second query might return a mixture
of cached objects and those that need to be retrieved from the db.  The
cahced ones will already contain the collections whereas the others will
need their collection prefetched.  
Rgds,
John


-Original Message-
From: Jakob Braeuchi [mailto:[EMAIL PROTECTED]
Sent: 05 March 2003 15:14
To: OJB Users List
Subject: Re: problem with addPrefetchedRelationship


hi john,

this is a really a problem, i'll have a look at it. but if you already 
have a fix just send it to me.

jakob

O'Reilly John wrote:

Hi,

I'm seeing what appears to be an issue when using
addPrefetchedRelationship.
If I use addPrefetchedRelationship then each time I call
getCollectionByQuery (using the same query) the size of the related
collection increases each time (by the actual size).  

I've traced through the code and the problem seems to be as follows: 

The following is from RsIterator.java - the second time through owners
contains cached versions of the objects still populated with the related
collection.  The call to prefetchRelationship gets these again and adds
them
to the already populated collection.

// materialize ALL owners of this Iterator
owners = getOwnerObjects();

// prefetch relationships and associate with owners
for (int i = 0; i  prefetchedRel.size(); i++)
{
prefetchers[i].prefetchRelationship(owners);
}

Rgds,
John




-Original Message-
From: Yuji Shinozaki [mailto:[EMAIL PROTECTED]
Sent: 05 March 2003 14:14
To: OJB Users List
Cc: [EMAIL PROTECTED]
Subject: RE: Does db-ojb-1.0.rc1.tgz depend on j2ee?



I believe it is not sufficient to set your CLASSPATH environment, as that
will only affect the CLASSPATH that ant itself sees and not the classpath
that ant sets when it invokes javac.

You will need to put j2ee.jar into the ./lib directory (where it will be
automatically added to the compilation classpath) OR edit build.properties
and assign ${j2ee.jar} to point to the location of the j2ee.jar file.

Hope this helps,

yuji


On Wed, 5 Mar 2003, Adam Griffiths wrote:

  

Hi again,
Thanks for your replies Thomas. I downloaded j2sdkee1.3.1, installed it to
c:\j2sdkee1.3.1 and set my CLASSPATH to C:\j2sdkee1.3.1\lib. I tried
bin\build prepare-tutorials  and got the same error as before. I also
tried copying j2ee.jar to my C:\j2sdk1.4.1_01\lib and
C:\j2sdk1.4.1_01\lib\ext but neither work. Is there something I'm not
understanding?

Adam

The error again:

BUILD FAILED
file:C:/db-ojb-1.0.rc1/build.xml:184: j2ee.jar is missing! Please get it
from ht
tp://java.sun.com/j2ee/. Put it in lib or have the ant property j2ee.jars
point
at this jar file.


s_p_a_m_t_r_a_p   from:[EMAIL PROTECTED]
Do not email the above address or remove these two lines

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 05 March 2003 06:55
To: OJB Users List
Subject: Re: Does db-ojb-1.0.rc1.tgz depend on j2ee?



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





Yuji Shinozaki Computer Systems Senior Engineer
[EMAIL PROTECTED]  Advanced Technologies Group
(804)924-7171  Information Technology 
Communication
http://www.people.virginia.edu/~ys2nUniversity of Virginia


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

This e-mail and any files transmitted with it are confidential and may be
privileged and are intended solely for the individual named/ for the use of
the individual or entity to whom they are addressed.If you are not the
intended addressee, you should not disseminate, distribute or copy this
e-mail.Please notify the sender immediately if you have received this
e-mail
by mistake and delete this e-mail from your system.If you are not the
intended recipient, you are notified that reviewing, disclosing, copying,
distributing or taking any action in reliance on the contents of this
e-mail
is strictly prohibited.Please note that any views or opinions expressed in
this e-mail are solely those of the author and do not necessarily represent
those of Traventec Limited.E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, or arrive late or incomplete.Traventec Limited therefore does
not
accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission.The recipient
should
check this e-mail and any attachments 

Re: using OJB with Struts and Eclipse

2003-03-05 Thread David . Corbin

Put your configuration files in a source folder.  Non .java files in source
folders are copied into your classed dir automatically by ecilpse.


|-+---
| |   [EMAIL PROTECTED]|
| |   siea.fr |
| |   |
| |   03/04/2003 01:37|
| |   PM  |
| |   Please respond  |
| |   to OJB Users   |
| |   List   |
| |   |
|-+---
  
-|
  |
 |
  |To:  [EMAIL PROTECTED]  
|
  |cc: 
 |
  |Subject: using OJB with Struts and Eclipse  
 |
  |
 |
  
-|



Hello,

I am currently building a web application based on Tomcat and Struts, using
the Eclipse IDE.

Trying to use OJB as the persistence layer, I have the following problem :

The OJB spec. requires that the config files (OBJ.properties,
repository.xml...) be retrieved from the classpath,
which means, for a Tomcat application, in the WEB-INF/classes directory.
But any files I manually put there are
automatically removed by Eclipse if I rebuild the project, since this
directory is an output folder for class compilation !!

I've tried to work around this by creating another folder in my project
(say obj-config) and adding it to the classpath as a lib folder.
But my application doesn't seem to be able to find repository info there
(although it does if I run the same code as a Java application, i.e.
without Tomcat).

Can anyone help ?

Thanks,

Philippe



-
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: Anybody else have this problem?/Feature Idea

2003-03-05 Thread David . Corbin

Well, that's the way I do things, but not everyone has caught on.  I'll try
to drive that home.   Also, what I find I have to do for things to work
correctly, is write my setter to be smart.

public void setFoo(Foo foo)
{
  this.foo = foo;
  if (this.foo == null)
fooOid = 0;
  else
fooOid = foo.getOid();
}

Is that wrong?

Either way, I don't think this addresses the Collectio
But that still doesn't address the collection-descriptor problem.


I still think it would be a good safety feature to offer, as surely other
developers make the same mistakes our team does

David


|-+---
| |   Thomas Mahler   |
| |   [EMAIL PROTECTED] |
| |   Sent by:|
| |   [EMAIL PROTECTED]   |
| |   |
| |   |
| |   03/04/2003 02:29|
| |   PM  |
| |   Please respond  |
| |   to OJB Users   |
| |   List   |
| |   |
|-+---
  
-|
  |
 |
  |To:  OJB Users List [EMAIL PROTECTED] 
|
  |cc: 
 |
  |Subject: Re: Anybody else have this problem?/Feature Idea   
 |
  |
 |
  
-|



I absolutely agree with Charles!
the automatic handling of foreign keys was build to let developers
concentrate on business objects and not on rdbms details.

Thomas

Charles Anthony wrote:
 Hi,

 Developer should only ever set foo, and should never set fooId.

 OJB manages all foreign keys.

 In our app, we don't generate setters for any id fields (primary or
 foreign), and we only have a getter for the PK. Therefore, the developers
 find it much harder to fiddle with the keys.

 Cheers,

 Charles.



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 17:20
To: [EMAIL PROTECTED]
Subject: Anybody else have this problem?/Feature Idea


There are some aspects of OJB that require/encourage having
two pieces of
data to represent single relationship.

1) When I have an referenceDescriptor, I have to have a
fooOid, and a Foo,
both of which are two ways of referring to the same thing.
2) When I have a collectionDescriptor, I have a collection on
one side, and
a fooOid on the other, and sometimes I also have the Foo.

We have repeatedly run into problems where the developer will
correctly set
one of the many pieces of data, but not all of them.  This usually
manifests itself as an intermittent bug because the cached
objects don't
match the objects that are loaded from the database if they're
not in the
cache.

It would be really cool (IMO) if OJB had a mode that would
validate this
stuff when it goes to write to the database.

What do the rest of you think?

David




This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended
recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail
[EMAIL PROTECTED]



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




 This email and any attachments are strictly confidential and are intended
 solely for the addressee. If you are not the intended recipient you must
 not disclose, forward, copy or take any action in reliance on this
message
 or its attachments. If you have received this email in error please
notify
 the sender as soon as possible and delete it from your computer systems.
 Any views or opinions presented are solely those of the author and do not
 necessarily reflect those of HPD Software Limited or its affiliates.

  At present the integrity of email across the internet cannot be
guaranteed
 and messages sent via this medium are potentially at risk.  All liability
 is excluded to the extent permitted by law for any claims arising 

Re: update setting FK to null

2003-03-05 Thread Tim Drury

Caster - thank you.  I had set in the repository.xml not to auto-retrieve
the linked objects for Note since this would have caused a circular
reference.  While my FK IDs were correct and not null, the actual object
references were null so, as you said, it was trying to put null into the
database.  I'm not sure I understand this behavior either, but I don't
want to have my own patched ojb to maintain so I'll live with it.

I set auto-retrieve to true and the test case worked.  I think the correct
way to do this is using proxies since I don't really want to load the
linked objects because they have already been loaded.

Thanks again,

-tim


 Tim,

 OJB after .9.7 started to set the FK to null if the actual reference
 object is null at the time of storage. This behavior broke my programs
 and I had to comment out that line from the assertFK...() function
 inside
 PersistaeceBrokerSingleVM.

 I suggested making this an optional trait, to be set in the repository
 on the reference object, but haven't heard anything from the developers.

 Caster
 - Original Message -
 From: Tim Drury [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 04, 2003 5:32 PM
 Subject: Re: update setting FK to null



 I forgot to mention I'm running 0.9.9.  Here is a little more info.
 From my log:

 [17:08:04,955,OJBORMManager] DEBUG save: class=common.model.Note
 [17:08:04,955,OJBORMManager] DEBUG save:
 o=[Note:id=59,code=NOTE79,subcode=foo,ident=ID2564,desc=this is a
 debug note,ownerId=74,docId=16]
 [17:08:04,965,JdbcAccessImpl] ERROR SQLException during the execution
 of the update (for a common.model.Note): ERROR:  ExecUpdate: Fail to
 add null value in not null attribute documentid

 Note is the object that ties an Invoice and a Person object together
 in an M:N relationship.  It's PK is id=59.  It has two foreign keys,
 ownerId=74 points to the Person and docId=16 points to the Invoice.
 Upon saving, it tries to put null into the DOCUMENTID database column.
  Here is my p6spy log:

 1046815684955|0|0|statement|SELECT

 LASTMODIFIED,DOCUMENTID,TIMECREATED,IDENTIFIER,SUBCODE,OWNERID,CODE,DESCRIPT
 ION,ID
 FROM shipnote WHERE ID = ? |SELECT

 LASTMODIFIED,DOCUMENTID,TIMECREATED,IDENTIFIER,SUBCODE,OWNERID,CODE,DESCRIPT
 ION,ID
 FROM shipnote WHERE ID = '59'

 1046815684965|0|0|statement|UPDATE shipnote SET TIMECREATED=?,
 LASTMODIFIED=?, CODE=?, SUBCODE=?, IDENTIFIER=?, DESCRIPTION=?,
 OWNERID=?, DOCUMENTID=? WHERE ID = ? |UPDATE shipnote SET
 TIMECREATED='2003-03-04 17:08:04.154', LASTMODIFIED='2003-03-04
 17:08:04.154', CODE='NOTE79', SUBCODE='foo', IDENTIFIER='ID2564',
 DESCRIPTION='this is a debug note', OWNERID='', DOCUMENTID='' WHERE ID
 = '59'

 I also tried making a trivial change to the Invoice object and save
 the invoice, but got the same docId=null error for the note even
 though I had not made any changes to the note object.

 Any ideas (any!) would be appreciated,

 -tim


 
  When I update the link object (the object between to others in an
 M:N relationship), the FKs to the outer objects are being set to
 null in outgoing SQL according to p6spy.  Am I forgetting to do
 something?  The code is the typical,
 
  broker.beginTransaction();
  broker.store(o);
  broker.commitTransaction();
 
  everything works fine when creating the objects the first time, only
 updates show this problem.
 
  I thought there was something on the list earlier about this but,
 alas, the archives (both jakarta and db) don't seem be getting
 updated since mid February.
 
  Thanks,
 
  -tim




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



Réf. : Re: using OJB with Struts and Eclipse

2003-03-05 Thread Philippe . VOLLE

thanks for all the answers i got ; now my system finds the repository file.

however, i'm still having difficulties : here's what i get when executing a
call to
PersistenceBrokerFactory.createPersistenceBroker() (or as well to
defaultPersistenceBroker())


[BOOT] ERROR: Error in instantiation of PersistenceBrokerFactory class
Could not read repository class descriptor data, using repository:
repository.xml: no protocol: repository.dtd
java.net.MalformedURLException: no protocol: repository.dtd
 at java.net.URL.init(URL.java:579)
 at java.net.URL.init(URL.java:476)
 at java.net.URL.init(URL.java:425)
 at
org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:796)
 at
org.apache.xerces.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:756)
 at
org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:267)
 at
org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:826)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
 at
org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
 at
org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
 at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
 at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1108)
 at
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown
Source)


seems that it's not able to interpret the DOCTYPE declaration properly

my repository.xml and repository.dtd are in the same directory, and i built
them from examples provided in the distribution
i'm using db-ojb-1.0.rc1, eclipse 2.1 and tomcat 4.1

what i am doing wrong ?

philippe





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



Problem with ODMG, query , DList and ClassNotPersistenceCapableException

2003-03-05 Thread Olaf Meske
Hi everybody,

My installation worked well with the PersistenceBroker API, but then I
noticed that I have to use the ODMG implementation, for my special 
problem with updating contained collections.

I've got problems doing a simple query with the odmg implementation.
I searched the mailing list for similar problems, but I found no hints 
for my problem. I use only the newest ojb 0.9.9 with all jars and config 
files.
I try to get a collection with all entries of my table:

Java source code:

[...]
public ODMGCampaignDatastore() {
odmg = OJB.getInstance();
Database db = odmg.newDatabase();
try {
db.open(default, Database.OPEN_READ_WRITE);
} catch (ODMGException ex) {
logger.error(ex);
}
}
[...]
Campaign campaign = null;
DList tempList = null;
try {
Transaction tx = odmg.newTransaction();
tx.begin();
OQLQuery query = odmg.newOQLQuery();
query.create(select campaign from 
+ Campaign.class.getName() + where id=+id);
tempList = (DList) query.execute();
campaign = (Campaign) tempList.get(0);
tx.commit();
} catch (Exception e) {
logger.error(e);
}
[...]
All I got is a stacktrace with:
[...]
[ojb.odmg.collections.DListImpl] - generateNewId(298) -  - Generation of 
new id failed
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: 
org.apache.ojb.odmg.collections.DListImpl not found in OJB Repository
	at 
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(DescriptorRepository.java:305)
	at 
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(DescriptorRepository.java:318)
	at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getClassDescriptor(PersistenceBrokerImpl.java:1969)
	at 
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getClassDescriptor(DelegatingPersistenceBroker.java:252)
	at 
org.apache.ojb.odmg.collections.DListImpl.generateNewId(DListImpl.java:293)
	at org.apache.ojb.odmg.collections.DListImpl.init(DListImpl.java:117)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at java.lang.Class.newInstance0(Class.java:306)
	at java.lang.Class.newInstance(Class.java:259)
	at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1233)
	at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1363)
	at 
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1342)
	at 
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:284)
	at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(OQLQueryImpl.java:282)
	at 
com.iqnex.dpagkamdia.campaign.ODMGCampaignDatastore.getCampaignById(ODMGCampaignDatastore.java:98)

[...]

All I changed in my OBJ.properties are the log4 properties.
I tried to get fix the problem with query like
query.create(select * from 
+ Campaign.class.getName() + where id=+id);
But all I get was:
[...]
com.iqnex.dpagkamdia.searchEngine.DatastoreException: 
java.lang.NullPointerException
	at 
com.iqnex.dpagkamdia.campaign.ODMGCampaignDatastore.getCampaignById(ODMGCampaignDatastore.java:100)
[...]
Caused by: java.lang.NullPointerException
	at org.apache.ojb.odmg.oql.OQLParser.selectQuery(OQLParser.java:172)
	at org.apache.ojb.odmg.oql.OQLParser.buildQuery(OQLParser.java:95)
	at org.apache.ojb.odmg.oql.OQLQueryImpl.create(OQLQueryImpl.java:237)
	at org.apache.ojb.odmg.oql.OQLQueryImpl.create(OQLQueryImpl.java:208)
	at 
com.iqnex.dpagkamdia.campaign.ODMGCampaignDatastore.getCampaignById(ODMGCampaignDatastore.java:92)

Any help to get this simple query running will be very welcome.

Thanks,
Olaf


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


Re: Anybody else have this problem?/Feature Idea

2003-03-05 Thread Robert S. Sfeir
I do this too, and with just about all my get and set methods.  I  
believe it provides some kind of data which the developer or user can  
look at.  If the value is 0, then there must be something busted if you  
expected something else.  I do the same with Collections and business  
objects I create.

On Wednesday, Mar 5, 2003, at 10:41 US/Eastern,  
[EMAIL PROTECTED] wrote:

Well, that's the way I do things, but not everyone has caught on.   
I'll try
to drive that home.   Also, what I find I have to do for things to work
correctly, is write my setter to be smart.

public void setFoo(Foo foo)
{
  this.foo = foo;
  if (this.foo == null)
fooOid = 0;
  else
fooOid = foo.getOid();
}
Is that wrong?

Either way, I don't think this addresses the Collectio
But that still doesn't address the collection-descriptor problem.
I still think it would be a good safety feature to offer, as surely  
other
developers make the same mistakes our team does

David

|-+---
| |   Thomas Mahler   |
| |   [EMAIL PROTECTED] |
| |   Sent by:|
| |   [EMAIL PROTECTED]   |
| |   |
| |   |
| |   03/04/2003 02:29|
| |   PM  |
| |   Please respond  |
| |   to OJB Users   |
| |   List   |
| |   |
|-+---
-- 
-- 
-|
  | 

  |
  |To:  OJB Users List [EMAIL PROTECTED] 

  |
  |cc:  

  |
  |Subject: Re: Anybody else have this problem?/Feature Idea

  |
  | 

  |
-- 
-- 
-|


I absolutely agree with Charles!
the automatic handling of foreign keys was build to let developers
concentrate on business objects and not on rdbms details.
Thomas

Charles Anthony wrote:
Hi,

Developer should only ever set foo, and should never set fooId.

OJB manages all foreign keys.

In our app, we don't generate setters for any id fields (primary or
foreign), and we only have a getter for the PK. Therefore, the  
developers
find it much harder to fiddle with the keys.

Cheers,

Charles.



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 17:20
To: [EMAIL PROTECTED]
Subject: Anybody else have this problem?/Feature Idea
There are some aspects of OJB that require/encourage having
two pieces of
data to represent single relationship.
1) When I have an referenceDescriptor, I have to have a
fooOid, and a Foo,
both of which are two ways of referring to the same thing.
2) When I have a collectionDescriptor, I have a collection on
one side, and
a fooOid on the other, and sometimes I also have the Foo.
We have repeatedly run into problems where the developer will
correctly set
one of the many pieces of data, but not all of them.  This usually
manifests itself as an intermittent bug because the cached
objects don't
match the objects that are loaded from the database if they're
not in the
cache.
It would be really cool (IMO) if OJB had a mode that would
validate this
stuff when it goes to write to the database.
What do the rest of you think?

David



This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended
recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail
[EMAIL PROTECTED]


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


This email and any attachments are strictly confidential and are  
intended
solely for the addressee. If you are not the intended recipient you  
must
not disclose, forward, copy or take any action in reliance on this
message
or its attachments. If you have received this email in error please
notify
the sender as soon as possible and delete it from your 

Re: Ternary associations

2003-03-05 Thread Thomas Mahler
Hi again,

I followed your advise and added some more details. I thinks it's now 
really a useful example.
See here: 
http://cvs.apache.org/viewcvs/db-ojb/xdocs/faq.xml?rev=HEADcontent-type=text/vnd.viewcvs-markup

anything missing ?

thanks,
Thomas
Charles Anthony wrote:
Hi,

If you think it's useful, feel free.

As Phil has pointed out, the field-descriptors should be marked as PKs. If
you want to flesh it out a little (maybe chuck in the projects class
descriptor, or at the least the collection-descriptor), or change it any way
- be my guest.
Cheers,

Charles.


-Original Message-
From: Thomas Mahler [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 19:26
To: OJB Users List
Subject: Re: Ternary associations
Hi Charles,

thanks for the good explanation and sample (pseudo-) code.
I believed I had to write a testcase with an example, but I 
thinks it's 
not longer required as your sample gives the whole picture.

thanks for saving my evening!
Thomas
PS: If you don't mind I'll place this into our FAQ.

Charles Anthony wrote:

Hi,

OK, I think I understand what you want.

Why is this a special scenario ?

You can (and we have in our app) defined a class that represents the
relationship. We have mapped that to a table with the 
corresponding ids. We

can then do queries/updates on that relationship as with any other.

Here's an example : it's worked entirely in the email and is 
probably too

brief, so it doesn't compile and probably has errors. 
However, it should

illustrate that it is possible with OJB.

java class :

public class ProjectRelationship {
 Integer developerId;
 Integer languageId;
 Integer projectId;
 
 Developer developer;  
 Language lanuage;
 Project project;
/** Normal setters and getters **/
}

extract from the repository :

class-descriptor class=ProjectRelationship 
table=PROJECTRELATIONSHIP

 field-descriptor id=1 name=developerId column=DEVELOPER_ID
jdbc-type=INTEGER /
 field-descriptor id=2 name=languageId column=LANGUAGE_ID
jdbc-type=INTEGER /
 field-descriptor id=3 name=projectId column=PROJECT_ID
jdbc-type=INTEGER /
 reference-descriptor name=developer class-ref=Developer
   foreignkey field-id-ref=1 /
 /reference-descriptor
 reference-descriptor name=language class-ref=Language
   foreignkey field-id-ref=2 /
 /reference-descriptor
 reference-descriptor name=project class-ref=Project
   foreignkey field-id-ref=3 /
 /reference-descriptor
/class-descriptor
storing a relationship :

Developer d =  (create or retrieve);
Project p =  (create or retrieve);
Language l =  (create or retrieve);
ProjectRelationship r = new ProjectRelationship();
r.setDeveloper(dev);
r.setLanguage(l);
r.setProject(p);
Broker.store(r);

querying for all relationships that developer 'bob' has in 'java' :
Criteria criteria = new Criteria();
criteria.addEqualTo(developer.name,bob);
cirteria.addEquatTo(language.name,java);
Query q = new QueryByCriteria(ProjectRelationship.class, 
criteria, true);

Collection relationships = Broker.getCollectionByQuery(q);

You can then iterate through the relationships to get the projects.

You could also have on the Project class-descriptor a
collection-descriptor that returns all relationships 
associated with the

Project. If it was call projectRelationships the following 
would give you

all projects that have a relationship with bob and the 
language java.

Criteria criteria = new Criteria();
criteria.addEqualTo(projectRelationships.developer.name,bob);
cirteria.addEquatTo(projectRelationships.language.name,java);
Query q = new QueryByCriteria(Project.class, criteria, true);
Collection projects = Broker.getCollectionByQuery(q);
Hope that helps ,

Cheers,

Charles.



-Original Message-
From: O'Reilly John [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 16:22
To: 'OJB Users List'
Subject: RE: Ternary associations
Hi,

With a ternary relationship there are three (or more) objects 
'related' to
each other.  An example would be 'developer', 'language', 
'project'.  You
want to represent the combinations of these that exist.  It's 
realised by a
bridge table with 3 columns representing the foreign keys in 
the other 3
tables (just like an m:n association is represented by a table with 2
columns).

The following explains how hibernate supports ternary associations.
http://www.xylax.net/hibernate/ternary.html
Regards,
John
-Original Message-
From: Charles Anthony [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 16:08
To: 'OJB Users List'
Subject: RE: Ternary associations
I didn't know exactly what a Ternary association is. 
A quick google suggests that it is what OJB calls an M:N 

association (a

resolution for a many-many relationship).

If it is one of them, then yes, OJB does support it.

See 
http://db.apache.org/ojb/tutorial3.html#mapping%20m:n%20associations

Cheers,

Charles.



-Original Message-
From: O'Reilly John [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 15:58
To: 'OJB Users List'
Subject: RE: Ternary associations
Hi,

Sorry to 

Re: Date criteria

2003-03-05 Thread Scott W. Hill
That worked. Thanks!

On Wednesday, March 5, 2003, at 04:54 AM, Ron Gallagher wrote:

criteria.addGreaterOrEqualThan(lastActivity, date)
--Scott

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


assertFkAssignment() setting PK fields to null

2003-03-05 Thread Anthony Kong
Hi, all,
 
I am still using 0.9.8, and not sure if this is still an issue in later
version of OJB. But I hope anyone with information can drop me a hint
 
I have a class, says A, which has FK reference to a number of other classes,
says B, C. Now let's say A has two fields,
 
A.Field1
A.Field2
 
Both fields are primary keys to A and are forigen keys to B and C
respectively. So in the repository.xml it is something like
 
class A
field id=1 name=FieldA/
field id=2 name=FieldB/

field id=3 name=someOtherField/
 
reference-descriptor aFieldB
class-ref=B
foreignkey field-id-ref=1
foreignkey field-id-ref=2
/reference-descriptor
 
reference-descriptor aFieldC
class-ref=C
foreignkey field-id-ref=1
foreignkey field-id-ref=2
/reference-descriptor
/class
 
 
I have turned the auto-retrieval of C off, then I hit this problem:
 
when I try to update A (says changing the value in someOtherField) , I
dicovered that the key fields (FieldA and FieldB) are always set to null. It
is because in function assertFkAssignment() in PersistenceBrokerImpl, when a
referenced object (class C in this case) is null, the FK fields are set to
null, which happens to be primary fields as well. So the subsequent update
failed since the keys are not invalid. 
 
I guess the assetFkAssignment should not set the fields in class A to null
in this case, because the missing of the referenced object, C, is
purposeful. I wonder if 
1) someone has encountered this before?
2) is it a issue? or it is because i have used the auto-retrieval
improperly?
3) If it is a issue, what should be a solution? I guess the function should
not modify PK fields, and better still detect if auto-retrieval is in effect
or not.
4) Is it still the case in 0.9.9 and beyond. AFAIK, in 0.9.9, the function
assertFkAssignment is not changed at all?
 
 
I have simplified the case to illustrate the point. If you still like to see
the actual xml please kindly let me know.
 
 
Regards,
 
Anthony
 
 


RE: assertFkAssignment() setting PK fields to null

2003-03-05 Thread Tim Drury

I encountered this just yesterday and got my answer today.
Does anyone know if the email archives are going to be fixed
soon?

 I guess the assetFkAssignment should not set the fields in 
 class A to null in this case, because the missing of the 
 referenced object, C, is purposeful. I wonder if 
 1) someone has encountered this before?

yes

 2) is it a issue? or it is because i have used the 
 auto-retrieval improperly?

It seems to be the desired behavior

 3) If it is a issue, what should be a solution? I guess the 
 function should not modify PK fields, and better still detect 
 if auto-retrieval is in effect or not.

I cheated and set auto-retrieve to true, but I think the proper
way to solve this is via a proxy.

 4) Is it still the case in 0.9.9 and beyond. AFAIK, in 0.9.9, 
 the function assertFkAssignment is not changed at all?

This behavior happens in 0.9.9 and the latest in CVS also.  It
appears to be planned although it makes no sense to me.

-tim

Below is the email I got when I asked the same question yesterday:


Tim,

OJB after .9.7 started to set the FK to null if the actual reference
object is null at the time of storage. This behavior broke my programs
and I had to comment out that line from the assertFK...() function
inside PersistaeceBrokerSingleVM.

I suggested making this an optional trait, to be set in the repository
on the reference object, but haven't heard anything from the developers.

Caster



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



ODMG recursive locking / ConcurrentModificationException

2003-03-05 Thread V.B. Skrypnyk
Hi,

I found a thread on the list
(http://archives.apache.org/eyebrowse/[EMAIL PROTECTED]
he.orgmsgId=593039) in which it is said:
Indeed you stumbled across a bug in the ObjectEnvelopeTable class. The
bug was fixed on 2002/12/23 13:27:59 which means it is not available on
version 0.9.8. It is however available directly from the cvs server.

The Concurrent Modification Exception occurs while upgrading the
locks in a commit operation of the ObjectEnvelopeTable class. The
solution we came up with was to iterate over temporary vector while
upgrading the locks.

Cheers,
Luis Cruz
I have just downloaded the latest cvs version, and I have the same problem.
Did the change get lost by any chance?
--Bill
My stack trace:
 [java] java.util.ConcurrentModificationException [java] at
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444)
[java] [org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR: Commit on object
level failed for tx [EMAIL PROTECTED] [java]
at java.util.AbstractList$Itr.next(AbstractList.java:417) [java] at
org.apache.ojb.odmg.ObjectEnvelopeTable.commitAllEnvelopes(ObjectEnvelopeTab
le.java:218) [java] at
org.apache.ojb.odmg.ObjectEnvelopeTable.commit(ObjectEnvelopeTable.java:187)
[java] null [java] [org.apache.ojb.odmg.TransactionImpl] ERROR: Could
not prepare for commit: null [java] at
org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(TransactionImpl.java:3
26) [java] at
org.apache.ojb.odmg.TransactionImpl.prepare(TransactionImpl.java:575)
[java] at
org.apache.ojb.odmg.TransactionImpl.commit(TransactionImpl.java:525)
[java] at test.Test.main(Test.java:70) [java]
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback was
called, do rollback on current connection
[EMAIL PROTECTED] [java]
java.sql.SQLException: General error: Warning:  Some non-transactional
changed tables couldn't be rolled back [java] at
org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:497) [java]
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] ERROR: Rollback on
the underlying connection failed [java] at
org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:550) [java] at
org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java:635) [java] General
error: Warning:  Some non-transactional changed tables couldn't be rolled
back [java] at
org.gjt.mm.mysql.Connection.execSQL(Connection.java:882) [java] at
org.gjt.mm.mysql.Connection.execSQL(Connection.java:815) [java] at
org.gjt.mm.mysql.Connection.rollback(Connection.java:551) [java] at
com.p6spy.engine.logging.P6LogConnection.rollback(P6LogConnection.java:145)
[java] at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localRollback(Connec
tionManagerImpl.java:245) [java] at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.abortTransaction(Persis
tenceBrokerImpl.java:358) [java] at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.close(PersistenceBroker
Impl.java:320) [java] at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.close(DelegatingP
ersistenceBroker.java:132) [java] at
org.apache.ojb.broker.singlevm.PoolablePersistenceBroker.close(PoolablePersi
stenceBroker.java:28) [java] at
org.apache.ojb.odmg.TransactionImpl.doClose(TransactionImpl.java:424)
[java] at
org.apache.ojb.odmg.TransactionImpl.commit(TransactionImpl.java:548)
[java] at test.Test.main(Test.java:70) [java]
org.odmg.TransactionAbortedException [java] at
org.apache.ojb.odmg.ObjectEnvelopeTable.commit(ObjectEnvelopeTable.java:198)
[java] at
org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(TransactionImpl.java:3
26) [java] at
org.apache.ojb.odmg.TransactionImpl.prepare(TransactionImpl.java:575)
[java] at
org.apache.ojb.odmg.TransactionImpl.commit(TransactionImpl.java:525)
[java] at test.Test.main(Test.java:70) [java] Exception in thread
main [java] Java Result: 1



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



Re: ODMG recursive locking / ConcurrentModificationException

2003-03-05 Thread V.B. Skrypnyk
I just added code for a temporary vector and it worked. The change below
must have gotten lost.
Or was there a problem with the solution?
--Bill.

- Original Message -
From: V.B. Skrypnyk [EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 10:24 PM
Subject: ODMG recursive locking / ConcurrentModificationException


 Hi,

 I found a thread on the list

(http://archives.apache.org/eyebrowse/[EMAIL PROTECTED]
 he.orgmsgId=593039) in which it is said:
 Indeed you stumbled across a bug in the ObjectEnvelopeTable class. The
 bug was fixed on 2002/12/23 13:27:59 which means it is not available on
 version 0.9.8. It is however available directly from the cvs server.
 
 The Concurrent Modification Exception occurs while upgrading the
 locks in a commit operation of the ObjectEnvelopeTable class. The
 solution we came up with was to iterate over temporary vector while
 upgrading the locks.
 
 Cheers,
 Luis Cruz
 I have just downloaded the latest cvs version, and I have the same
problem.
 Did the change get lost by any chance?
 --Bill
 My stack trace:
  [java] java.util.ConcurrentModificationException [java] at
 java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444)
 [java] [org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR: Commit on object
 level failed for tx [EMAIL PROTECTED] [java]
 at java.util.AbstractList$Itr.next(AbstractList.java:417) [java]
at

org.apache.ojb.odmg.ObjectEnvelopeTable.commitAllEnvelopes(ObjectEnvelopeTab
 le.java:218) [java] at

org.apache.ojb.odmg.ObjectEnvelopeTable.commit(ObjectEnvelopeTable.java:187)
 [java] null [java] [org.apache.ojb.odmg.TransactionImpl] ERROR: Could
 not prepare for commit: null [java] at

org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(TransactionImpl.java:3
 26) [java] at
 org.apache.ojb.odmg.TransactionImpl.prepare(TransactionImpl.java:575)
 [java] at
 org.apache.ojb.odmg.TransactionImpl.commit(TransactionImpl.java:525)
 [java] at test.Test.main(Test.java:70) [java]
 [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback
was
 called, do rollback on current connection
 [EMAIL PROTECTED] [java]
 java.sql.SQLException: General error: Warning:  Some non-transactional
 changed tables couldn't be rolled back [java] at
 org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:497) [java]
 [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] ERROR: Rollback
on
 the underlying connection failed [java] at
 org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:550) [java]
at
 org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java:635) [java] General
 error: Warning:  Some non-transactional changed tables couldn't be rolled
 back [java] at
 org.gjt.mm.mysql.Connection.execSQL(Connection.java:882) [java] at
 org.gjt.mm.mysql.Connection.execSQL(Connection.java:815) [java] at
 org.gjt.mm.mysql.Connection.rollback(Connection.java:551) [java]
at

com.p6spy.engine.logging.P6LogConnection.rollback(P6LogConnection.java:145)
 [java] at

org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localRollback(Connec
 tionManagerImpl.java:245) [java] at

org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.abortTransaction(Persis
 tenceBrokerImpl.java:358) [java] at

org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.close(PersistenceBroker
 Impl.java:320) [java] at

org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.close(DelegatingP
 ersistenceBroker.java:132) [java] at

org.apache.ojb.broker.singlevm.PoolablePersistenceBroker.close(PoolablePersi
 stenceBroker.java:28) [java] at
 org.apache.ojb.odmg.TransactionImpl.doClose(TransactionImpl.java:424)
 [java] at
 org.apache.ojb.odmg.TransactionImpl.commit(TransactionImpl.java:548)
 [java] at test.Test.main(Test.java:70) [java]
 org.odmg.TransactionAbortedException [java] at

org.apache.ojb.odmg.ObjectEnvelopeTable.commit(ObjectEnvelopeTable.java:198)
 [java] at

org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(TransactionImpl.java:3
 26) [java] at
 org.apache.ojb.odmg.TransactionImpl.prepare(TransactionImpl.java:575)
 [java] at
 org.apache.ojb.odmg.TransactionImpl.commit(TransactionImpl.java:525)
 [java] at test.Test.main(Test.java:70) [java] Exception in thread
 main [java] Java Result: 1



 -
 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: assertFkAssignment() setting PK fields to null

2003-03-05 Thread Thomas Mahler
hi all
snip
Does anyone know if the email archives are going to be fixed
soon?
I've contacted the Apache administrators last week. But I did not get a 
reply so far.
So I really have no idea how long it will take...

Thomas

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


RE: automatically mapping inherited fields

2003-03-05 Thread Charles Anthony
Hi Thomas,

There is another mitigation to this problem: you can switch on 
loading a 
serialized version of the repository in OJB.properties. This will 
eliminate the parsing of repository.xml. (Well on the first start it 
still get's parsed...)

Hmm... looking at the CVS version of RepositoryPersistor, it seems that the
only time a serialized version is created is as a temp file, which is
deleted on exit. The serFile attribute is checked to see if it is not null;
the only place it is given a value is as a delete-on-exit temp file.

So, I'm not sure that that the feature is working as intended. My guess
was that just turning on the property would create a serialized file, which
would be loaded next time round. That doesn't seem to be the case.

Cheers,

Charles.




This email and any attachments are strictly confidential and are intended
solely for the addressee. If you are not the intended recipient you must
not disclose, forward, copy or take any action in reliance on this message
or its attachments. If you have received this email in error please notify
the sender as soon as possible and delete it from your computer systems.
Any views or opinions presented are solely those of the author and do not
necessarily reflect those of HPD Software Limited or its affiliates.

 At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk.  All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to 
HPD Software Limited or its affiliates.



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