Re: Misc questions

2006-03-22 Thread Jean-Yves Sironneau
Ok i think i got it, thank you for the explanations.

2006/3/21, Armin Waibel [EMAIL PROTECTED]:

 Hi Jean-Yves,

 Jean-Yves Sironneau wrote:
  Hi,
 
  Thanks for your help, it works by locking the object inside a
 transaction
  and the
  setting the referenced object, what confused me is that for a new object
 you
  don't have to be within a transaction for the referenced object to be
  created, but for an existing one this is the case.
 

 The first one (new object) works by accident. In general OJB compares
 object snapshots (one object snapshot made on object lock, another
 snapshot made on commit), thus OJB can only detect changes when these
 snapshots are different. If you make changes on an (persistent) object
 before the object is locked you are lost.
 When store a new object it's easier for OJB to decide whether the object
 should be marked as dirty and whether the FK should be refreshed/set -
 it's always yes.

 regards,
 Armin


  Thank you.
 
  Jean-Yves
 
  2006/3/10, Armin Waibel [EMAIL PROTECTED]:
  Hi Jean-Yves,
 
  Jean-Yves Sironneau wrote:
  Hello,
 
  I looked more precisely at my issue regarding foreign keys not being
  set, so
  now i'am using official OJB 1.0.4.
 
  The exact issue is that when i persist a new object (that has not been
  persisted before), the linked object is persisted and the foreign key
 is
  set. But when i retrieve an object, then sets the linked object and
 then
  persists the main object this time the linked object is not persisted
  and
  the foreign key not set.
 
  I'am using the following code, to do the persistence, so the linked
  object
  is set before that code :
 
  Implementation impl = OJB.getInstance();
  TransactionExt tx = (TransactionExt) impl.newTransaction();
 
  tx.begin();
  tx.markDirty(product);
  tx.commit();
 
  Can that be the reason ? Is the way OJB is navigating the object graph
  different for an
  initial store or an update ?
 
  If you want i can try to package up a simple test case from that.
  Do you retrieve the object via oql-query and is implicit locking
 enabled?
 
  If you first lock the object and then set the linked object:
  Implementation impl = OJB.getInstance();
  TransactionExt tx = (TransactionExt) impl.newTransaction();
 
  tx.begin();
  tx.lock(obj, WRITE);
  obj.setLinked(objB);
  tx.commit();
 
  This way your test should pass.
 
  regards,
  Armin
 
 
  Thank you for your help.
 
  Jean-Yves
 
  2006/2/20, Jean-Yves Sironneau [EMAIL PROTECTED]:
  Hello, I have a few unrelated questions regarding OJB :
 
  - Is there a way to set the deferrable foreign key constraint setting
  using OJB xdoclet module ?
 
  - When i use anonymous foreign key in a relationship, it's working
  perfectly for collections, but
  for simple reference to an object, i have to store the referenced
  object
  and then store the object referencing
  it, otherwise the two objects are created in db but the foreign key
 id
  is
  not set.
 
  It's pretty hard to discover it because, when i retrieve the objects
  they
  are ok even if the db foreign key is not set. It's
  just later, if i restart my application for example, that the
  referenced
  objects fields are null.
 
  So i have two questions : Do you think it's normal behaviour ? And
 how
  can
  i force OJB to retrieve everything
  from database to be able to test this kind of possible issues ?
 
  By the way i'am using CVS version of OJB 1.1 approximately 2-3 months
  ago
  and the ODMG API
  (which is really working fine except for that).
 
  - Is the code for OJB 1.1 located in the 1.0 SVN branch ? Because i
  don't
  know if i better use
  OJB 1.0.4 (or future 1.0.5)  or the version i got from CVS.
 
 
  Thanks your for your help.
 
  Jean-Yves
 
 
  -
  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: Misc questions

2006-03-21 Thread Armin Waibel

Hi Jean-Yves,

Jean-Yves Sironneau wrote:

Hi,

Thanks for your help, it works by locking the object inside a transaction
and the
setting the referenced object, what confused me is that for a new object you
don't have to be within a transaction for the referenced object to be
created, but for an existing one this is the case.



The first one (new object) works by accident. In general OJB compares 
object snapshots (one object snapshot made on object lock, another 
snapshot made on commit), thus OJB can only detect changes when these 
snapshots are different. If you make changes on an (persistent) object 
before the object is locked you are lost.
When store a new object it's easier for OJB to decide whether the object 
should be marked as dirty and whether the FK should be refreshed/set - 
it's always yes.


regards,
Armin



Thank you.

Jean-Yves

2006/3/10, Armin Waibel [EMAIL PROTECTED]:

Hi Jean-Yves,

Jean-Yves Sironneau wrote:

Hello,

I looked more precisely at my issue regarding foreign keys not being

set, so

