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 "Daniel R. Ambrosio" <jo...@uol.com.br> on 2003/09/25 21:50:26 UTC

Cascading insert

Hello guys,

I am using OJB rc3.
I pasted the mapping I use in my application below. 
The problem is the following: when I try to created an entry of 
ObligatoryProfileEntity I would expect that the reference field 
ObligatoryProfileURLEntity.url create the entry in the URL table, and 
just then it would attempt to insert the element of the collection 
ObligatoryProfileEntity.obligatoryProfileURLEntities.

But what is happening is that I get a Foreign Key Exception when I try 
to create ObligatoryProfileEntity in the table.

Am I missing something, or is this not the expected behavior?
Would I face this problem also in rc4?

Thanks in advance for any help!

-----------------------------------------------
<class-descriptor
    class="domain.entity.ObligatoryProfileEntity"
    table="obligatory_profile">
    . . . .
    <collection-descriptor
        name="obligatoryProfileURLEntities"
        element-class="ObligatoryProfileURLEntity"
        element-class-ref="domain.entity.ObligatoryProfileURLEntity"
        auto-update="true"
        field-ref="personId"
    >
        <inverse-foreignkey field-ref="personId"/>
      
    </collection-descriptor>
</class-descriptor>


<class-descriptor
    class="uol.meetings.domain.entity.ObligatoryProfileURLEntity"
    table="obligatoryprofile_url">
    . . .
    <reference-descriptor
        name="url"
        field-ref="urlId"       
        class-ref="domain.entity.URLEntity"
        uto-update="true">
        <foreignkey field-id-ref="5"/>
    </reference-descriptor>
                       
</class-descriptor>

<class-descriptor
    class="domain.entity.URLEntity"
    table="url">
    . . .
</class-descriptor>

-----------------------------------------------


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


Re: Cascading insert [SOLVED]

Posted by "Daniel R. Ambrosio" <jo...@uol.com.br>.
Never mind!!
I found a bug in one of my support classes!

Thanks anyway,
Daniel



Daniel R. Ambrosio wrote:

> Hello guys,
>
> I am using OJB rc3.
> I pasted the mapping I use in my application below. The problem is the 
> following: when I try to created an entry of ObligatoryProfileEntity I 
> would expect that the reference field ObligatoryProfileURLEntity.url 
> create the entry in the URL table, and just then it would attempt to 
> insert the element of the collection 
> ObligatoryProfileEntity.obligatoryProfileURLEntities.
>
> But what is happening is that I get a Foreign Key Exception when I try 
> to create ObligatoryProfileEntity in the table.
>
> Am I missing something, or is this not the expected behavior?
> Would I face this problem also in rc4?
>
> Thanks in advance for any help!
>
> -----------------------------------------------
> <class-descriptor
>    class="domain.entity.ObligatoryProfileEntity"
>    table="obligatory_profile">
>    . . . .
>    <collection-descriptor
>        name="obligatoryProfileURLEntities"
>        element-class="ObligatoryProfileURLEntity"
>        element-class-ref="domain.entity.ObligatoryProfileURLEntity"
>        auto-update="true"
>        field-ref="personId"
>    >
>        <inverse-foreignkey field-ref="personId"/>
>         </collection-descriptor>
> </class-descriptor>
>
>
> <class-descriptor
>    class="uol.meetings.domain.entity.ObligatoryProfileURLEntity"
>    table="obligatoryprofile_url">
>    . . .
>    <reference-descriptor
>        name="url"
>        field-ref="urlId"              class-ref="domain.entity.URLEntity"
>        uto-update="true">
>        <foreignkey field-id-ref="5"/>
>    </reference-descriptor>
>                       </class-descriptor>
>
> <class-descriptor
>    class="domain.entity.URLEntity"
>    table="url">
>    . . .
> </class-descriptor>
>
> -----------------------------------------------
>
>
> ---------------------------------------------------------------------
> 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