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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]