now i'am using official OJB 1.0.4.

The exact issue is that when i persist a new object (that has not been
persisted before), the linked object is persisted and the foreign key is
set. But when i retrieve an object, then sets the linked object and then
persists the main object this time the linked object is not persisted

and

the foreign key not set.

I'am using the following code, to do the persistence, so the linked

object

is set before that code :

Implementation impl = OJB.getInstance();
TransactionExt tx = (TransactionExt) impl.newTransaction();

tx.begin();
tx.markDirty(product);
tx.commit();

Can that be the reason ? Is the way OJB is navigating the object graph
different for an
initial store or an update ?

If you want i can try to package up a simple test case from that.

Do you retrieve the object via oql-query and is implicit locking enabled?

If you first lock the object and then set the linked object:

Implementation impl = OJB.getInstance();
TransactionExt tx = (TransactionExt) impl.newTransaction();

tx.begin();
tx.lock(obj, WRITE);

obj.setLinked(objB);

tx.commit();


This way your test should pass.

regards,
Armin



Thank you for your help.

Jean-Yves

2006/2/20, Jean-Yves Sironneau [EMAIL PROTECTED]:

Hello, I have a few unrelated questions regarding OJB :

- Is there a way to set the deferrable foreign key constraint setting
using OJB xdoclet module ?

- When i use anonymous foreign key in a relationship, it's working
perfectly for collections, but
for simple reference to an object, i have to store the referenced

object

and then store the object referencing
it, otherwise the two objects are created in db but the foreign key id

is

not set.

It's pretty hard to discover it because, when i retrieve the objects

they

are ok even if the db foreign key is not set. It's
just later, if i restart my application for example, that the

referenced

objects fields are null.

So i have two questions : Do you think it's normal behaviour ? And how

can

i force OJB to retrieve everything
from database to be able to test this kind of possible issues ?

By the way i'am using CVS version of OJB 1.1 approximately 2-3 months

ago

and the ODMG API
(which is really working fine except for that).

- Is the code for OJB 1.1 located in the 1.0 SVN branch ? Because i

don't

know if i better use
OJB 1.0.4 (or future 1.0.5)  or the version i got from CVS.


Thanks your for your help.

Jean-Yves



-
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: Misc questions

2006-03-09 Thread Jean-Yves Sironneau
I forgot to tell that to raise this issue i have to clear the persistencer
cache, otherwise everything seem's to be ok.

2006/3/7, Jean-Yves Sironneau [EMAIL PROTECTED]:

 Hello,

 I looked more precisely at my issue regarding foreign keys not being set,
 so now i'am using official OJB 1.0.4.

 The exact issue is that when i persist a new object (that has not been
 persisted before), the linked object is persisted and the foreign key is
 set. But when i retrieve an object, then sets the linked object and then
 persists the main object this time the linked object is not persisted and
 the foreign key not set.

 I'am using the following code, to do the persistence, so the linked object
 is set before that code :

 Implementation impl = OJB.getInstance();
 TransactionExt tx = (TransactionExt)
 impl.newTransaction();

 tx.begin();
 tx.markDirty(product);
 tx.commit();

 Can that be the reason ? Is the way OJB is navigating the object graph 
 different for an
 initial store or an update ?


 If you want i can try to package up a simple test case from that.


 Thank you for your help.

 Jean-Yves

 2006/2/20, Jean-Yves Sironneau  [EMAIL PROTECTED]:
 
  Hello, I have a few unrelated questions regarding OJB :
 
  - Is there a way to set the deferrable foreign key constraint setting
  using OJB xdoclet module ?
 
  - When i use anonymous foreign key in a relationship, it's working
  perfectly for collections, but
  for simple reference to an object, i have to store the referenced object
  and then store the object referencing
  it, otherwise the two objects are created in db but the foreign key id
  is not set.
 
  It's pretty hard to discover it because, when i retrieve the objects
  they are ok even if the db foreign key is not set. It's
  just later, if i restart my application for example, that the referenced
  objects fields are null.
 
  So i have two questions : Do you think it's normal behaviour ? And how
  can i force OJB to retrieve everything
  from database to be able to test this kind of possible issues ?
 
  By the way i'am using CVS version of OJB 1.1 approximately 2-3 months
  ago and the ODMG API
  (which is really working fine except for that).
 
  - Is the code for OJB 1.1 located in the 1.0 SVN branch ? Because i
  don't know if i better use
  OJB 1.0.4 (or future 1.0.5)  or the version i got from CVS.
 
 
  Thanks your for your help.
 
  Jean-Yves
 
 



Re: Misc questions

2006-03-09 Thread Jean-Yves Sironneau
Hello,

I looked more precisely at my issue regarding foreign keys not being set, so
now i'am using official OJB 1.0.4.

