[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ojb-user
Subject:    Re: storing sequence of nested objects
From:       Armin Waibel <arminw () apache ! org>
Date:       2004-10-27 18:09:26
Message-ID: 417FE456.70803 () apache ! org
[Download RAW message or body]

Henrik_Sorensen@rcomext.com wrote:
> Hi Armin,
> 
> Thanks for your answer.
> 
> Let me try to explain what we want to do:
> 
> This is what we want to achieve:
> 
>                 TB_MAIN
>            =================
>            /             \
>        SUB_TB_1        SUB_TB_2(*)
>        /      \
> SUB_SUB_TB_1  S_S_TB_2
> 
> 
> All tables are in a cascaded 1:n model.
> 
> Now, can I somehow ensure that the tables are stored in this order:
> tb_main
> sub_tb_1
> sub_sub_tb_1
> s_s_tb_2
> sub_tb_2
> 
> (*) The reason is, we have a trigger on the database that should only
> execute when all objects are stored.
>

This sounds similar to the cascading order of OJB.
OJB will first store tab_main (because no 1:1 references will be found),
then it will find two 1:n references sub_tb_1 and sub_tb_2. Assume the
order of collection-descriptor declaration in the tb_main
class-descriptor decides the order of 1:n reference calls while storing
the main object.
Thus I think OJB could do your intended order by playing with the order
of the collection-descriptors.


> 
> Another way to put this question: can we make any asumptions on the
> sequence of the <class-descriptor> tag in the repository file ?
> If the table sub_tb_2 is indeed the last <class-descriptor> in the
> repository file, can we then assume the store operation actually works as
> we intend ?
> 

The order of class-descriptor declaration has no influence of handling
references.


regards,
Armin


> 
> Kind regards
> Henrik
> 
> Hi Henrik,
> 
> Henrik_Sorensen@rcomext.com wrote:
> 
>>Dear List,
>>
>>Is there any way the influence the sequence that nested objects gets
> 
> stored
> 
>>in ?
>>
> 
> 
> No, OJB always store all 1:1 references of the main object first, then
> the main objects was stored and after that all 1:n and m:n references
> are stored.
> 
> If you need to store e.g. a collection object first try something like this
> 
> broker.beginTransaction()
> broker.store(refObject)
> mainObject.add(refObject)
> broker.store(mainOnbject)
> broker.commitTransaction()
> 
> this first insert the refObject without FK settings, then the refObject
> was added to the mainObject and the FK in refObject are set when the
> mainObject was stored.
> 
> 
> regards,
> Armin
> 
> 
>>We have a processing that requires the store to be done in a specific
>>order.
>>
>>Any hints or references would be greatly appreciated.
>>
>>Thanks for your help
>>
>>Henrik
> 
> 
> 
> 
> This e-mail, including attachments, is intended for the person(s) or
> company named and may contain confidential and/or legally privileged
> information. Unauthorized disclosure, copying or use of this information
> may be unlawful and is prohibited. If you are not the intended recipient,
> please delete this message and notify the sender
> 
> 
> 


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic