You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Jean-Yves Sironneau <ep...@gmail.com> on 2006/02/20 12:12:59 UTC

Misc questions

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: null super references with odmg?

Posted by Armin Waibel <ar...@apache.org>.
Hi Brian,

if this issue isn't the same as in your later post "Expected Extent 
Behavior?" and does not mix different inheritance strategies (which is 
not supported), please provide a more detailed description so that I can 
implement a test case to reproduce the issue.

regards,
Armin

Brian Latimer wrote:
> I have an Interface "Substance" with multiple extent classes including 
> "ProductSubstance."  All the extent classes of  "Substance" extend the 
> "SubstanceBean" class and have a super reference to it.
> 
> Recently I switched from using a striaght PB query for collections of 
> "Substance" interface objects to using a PB inside of an ODMG 
> transaction for the same thing.
> 
> The query had worked priviously, but now I get null values for all the 
> super fields.
> 
> During execution I get the following:
> 
> 
> 1382710 DEBUG [http-8080-Processor23] 
> metadata.SuperReferenceDescriptor$SuperReferenceField - Copy fields from
> source object 'org.aspca.substance.ProductSubstanceBean'
> using source fields declared in 'org.aspca.substance.SubstanceBean'
> to target object 'org.aspca.substance.ProductSubstanceBean'
> using target fields declared in 'org.aspca.substance.SubstanceBean'
> the fields to copy are declared in 'org.aspca.substance.SubstanceBean' 
> class
> the used classes are associated by java inheritance: true
> 
> ...and then later during the same query...
> 
> 1383351 DEBUG [http-8080-Processor23] 
> metadata.SuperReferenceDescriptor$SuperReferenceField - Copy fields from
> source object 'null'
> using source fields declared in 'org.aspca.substance.SubstanceBean'
> to target object 'org.aspca.substance.ProductSubstanceBean'
> using target fields declared in 'org.aspca.substance.SubstanceBean'
> the fields to copy are declared in 'org.aspca.substance.SubstanceBean' 
> class
> the used classes are associated by java inheritance: true
> 
> 
> The first superreference seems to be copying from a productsubstance to 
> a productsubstance using fields from substancebean and the second seems 
> to be copying fields from a null substancebean object.
> In any case, I always end up with null values for all super fields 
> including the PK field, but I get real values for all the child fields 
> (except the PK/FK).
> 
> Any idea what causes this? If more detailed code/repository information 
> would be helpful I can supply it.
> 
> thanks for any help
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


null super references with odmg?

Posted by Brian Latimer <bl...@apcc.aspca.org>.
I have an Interface "Substance" with multiple extent classes including 
"ProductSubstance."  All the extent classes of  "Substance" extend the 
"SubstanceBean" class and have a super reference to it.

Recently I switched from using a striaght PB query for collections of 
"Substance" interface objects to using a PB inside of an ODMG 
transaction for the same thing.

The query had worked priviously, but now I get null values for all the 
super fields.

During execution I get the following:


1382710 DEBUG [http-8080-Processor23] 
metadata.SuperReferenceDescriptor$SuperReferenceField - Copy fields from
source object 'org.aspca.substance.ProductSubstanceBean'
using source fields declared in 'org.aspca.substance.SubstanceBean'
to target object 'org.aspca.substance.ProductSubstanceBean'
using target fields declared in 'org.aspca.substance.SubstanceBean'
the fields to copy are declared in 'org.aspca.substance.SubstanceBean' class
the used classes are associated by java inheritance: true

...and then later during the same query...

1383351 DEBUG [http-8080-Processor23] 
metadata.SuperReferenceDescriptor$SuperReferenceField - Copy fields from
source object 'null'
using source fields declared in 'org.aspca.substance.SubstanceBean'
to target object 'org.aspca.substance.ProductSubstanceBean'
using target fields declared in 'org.aspca.substance.SubstanceBean'
the fields to copy are declared in 'org.aspca.substance.SubstanceBean' class
the used classes are associated by java inheritance: true


The first superreference seems to be copying from a productsubstance to 
a productsubstance using fields from substancebean and the second seems 
to be copying fields from a null substancebean object.
In any case, I always end up with null values for all super fields 
including the PK field, but I get real values for all the child fields 
(except the PK/FK).

Any idea what causes this? 
If more detailed code/repository information would be helpful I can 
supply it.

thanks for any help


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Misc questions

Posted by Jean-Yves Sironneau <ep...@gmail.com>.
Thank you, Armin, I think i'am gonna try to use OJB 1.0.4, and if it does
not work i'll post details about my issue.

Jean-Yves


2006/2/21, Armin Waibel <ar...@apache.org>:
>
> 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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: Misc questions

Posted by Armin Waibel <ar...@apache.org>.
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Misc questions

Posted by Jean-Yves Sironneau <ep...@gmail.com>.
Ok i think i got it, thank you for the explanations.

2006/3/21, Armin Waibel <ar...@apache.org>:
>
> 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 <ar...@apache.org>:
> >> 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 <ep...@gmail.com>:
> >>>> 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: ojb-user-unsubscribe@db.apache.org
> >> For additional commands, e-mail: ojb-user-help@db.apache.org
> >>
> >>
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: Misc questions

Posted by Armin Waibel <ar...@apache.org>.
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 <ar...@apache.org>:
>> 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 <ep...@gmail.com>:
>>>> 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: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Misc questions

Posted by Jean-Yves Sironneau <ep...@gmail.com>.
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.

Thank you.

Jean-Yves

2006/3/10, Armin Waibel <ar...@apache.org>:
>
> 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 <ep...@gmail.com>:
> >> 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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: Misc questions

Posted by Armin Waibel <ar...@apache.org>.
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 <ep...@gmail.com>:
>> 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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Misc questions

Posted by Jean-Yves Sironneau <ep...@gmail.com>.
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 <ep...@gmail.com>:
>
> 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 < epsout@gmail.com>:
> >
> > 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

Posted by Jean-Yves Sironneau <ep...@gmail.com>.
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 <ep...@gmail.com>:
>
> 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
>
>