Database « Cascade « JPA Q&A

1. Hibernate - DB Cascade

2. Hibernate Cascade or Database CASCADE

Hi, I have a problem want to discuss. Since Hibernate have the function cascade, and so do database.(e.g. ON DELETE CASCADE) Which should I use for my development? If I use database cascade, I can share the cascades setting between more applications which are using the same database schema. If so, what is the benefit of hibernate cascade?

3. Cascade implemented in Hibernate or in database ?

I think that if you have the choice, you should let Hibernate control that. I personally even prefer to let Hibernate create my database schema. It is a lot easier to maintain and it allows for easier testing using java memory database etc. You do this by putting the parameter update in your hibernate.cfg.xml see doc for other values. Hope ...

4. cascading updates db even when save/update is not called

Hi, Here's the scenario: I load an object from db, and create a bunch of child objects in it (simply as space holders). When the load method returns, and transaction is committed, cascading triggers an automatic flush, and all my temporary objects are being saved to db, without me even calling save or update methods. Is there a way to tell ...

5. cascading operations and the underlying database

Hi all, I am new to hibernate and have a question that may appear tirvial to some of you. I have a uni-directional relationship between User and Phone. This relation form point of view of the database : each user has many phones and each phone has one user. And the cascade operation in the database is not defined by me, ...