Announcement Announcement Module
Collapse
No announcement yet.
How to remove whole object graph using DML-Style removal? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    None one uses such feature like DML update/insert/delete operations in Hibernate 3.1 ?

    Comment


    • #3
      Probably you'll have more success on the Hibernate forums.

      Comment


      • #4
        I have 0 responses overthere

        Comment


        • #5
          Probably nobody there uses DML .

          Comment

          Working...
          X