Hello,

a couple of Newbie question regarding how to handle non-decomposed m:n
mappings using odmg api.

I'm trying to setup a non-decomposed m:n association pretty much along the
lines of the example of tutorial 3.

I'm running SDK1.4.0, OJB-1.0.rc1, MySql Ver 11.11 Distrib 3.23.52

This is an excerpt of my repository_user.xml:

<class-descriptor
        class="BusinessObjects.BenutzerBO"
        table="BENUTZERBO">
        <field-descriptor
                name="id"
                column="ID"
                jdbc-type="INTEGER"
                primarykey="true"
                autoincrement="true"
        />
        <field-descriptor
                name="userName"
                column="USERNAME"
                jdbc-type="VARCHAR"
        />
        <field-descriptor
                name="emAddr"
                column="EMADDR"
                jdbc-type="VARCHAR"
        />
        <collection-descriptor
                name="privileges"
                auto-retrieve="true"
                auto-update="true"
                element-class-ref="BusinessObjects.PrivilegeBO"
                indirection-table="BENUTZERBOPRIVILEGEBO">
                        <fk-pointing-to-this-class column="BENUTZERBO_ID"/>
                        <fk-pointing-to-element-class column="PRIVILEGEBO_ID"/>
        </collection-descriptor>
</class-descriptor>

<class-descriptor
        class="BusinessObjects.PrivilegeBO"
        table="PRIVILEGEBO">
        <field-descriptor
                name="id"
                column="ID"
                jdbc-type="INTEGER"
                primarykey="true"
                autoincrement="true"
        />
        <field-descriptor
                name="privilegeName"
                column="PRIVILEGENAME"
                jdbc-type="VARCHAR"
        />
        <collection-descriptor
                name="members"
                auto-retrieve="true"
                auto-update="false"
                element-class-ref="BusinessObjects.BenutzerBO"
                indirection-table="BENUTZERBOPRIVILEGEBO">
                        <fk-pointing-to-this-class column="PRIVILEGEBO_ID"/>
                        <fk-pointing-to-element-class column="BENUTZERBO_ID"/>
        </collection-descriptor>
</class-descriptor>

When I try store for instance BusinessObjects.BenutzerBO to the persistant
database I always get the exception:

[org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR: Commit on object level
failed for tx [EMAIL PROTECTED]
Invalid argument value: Duplicate entry '201' for key 1
java.sql.BatchUpdateException: Invalid argument value: Duplicate entry '201'
for
 key 1

Looking into the database it looks as if the tables BENUTZERBO and
PRIVILEGEBO got correctly populated.

What went wrong?

Another question:
Do I have to manually generate the interim table BENUTZERBOPRIVILEGEBO?
If yes, why doesn't this get handled automatically by the 'forward-db'
target of the OJB build.xml file?

Many thanks in advance for your help.

regards,
Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to