The exact issue is that when i persist a new object (that has not been
persisted before), the linked object is persisted and the foreign key is
set. But when i retrieve an object, then sets the linked object and then
persists the main object this time the linked object is not persisted and
the foreign key not set.

I'am using the following code, to do the persistence, so the linked object
is set before that code :

Implementation impl = OJB.getInstance();
TransactionExt tx = (TransactionExt) impl.newTransaction();

tx.begin();
tx.markDirty(product);
tx.commit();

Can that be the reason ? Is the way OJB is navigating the object graph
different for an
initial store or an update ?

If you want i can try to package up a simple test case from that.


Thank you for your help.

Jean-Yves

2006/2/20, Jean-Yves Sironneau [EMAIL PROTECTED]:

 Hello, I have a few unrelated questions regarding OJB :

 - Is there a way to set the deferrable foreign key constraint setting
 using OJB xdoclet module ?

 - When i use anonymous foreign key in a relationship, it's working
 perfectly for collections, but
 for simple reference to an object, i have to store the referenced object
 and then store the object referencing
 it, otherwise the two objects are created in db but the foreign key id is
 not set.

 It's pretty hard to discover it because, when i retrieve the objects they
 are ok even if the db foreign key is not set. It's
 just later, if i restart my application for example, that the referenced
 objects fields are null.

 So i have two questions : Do you think it's normal behaviour ? And how can
 i force OJB to retrieve everything
 from database to be able to test this kind of possible issues ?

 By the way i'am using CVS version of OJB 1.1 approximately 2-3 months ago
 and the ODMG API
 (which is really working fine except for that).

 - Is the code for OJB 1.1 located in the 1.0 SVN branch ? Because i don't
 know if i better use
 OJB 1.0.4 (or future 1.0.5)  or the version i got from CVS.


 Thanks your for your help.

 Jean-Yves




Re: Misc questions

2006-02-21 Thread Armin Waibel

Hi Jean-Yves,

Jean-Yves Sironneau wrote:

Hello, I have a few unrelated questions regarding OJB :

- Is there a way to set the deferrable foreign key constraint setting using
OJB xdoclet module ?



Assume no. But Tom have much more experience with xdoclet, so he can 
give you a professional answer.




- When i use anonymous foreign key in a relationship, it's working perfectly
for collections, but
for simple reference to an object, i have to store the referenced object and
then store the object referencing
it, otherwise the two objects are created in db but the foreign key id is
not set.


I don't know about such an issue. But your question isn't detailed 
(auto-xxx settings, sample code, metadata mapping), so it's not possible 
to answer this. In generally anonymous FK should show same behavior as 
normal FK fields.





It's pretty hard to discover it because, when i retrieve the objects they
are ok even if the db foreign key is not set. It's
just later, if i restart my application for example, that the referenced
objects fields are null.

So i have two questions : Do you think it's normal behaviour ? And how can i
force OJB to retrieve everything
from database to be able to test this kind of possible issues ?



It would be helpful if you can provide a test (source + mapping) to 
reproduce the issue.




By the way i'am using CVS version of OJB 1.1 approximately 2-3 months ago
and the ODMG API
(which is really working fine except for that).


The 1.x trunk isn't for production environments



- Is the code for OJB 1.1 located in the 1.0 SVN branch ? Because i don't
know if i better use
OJB 1.0.4 (or future 1.0.5)  or the version i got from CVS.


SVN trunk is OJB 1.x (early alpha state). The OJB_1_0_RELEASE branch is 
OJB 1.0.x (upcoming 1.0.5).
So it's recommended to use 1.0.4 or the OJB_1_0_RELEASE branch (run the 
test suite to get an impression of current stability - this will show 
open issues).


regards,
Armin

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



Misc questions

2006-02-20 Thread Jean-Yves Sironneau
Hello, I have a few unrelated questions regarding OJB :

- Is there a way to set the deferrable foreign key constraint setting using
OJB xdoclet module ?

- When i use anonymous foreign key in a relationship, it's working perfectly
for collections, but
for simple reference to an object, i have to store the referenced object and
then store the object referencing
it, otherwise the two objects are created in db but the foreign key id is
not set.

It's pretty hard to discover it because, when i retrieve the objects they
are ok even if the db foreign key is not set. It's
just later, if i restart my application for example, that the referenced
objects fields are null.

So i have two questions : Do you think it's normal behaviour ? And how can i
force OJB to retrieve everything
from database to be able to test this kind of possible issues ?

By the way i'am using CVS version of OJB 1.1 approximately 2-3 months ago
and the ODMG API
(which is really working fine except for that).

- Is the code for OJB 1.1 located in the 1.0 SVN branch ? Because i don't
know if i better use
OJB 1.0.4 (or future 1.0.5)  or the version i got from CVS.


Thanks your for your help.

Jean-Yves