Results 1 to 5 of 5

Thread: How to remove whole object graph using DML-Style removal?

  1. #1

    Default How to remove whole object graph using DML-Style removal?

    Hi,
    In Hibernate3.1x it is possible to use DML-style for update/insert/delete operations on Hibernate entities. Suppose I have an object graph that I need to remove by deleting parent object.
    In non-DML style it would look like:
    Code:
    session.delete(objectInstance)
    which would cause cascade deletion for all child objects with cascade="all" in mapping file.

    Correspondent DML-style will be similar to this:
    Code:
    String hqlUpdate = "delete SomeObject someObject where someObject.id = :id";
    session.createQuery(hqlUpdate).setLong("id", realId).executeUpdate();
    This would produce SQL, similar to the following:
    Code:
    DELETE FROM SOME_OBJECT WHERE SOME_OBJECT_ID=?
    This would cause runtime error due to possible database data integrity constraint (assume no cascade propagation constrains on database level).

    The question is - how to tell Hiberante to traverse whole object graph for cascade update/delete in DML-style update/delete impl. ?

  2. #2

    Default

    None one uses such feature like DML update/insert/delete operations in Hibernate 3.1 ?

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Probably you'll have more success on the Hibernate forums.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4

    Default

    I have 0 responses overthere

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Probably nobody there uses DML .
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •