ojb-user@db.apache.org
[Top] [All Lists]

storing sequence of nested objects

Subject: storing sequence of nested objects
From:
Date: Wed, 27 Oct 2004 13:07:16 +0200
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.


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 ?


Kind regards
Henrik

Hi Henrik,

Henrik_Sorensen@xxxxxxxxxxx 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@xxxxxxxxxxxxx
For additional commands, e-mail: ojb-user-help@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>