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 Thomas Dudziak <to...@gmail.com> on 2005/09/15 10:29:06 UTC
Re: on delete cascade
On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
> Hi All!
> I specify auto-delete=true in my collection descriptor
>
> /**
> * @ojb.collection
> element-class-ref="com.esaya.webmail.datamodel.folder.mail.EmailMessage"
> foreignkey="mailFolderId"
> * database-foreignkey="false" proxy="true"
> collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> * auto-delete="true" auto-update="false" proxy="true"
> */
> private List content;
>
> and generate database schema using Xdoclet
>
> <ojbdoclet destdir="${torque.output.dir}" checks="basic">
> <fileset dir="${outputDatabaseOjbJava}"/>
> <ojbrepository
> destinationFile="OJB-repository-types.xml" verbose="true"/>
> <torqueschema databaseName="${pom.groupId}"
> destinationFile="${torque.project}-schema.xml"/>
> </ojbdoclet>
>
> but got the following
>
> <foreign-key foreignTable="FOLDER">
> <reference local="MAIL_FOLDER_ID" foreign="ID"/>
> </foreign-key>
>
> so attribute onDelete="cascade" isn't genereted or I miss something
> can somebody help?
The auto-delete="true" setting is processed by OJB, not the database,
therefore there is no corresponding setting in the schema XML.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: on delete cascade
Posted by Maksimenko Alexander <ma...@bird.cris.net>.
submitted it as feature request
btw jjira is very convinient tool ;)
thanks ;)
Thomas Dudziak wrote:
>On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
>
>
>>as I can understand torque generator support ondelte attribute in constraint
>>so you need only add this attribute in generated by OJB-Doclet
>>torque-schema.xml
>>or am I miss something ?
>>
>>
>
>Please create a JIRA issue for this, I'll have a look into it.
>
>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: on delete cascade
Posted by Thomas Dudziak <to...@gmail.com>.
On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
> as I can understand torque generator support ondelte attribute in constraint
> so you need only add this attribute in generated by OJB-Doclet
> torque-schema.xml
> or am I miss something ?
Please create a JIRA issue for this, I'll have a look into it.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: on delete cascade
Posted by Maksimenko Alexander <ma...@bird.cris.net>.
as I can understand torque generator support ondelte attribute in constraint
so you need only add this attribute in generated by OJB-Doclet
torque-schema.xml
or am I miss something ?
Armin Waibel wrote:
> Maksimenko Alexander wrote:
>
>> Yes
>> javadoc says that I (or database) should take care about deleting
>> references
>> so I think marking foreighn key as onDelete="cascade" will be good
>> choice to assure that rows will be deleted even if ojb will forget
>> about them.
>> What do you think?
>>
>
> Sounds good to me. It would be great to support
> ON DELETE CASCADE/SET NULL
> for DB relations. But I'm not sure about how to integrate it in OJB.
> Think this is a feature request for ddlutils project - Tom WDYT?
>
> In the meantime a workaround can be to implement your on deleteByQuery
> using a select query, iterate over the result and delete each object.
> This will cause n+1 DB queries, but it will take care of all
> auto-delete settings and will be sync the cache.
>
> regards,
> Armin
>
>> Armin Waibel wrote:
>>
>>> Maksimenko Alexander wrote:
>>>
>>>> Thank for answer
>>>> Yes I know - but in some cases this processing is skipping
>>>> for example while deleting objects by query - in such case I get
>>>> constraint violation error from database
>>>>
>>>
>>> Currently this method doesn't support cascading delete of referenced
>>> objects, see javadoc
>>> http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#deleteByQuery(org.apache.ojb.broker.query.Query)
>>>
>>>
>>> regards
>>> Armin
>>>
>>>
>>>> Thomas Dudziak wrote:
>>>>
>>>>> On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
>>>>>
>>>>>
>>>>>> Hi All!
>>>>>> I specify auto-delete=true in my collection descriptor
>>>>>>
>>>>>> /**
>>>>>> * @ojb.collection
>>>>>> element-class-ref="com.esaya.webmail.datamodel.folder.mail.EmailMessage"
>>>>>>
>>>>>> foreignkey="mailFolderId"
>>>>>> * database-foreignkey="false" proxy="true"
>>>>>> collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>>>>>
>>>>>> * auto-delete="true" auto-update="false" proxy="true"
>>>>>> */
>>>>>> private List content;
>>>>>>
>>>>>> and generate database schema using Xdoclet
>>>>>>
>>>>>> <ojbdoclet destdir="${torque.output.dir}" checks="basic">
>>>>>> <fileset dir="${outputDatabaseOjbJava}"/>
>>>>>> <ojbrepository
>>>>>> destinationFile="OJB-repository-types.xml" verbose="true"/>
>>>>>> <torqueschema databaseName="${pom.groupId}"
>>>>>> destinationFile="${torque.project}-schema.xml"/>
>>>>>> </ojbdoclet>
>>>>>>
>>>>>> but got the following
>>>>>>
>>>>>> <foreign-key foreignTable="FOLDER">
>>>>>> <reference local="MAIL_FOLDER_ID" foreign="ID"/>
>>>>>> </foreign-key>
>>>>>>
>>>>>> so attribute onDelete="cascade" isn't genereted or I miss something
>>>>>> can somebody help?
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> The auto-delete="true" setting is processed by OJB, not the database,
>>>>> therefore there is no corresponding setting in the schema XML.
>>>>>
>>>>> 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
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: on delete cascade
Posted by Armin Waibel <ar...@apache.org>.
Maksimenko Alexander wrote:
> Yes
> javadoc says that I (or database) should take care about deleting
> references
> so I think marking foreighn key as onDelete="cascade" will be good
> choice to assure that rows will be deleted even if ojb will forget about
> them.
> What do you think?
>
Sounds good to me. It would be great to support
ON DELETE CASCADE/SET NULL
for DB relations. But I'm not sure about how to integrate it in OJB.
Think this is a feature request for ddlutils project - Tom WDYT?
In the meantime a workaround can be to implement your on deleteByQuery
using a select query, iterate over the result and delete each object.
This will cause n+1 DB queries, but it will take care of all auto-delete
settings and will be sync the cache.
regards,
Armin
> Armin Waibel wrote:
>
>> Maksimenko Alexander wrote:
>>
>>> Thank for answer
>>> Yes I know - but in some cases this processing is skipping
>>> for example while deleting objects by query - in such case I get
>>> constraint violation error from database
>>>
>>
>> Currently this method doesn't support cascading delete of referenced
>> objects, see javadoc
>> http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#deleteByQuery(org.apache.ojb.broker.query.Query)
>>
>>
>> regards
>> Armin
>>
>>
>>> Thomas Dudziak wrote:
>>>
>>>> On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
>>>>
>>>>
>>>>> Hi All!
>>>>> I specify auto-delete=true in my collection descriptor
>>>>>
>>>>> /**
>>>>> * @ojb.collection
>>>>> element-class-ref="com.esaya.webmail.datamodel.folder.mail.EmailMessage"
>>>>>
>>>>> foreignkey="mailFolderId"
>>>>> * database-foreignkey="false" proxy="true"
>>>>> collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>>>>
>>>>> * auto-delete="true" auto-update="false" proxy="true"
>>>>> */
>>>>> private List content;
>>>>>
>>>>> and generate database schema using Xdoclet
>>>>>
>>>>> <ojbdoclet destdir="${torque.output.dir}" checks="basic">
>>>>> <fileset dir="${outputDatabaseOjbJava}"/>
>>>>> <ojbrepository
>>>>> destinationFile="OJB-repository-types.xml" verbose="true"/>
>>>>> <torqueschema databaseName="${pom.groupId}"
>>>>> destinationFile="${torque.project}-schema.xml"/>
>>>>> </ojbdoclet>
>>>>>
>>>>> but got the following
>>>>>
>>>>> <foreign-key foreignTable="FOLDER">
>>>>> <reference local="MAIL_FOLDER_ID" foreign="ID"/>
>>>>> </foreign-key>
>>>>>
>>>>> so attribute onDelete="cascade" isn't genereted or I miss something
>>>>> can somebody help?
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> The auto-delete="true" setting is processed by OJB, not the database,
>>>> therefore there is no corresponding setting in the schema XML.
>>>>
>>>> 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
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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: on delete cascade
Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Yes
javadoc says that I (or database) should take care about deleting references
so I think marking foreighn key as onDelete="cascade" will be good
choice to assure that rows will be deleted even if ojb will forget about
them.
What do you think?
Armin Waibel wrote:
> Maksimenko Alexander wrote:
>
>> Thank for answer
>> Yes I know - but in some cases this processing is skipping
>> for example while deleting objects by query - in such case I get
>> constraint violation error from database
>>
>
> Currently this method doesn't support cascading delete of referenced
> objects, see javadoc
> http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#deleteByQuery(org.apache.ojb.broker.query.Query)
>
>
> regards
> Armin
>
>
>> Thomas Dudziak wrote:
>>
>>> On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
>>>
>>>
>>>> Hi All!
>>>> I specify auto-delete=true in my collection descriptor
>>>>
>>>> /**
>>>> * @ojb.collection
>>>> element-class-ref="com.esaya.webmail.datamodel.folder.mail.EmailMessage"
>>>>
>>>> foreignkey="mailFolderId"
>>>> * database-foreignkey="false" proxy="true"
>>>> collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>>>
>>>> * auto-delete="true" auto-update="false" proxy="true"
>>>> */
>>>> private List content;
>>>>
>>>> and generate database schema using Xdoclet
>>>>
>>>> <ojbdoclet destdir="${torque.output.dir}" checks="basic">
>>>> <fileset dir="${outputDatabaseOjbJava}"/>
>>>> <ojbrepository
>>>> destinationFile="OJB-repository-types.xml" verbose="true"/>
>>>> <torqueschema databaseName="${pom.groupId}"
>>>> destinationFile="${torque.project}-schema.xml"/>
>>>> </ojbdoclet>
>>>>
>>>> but got the following
>>>>
>>>> <foreign-key foreignTable="FOLDER">
>>>> <reference local="MAIL_FOLDER_ID" foreign="ID"/>
>>>> </foreign-key>
>>>>
>>>> so attribute onDelete="cascade" isn't genereted or I miss something
>>>> can somebody help?
>>>>
>>>
>>>
>>>
>>> The auto-delete="true" setting is processed by OJB, not the database,
>>> therefore there is no corresponding setting in the schema XML.
>>>
>>> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: on delete cascade
Posted by Armin Waibel <ar...@apache.org>.
Maksimenko Alexander wrote:
> Thank for answer
> Yes I know - but in some cases this processing is skipping
> for example while deleting objects by query - in such case I get
> constraint violation error from database
>
Currently this method doesn't support cascading delete of referenced
objects, see javadoc
http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#deleteByQuery(org.apache.ojb.broker.query.Query)
regards
Armin
> Thomas Dudziak wrote:
>
>> On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
>>
>>
>>> Hi All!
>>> I specify auto-delete=true in my collection descriptor
>>>
>>> /**
>>> * @ojb.collection
>>> element-class-ref="com.esaya.webmail.datamodel.folder.mail.EmailMessage"
>>> foreignkey="mailFolderId"
>>> * database-foreignkey="false" proxy="true"
>>> collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>>
>>> * auto-delete="true" auto-update="false" proxy="true"
>>> */
>>> private List content;
>>>
>>> and generate database schema using Xdoclet
>>>
>>> <ojbdoclet destdir="${torque.output.dir}" checks="basic">
>>> <fileset dir="${outputDatabaseOjbJava}"/>
>>> <ojbrepository
>>> destinationFile="OJB-repository-types.xml" verbose="true"/>
>>> <torqueschema databaseName="${pom.groupId}"
>>> destinationFile="${torque.project}-schema.xml"/>
>>> </ojbdoclet>
>>>
>>> but got the following
>>>
>>> <foreign-key foreignTable="FOLDER">
>>> <reference local="MAIL_FOLDER_ID" foreign="ID"/>
>>> </foreign-key>
>>>
>>> so attribute onDelete="cascade" isn't genereted or I miss something
>>> can somebody help?
>>>
>>
>>
>> The auto-delete="true" setting is processed by OJB, not the database,
>> therefore there is no corresponding setting in the schema XML.
>>
>> 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: on delete cascade
Posted by Maksimenko Alexander <ma...@bird.cris.net>.
Thank for answer
Yes I know - but in some cases this processing is skipping
for example while deleting objects by query - in such case I get
constraint violation error from database
Thomas Dudziak wrote:
>On 9/15/05, Maksimenko Alexander <ma...@bird.cris.net> wrote:
>
>
>>Hi All!
>>I specify auto-delete=true in my collection descriptor
>>
>> /**
>> * @ojb.collection
>>element-class-ref="com.esaya.webmail.datamodel.folder.mail.EmailMessage"
>>foreignkey="mailFolderId"
>> * database-foreignkey="false" proxy="true"
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> * auto-delete="true" auto-update="false" proxy="true"
>> */
>> private List content;
>>
>>and generate database schema using Xdoclet
>>
>> <ojbdoclet destdir="${torque.output.dir}" checks="basic">
>> <fileset dir="${outputDatabaseOjbJava}"/>
>> <ojbrepository
>>destinationFile="OJB-repository-types.xml" verbose="true"/>
>> <torqueschema databaseName="${pom.groupId}"
>>destinationFile="${torque.project}-schema.xml"/>
>> </ojbdoclet>
>>
>>but got the following
>>
>> <foreign-key foreignTable="FOLDER">
>> <reference local="MAIL_FOLDER_ID" foreign="ID"/>
>> </foreign-key>
>>
>>so attribute onDelete="cascade" isn't genereted or I miss something
>>can somebody help?
>>
>>
>
>The auto-delete="true" setting is processed by OJB, not the database,
>therefore there is no corresponding setting in the schema XML.
>
>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