db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: Problems upgrading OJB1.0rc4 -> OJB1.0.0
Date Wed, 25 Aug 2004 10:21:48 GMT
Hi Frank,

Frank Renaers wrote:
> Hi Armin,
> 
> I debugged the OJB source code.
> The PersistenceBroker.retrieveAllReferences method is working well.
> But the problem was that we were using the default value ("false") for
> auto-update.
> By debugging the source code, I discovered that this value is
> deprecated, and has to be replaced by "none"
> It's strange that the default value is a deprecated value ????
> 

In long term the true/false setting will be replaced by none/link/object 
(and maybe we have to rethink the whole auto-xxx settings ;-), split 
into auto-insert and auto-update, ...).
Some user criticize that the auto-update/delete 'false' setting does 
modify the referenced objects (by setting a FK value) and that this is 
not the expected behavior. So I introduced the new settings.

http://db.apache.org/ojb/docu/guides/basic-technique.html#Setting+Load%2C+Update%2C+and+Delete+Cascading
http://db.apache.org/ojb/docu/guides/basic-technique.html#1%3An+auto-xxx+setting


> <collection-descriptor
>      name="allArticlesInGroup"
>      element-class-ref="be.ikan.lib.ojb.bo.article.ArticleBean"
>      orderby="articleId"
>      sort="ASC"
>      proxy="true"    --> DEFAULT = auto-update=false
>   >
>     <inverse-foreignkey field-ref="productGroupId"/>
>   </collection-descriptor>
> </class-descriptor>
> 
> If auto-update=false and you are trying to insert the main-object,
> the related Collection objects will be stored also !!!!!!!!

If you set auto-update=false the referenced objects will be "linked". 
This means that the FK fields of the referenced objects will be set. To 
do this the proxy was materialized and the FK are set. But this should 
only happen when the main object was inserted or the proxy was already 
materialzed. On update the proxy should not be materialzed and modified.
And only if auto-update="object" is set, the referenced objects should 
be stored.

See PBImpl#storeAndLinkOneToMany

Or did you debug other behavior?

regards,
Armin

> That's the reason why my collection proxy (returned by
> retrieveAllReferences), was replaced by the results of a database
> select.
> 
> 
> Greetings,
> 
> Frank Renaers
> Ikan Software - Belgium
> 
> 
> -----Original Message-----
> From: Armin Waibel [mailto:arminw@apache.org] 
> Sent: dinsdag 24 augustus 2004 17:44
> To: OJB Users List
> Subject: Re: Problems upgrading OJB1.0rc4 -> OJB1.0.0
> 
> Hi Frank,
> 
> are you sure that this behavior has changed? I can't spot where the lazy
> 
> load flag of a collection will be ignored in PB.retrieveAllReferences().
> 
> Could you give me some more info?
> 
> regards,
> Armin
> 
> 
> Frank Renaers wrote:
> 
> 
>>Hi,
>>
>> 
>>
>>We upgraded from OJB1.0rc4 to OJB1.0.0
>>
>>It seems that the behaviour of the
>>PersistenceBroker.retrieveAllReferences() method has changed.
>>
>>In OJB1.0rc4 collection fields (1 - n relation) were replaced by a
>>proxy.
>>
>>In OJB 1.0.0 collection fields are replaced by the results of a
> 
> database
> 
>>select.
>>
>>Does someone have a solution for this ?
>>
>> 
>>
>>Thanks,
>>
>> 
>>
>>Frank Renaers
>>
>>Ikan Software - Belgium
>>
>> 
>>
>> 
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

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


Mime
View raw message