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 Marc Tinnemeyer <ma...@gmx.net> on 2004/12/15 14:59:57 UTC
qualified decomp. n:m relation
hi everybody,
i got some trouble using such a relation in ojb 1.0.1.
the configuration is briefly explained in the "basic technique guide"
http://db.apache.org/ojb/docu/guides/basic-technique.html#Manual+decomposition+into+two+1%3An+associations
taken that example i can add persons and projects aswell as roles.
the trouble starts when i load a person, add a new role to the
roles-collection, save the person and then try to load a project that
should contain the role that was just created.
the role was successfully saved but the project simply does not contain
it.
how do i have save the person so the project recognizes the change ?
big thanks in advance,
kind regards,
marc tinnemeyer
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: qualified decomp. n:m relation
Posted by Armin Waibel <ar...@apache.org>.
Hi Marc,
Marc Tinnemeyer wrote:
> thanks for the hint, now i figured it out and it works.
> nevertheless i got another question.
>
> the same situation (person, role and project). now i can update a
> project or a person and the related role objects also got updated. but
> it is not possible to update a role object for its own. is it a
> limitation of ojb or is it my fault ?
Could you describe what "update a role" mean? If you lookup a role
object and change the 'name' and do PB.store the 'name' should be updated.
regards,
Armin
>
>
> here is my repository_user.xml:
>
> <class-descriptor class="com.abc.Person" table="persons">
> <field-descriptor name="id" column="id" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true"/>
> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
> length="100"/>
>
> <collection-descriptor
> name="roles"
> element-class-ref="com.abc.Roles"
> auto-update="object"
> >
> <inverse-foreignkey field-ref="person_id"/>
> </collection-descriptor>
> </class-descriptor>
>
> <class-descriptor class="com.abc.Project" table="projects">
> <field-descriptor name="id" column="id" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true"/>
> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
> length="100"/>
>
> <collection-descriptor
> name="roles"
> element-class-ref="com.abc.Roles"
> >
> <inverse-foreignkey field-ref="project_id"/>
> </collection-descriptor>
> </class-descriptor>
>
> <class-descriptor class="com.abc.Role" table="roles">
> <field-descriptor name="project_id" column="project_id"
> jdbc-type="INTEGER" primarykey="true"/>
> <field-descriptor name="person_id" column="person_id"
> jdbc-type="INTEGER" primarykey="true"/>
> <field-descriptor name="role" column="role" jdbc-type="VARCHAR"
> length="100"/>
>
> <reference-descriptor
> name="person"
> class-ref="com.abc.Person"
> >
> <foreignkey field-ref="person_id" />
> </reference-descriptor>
>
> <reference-descriptor
> name="project"
> class-ref="com.abc.Project"
> >
> <foreignkey field-ref="project_id"/>
> </reference-descriptor>
> </class-descriptor>
>
>
> thanks for any further suggestions,
> marc tinnemeyer
>
>
> On 15. Dez 2004, at 23:29 Uhr, Thomas Dudziak wrote:
>
>> Marc Tinnemeyer wrote:
>>
>>> all auto-** settings are set to default values (they are not set at
>>> all).
>>> i do not understand their impact in my case completly, so i'd be
>>> glad to get any hints on this topic.
>>
>>
>> Have a look at the documentation for them:
>>
>> http://db.apache.org/ojb/docu/guides/basic-technique.html#m%3An+auto-
>> xxx+setting
>>
>> Basically they specify what OJB should do with references/collections
>> of an object when this object is loaded/updated/deleted.
>>
>> Tom
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: qualified decomp. n:m relation
Posted by Marc Tinnemeyer <ma...@tinnemeyer.com>.
thanks for the hint, now i figured it out and it works.
nevertheless i got another question.
the same situation (person, role and project). now i can update a
project or a person and the related role objects also got updated. but
it is not possible to update a role object for its own. is it a
limitation of ojb or is it my fault ?
here is my repository_user.xml:
<class-descriptor class="com.abc.Person" table="persons">
<field-descriptor name="id" column="id" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor name="name" column="name" jdbc-type="VARCHAR"
length="100"/>
<collection-descriptor
name="roles"
element-class-ref="com.abc.Roles"
auto-update="object"
>
<inverse-foreignkey field-ref="person_id"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="com.abc.Project" table="projects">
<field-descriptor name="id" column="id" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor name="name" column="name" jdbc-type="VARCHAR"
length="100"/>
<collection-descriptor
name="roles"
element-class-ref="com.abc.Roles"
>
<inverse-foreignkey field-ref="project_id"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="com.abc.Role" table="roles">
<field-descriptor name="project_id" column="project_id"
jdbc-type="INTEGER" primarykey="true"/>
<field-descriptor name="person_id" column="person_id"
jdbc-type="INTEGER" primarykey="true"/>
<field-descriptor name="role" column="role" jdbc-type="VARCHAR"
length="100"/>
<reference-descriptor
name="person"
class-ref="com.abc.Person"
>
<foreignkey field-ref="person_id" />
</reference-descriptor>
<reference-descriptor
name="project"
class-ref="com.abc.Project"
>
<foreignkey field-ref="project_id"/>
</reference-descriptor>
</class-descriptor>
thanks for any further suggestions,
marc tinnemeyer
On 15. Dez 2004, at 23:29 Uhr, Thomas Dudziak wrote:
> Marc Tinnemeyer wrote:
>
>> all auto-** settings are set to default values (they are not set at
>> all).
>> i do not understand their impact in my case completly, so i'd be glad
>> to get any hints on this topic.
>
> Have a look at the documentation for them:
>
> http://db.apache.org/ojb/docu/guides/basic-technique.html#m%3An+auto-
> xxx+setting
>
> Basically they specify what OJB should do with references/collections
> of an object when this object is loaded/updated/deleted.
>
> Tom
>
> ---------------------------------------------------------------------
> 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
Re: qualified decomp. n:m relation
Posted by Thomas Dudziak <to...@first.fhg.de>.
Marc Tinnemeyer wrote:
> all auto-** settings are set to default values (they are not set at all).
>
> i do not understand their impact in my case completly, so i'd be glad
> to get any hints on this topic.
Have a look at the documentation for them:
http://db.apache.org/ojb/docu/guides/basic-technique.html#m%3An+auto-xxx+setting
Basically they specify what OJB should do with references/collections of
an object when this object is loaded/updated/deleted.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: qualified decomp. n:m relation
Posted by Marc Tinnemeyer <ma...@tinnemeyer.com>.
all auto-** settings are set to default values (they are not set at
all).
i do not understand their impact in my case completly, so i'd be glad
to get any hints on this topic.
thanks,
marc tinnemeyer
On 15. Dez 2004, at 17:23 Uhr, Thomas Dudziak wrote:
> Marc Tinnemeyer wrote:
>
>> i got some trouble using such a relation in ojb 1.0.1.
>> the configuration is briefly explained in the "basic technique guide"
>> http://db.apache.org/ojb/docu/guides/basic-
>> technique.html#Manual+decomposition+into+two+1%3An+associations
>>
>> taken that example i can add persons and projects aswell as roles.
>> the trouble starts when i load a person, add a new role to the
>> roles-collection, save the person and then try to load a project that
>> should contain the role that was just created.
>>
>> the role was successfully saved but the project simply does not
>> contain
>> it.
>>
>> how do i have save the person so the project recognizes the change ?
>>
> Could you post the repository.xml file ? More specifically, what are
> the auto-*** settings of the collection ?
>
> Tom
>
>
> ---------------------------------------------------------------------
> 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
Re: qualified decomp. n:m relation
Posted by Thomas Dudziak <to...@first.fhg.de>.
Marc Tinnemeyer wrote:
>i got some trouble using such a relation in ojb 1.0.1.
>the configuration is briefly explained in the "basic technique guide"
>http://db.apache.org/ojb/docu/guides/basic-technique.html#Manual+decomposition+into+two+1%3An+associations
>
>taken that example i can add persons and projects aswell as roles.
>the trouble starts when i load a person, add a new role to the
>roles-collection, save the person and then try to load a project that
>should contain the role that was just created.
>
>the role was successfully saved but the project simply does not contain
>it.
>
>how do i have save the person so the project recognizes the change ?
>
>
Could you post the repository.xml file ? More specifically, what are the
auto-*** settings of the collection ?
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Are sequence values incremented before use
Posted by Armin Waibel <ar...@apache.org>.
Hi Guido,
Guido Beutler wrote:
> Hi,
>
> I've got a strange problem when using sequences wir OJB 1.0.0.
> In some cases different applications get the same PK value but both are
> using the
> same sequence. Does OJB increment the sequence value before use?
> I configured the sequence at ojb as followed :
>
> <sequence-manager
> className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
> <attribute attribute-name="autoNaming" attribute-value="true"/>
> </sequence-manager>
>
> Is this correct? Thanks in advance.
hmm, if you use this SequenceManager OJB never increment the sequence
value by "itself" only by calling nextval from database.
I think between 1.0 and 1.0.1 I commented out an part in
SequenceManagerNextValImpl#createSequence which automatic drop sequences
under specific circumstances.
If the different applications use the same sequence-name then the
problem shouldn't caused by OJB (except the issue above), because OJB
increment PK values only by calling nextval on DB.
regards,
Armin
>
> best regards,
>
> Guido
>
> ---------------------------------------------------------------------
> 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
Are sequence values incremented before use
Posted by Guido Beutler <gu...@hrs.de>.
Hi,
I've got a strange problem when using sequences wir OJB 1.0.0.
In some cases different applications get the same PK value but both are
using the
same sequence. Does OJB increment the sequence value before use?
I configured the sequence at ojb as followed :
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
<attribute attribute-name="autoNaming" attribute-value="true"/>
</sequence-manager>
Is this correct? Thanks in advance.
best regards,
Guido
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org