think there is something wrong with the <fk-pointing-to... settings and element class setting. Further use similar auto-xxx settings first (try different later - I never tested different settings)

Profile:
...
<collection-descriptor name="organizations" element-class-ref="it.gesi.userprofiling.Organization"


collection-class="org.apache.ojb.broker.util.collections.ManageableVector"
            auto-retrieve="true"
            auto-update="true"
            auto-delete="link"
            indirection-table="dps_user_org">
        <fk-pointing-to-this-class column="user_id"/>
        <fk-pointing-to-element-class column="organization"/>
    </collection-descriptor>

I suppose the above settings are correct, then ==>

Organization:
....
<collection-descriptor name="users" element-class-ref="it.gesi.userprofiling.Organization"
#### ==> shouldn't it be Profile?


collection-class="org.apache.ojb.broker.util.collections.ManageableVector"
            auto-retrieve="true"
            auto-update="false"
            auto-delete="false"
### ==> try same settings as above first

            indirection-table="dps_user_org">
        <fk-pointing-to-this-class column="user_id"/>
        <fk-pointing-to-element-class column="organization"/>
### ==> should be vice versa

    </collection-descriptor>

regards,
Armin

p b wrote:
Thanks for the answer Armin

Here is the core of the StoreUseCase:

    public void apply() throws UseCaseException {
        logger.info("apply");
        PersistenceBroker broker = null;

        try {
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            broker.beginTransaction();
            broker.store(profile);
            broker.commitTransaction();
        } catch (PersistenceBrokerException e) {
            if (broker != null)
                broker.abortTransaction();
            e.printStackTrace();
            throw new UseCaseException();
        } finally {
            if (broker != null)
                broker.close();
        }
    }


Here the class descriptor:

<class-descriptor class="it.gesi.userprofiling.Profile" table="dps_user">
<field-descriptor name="id" column="id" jdbc-type="VARCHAR" primarykey="true" autoincrement="true"/>
<field-descriptor name="login" column="login" jdbc-type="VARCHAR"/>
<field-descriptor name="password" column="password" jdbc-type="VARCHAR"/>
<field-descriptor name="member" column="member" jdbc-type="SMALLINT"/>
<field-descriptor name="firstName" column="first_name" jdbc-type="VARCHAR"/>
<field-descriptor name="middleName" column="middle_name" jdbc-type="VARCHAR"/>
<field-descriptor name="lastName" column="last_name" jdbc-type="VARCHAR"/>
<field-descriptor name="userType" column="user_type" jdbc-type="SMALLINT"/>
<field-descriptor name="locale" column="locale" jdbc-type="SMALLINT"/>
<field-descriptor name="lastActivityDate" column="lastactivity_date" jdbc-type="DATE"/>
<field-descriptor name="registrationDate" column="registration_date" jdbc-type="DATE"/>
<field-descriptor name="email" column="email" jdbc-type="VARCHAR"/>
<field-descriptor name="emailStatus" column="email_status" jdbc-type="SMALLINT"/>
<field-descriptor name="receiveEmail" column="receive_email" jdbc-type="SMALLINT"/>
<field-descriptor name="gender" column="gender" jdbc-type="SMALLINT"/>
<field-descriptor name="dateOfBirth" column="date_of_birth" jdbc-type="DATE"/>
<field-descriptor name="securityStatus" column="securityStatus" jdbc-type="SMALLINT"/>
<field-descriptor name="autoLogin" column="auto_login" jdbc-type="SMALLINT"/>
<collection-descriptor name="organizations" element-class-ref="it.gesi.userprofiling.Organization"
collection-class="org.apache.ojb.broker.util.collections.ManageableVector"
auto-retrieve="true"
auto-update="true"
auto-delete="link"
indirection-table="dps_user_org">
<fk-pointing-to-this-class column="user_id"/>
<fk-pointing-to-element-class column="organization"/>
</collection-descriptor>
</class-descriptor>


<class-descriptor class="it.gesi.userprofiling.Organization" table="dps_organization">
<field-descriptor name="orgId" column="org_id" jdbc-type="VARCHAR" primarykey="true" autoincrement="true"/>
<field-descriptor name="name" column="name" jdbc-type="VARCHAR"/>
<field-descriptor name="description" column="description" jdbc-type="VARCHAR"/>
<field-descriptor name="parentOrgId" column="parent_org" jdbc-type="VARCHAR"/>
<reference-descriptor name="parentOrg" class-ref="it.gesi.userprofiling.Organization"
auto-retrieve="true"
auto-update="false"
auto-delete="false">
<foreignkey field-ref="parentOrgId"/>
</reference-descriptor>
<collection-descriptor name="users" element-class-ref="it.gesi.userprofiling.Organization"
collection-class="org.apache.ojb.broker.util.collections.ManageableVector"
auto-retrieve="true"
auto-update="false"
auto-delete="false"
indirection-table="dps_user_org">
<fk-pointing-to-this-class column="user_id"/>
<fk-pointing-to-element-class column="organization"/>
</collection-descriptor>
</class-descriptor>


This works perfectly with OJB 1.0.0

Thanks



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




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



Reply via email to