saveOrUpdate « Cascade « JPA Q&A





1. Assigned Id and saveOrUpdate for cascades    forum.hibernate.org

As far as i understood hibernate uses id property to identify what type of the SQL statement should be executed: id is null - insert, id is not null - update. And in the same time i'd like to have 'assigned' id to cache object by id and to have ability to compare/hash objects by id. With assigned id saveOrUpdate doesn't ...

2. one-to-many cascade saveOrUpdate()    forum.hibernate.org

Senior Joined: Wed Mar 24, 2004 11:40 am Posts: 146 Location: Indianapolis, IN, USA I am using Hibernate 2.1.2. I have the following object structure Code: class Foo { public Long fooId; ... public List barList; } class Bar { public BarCompositeKey; ... } class BarCompositeKey { public Long ...

3. saveOrUpdate(), or cascade, causes a unique key violation    forum.hibernate.org

saveOrUpdate(), or cascade, just creates new rows for old instances (or causes a unique key violation)! The faqs says For a composite identifier, you should simply specify unsaved-value. In the second case, you can't use saveOrUpdate(). You should explicitly call save() or update() on a case-by-case basis, use Interceptor.isUnsaved in Hibernate2, or use version unsavec-value in Hibernate 2.1. Does anyone have ...

4. saveOrUpdate without cascades on set    forum.hibernate.org

Hello I am having difficulties to update an entitiy. The problem is the entity I want to save is of type service as shown in the mapping below and it seems that "Hibernate" is trying to cascade and update the childs of service, which is a problem. I just want to save the Service entity. Is there a way to handle ...

5. saveOrUpdate on a hierarchy/set without cascade    forum.hibernate.org

Hi I made a mapping where a has childs b and c, each as a set. My problem is that if I update a, hibernate tries to update b and c too, it cascades. I used cascade="none" on the sets and default-cascade="none" all together, but there is no difference. Am I missing something here, why is this not possible, to not ...