Annotation « Cascade « JPA Q&A

1. Hibernate annotations cascading doesn't work

I've decided to change hbm.xml style to annotations using hibernate. I had in my hbm.xml:

<hibernate-mapping package="">
 <class name="Licence">
  <id name="licenceId">
   <generator class="native" />
 <many-to-one name="user" lazy="false" cascade="save-update" ...

2. Hibernate: How use cascade in annotation?

How can I use cascade and annotations in hibernate ?

But I stay with a doubt: I have this situation:
public class Package(){
  private Product product;

  private User ...

3. Update Cascade with hibernate annotations

hey everyone. I am using hibernate 3 and hibernate-annotations and i have my classes exporting to a schema in postgres 8.4. It is doing everything well, but i cant make it to generate the UPDATE CASCADE on foreign key id. In table Users i have: @OnDelete(action = OnDeleteAction.CASCADE) @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) @Cascade({org.hibernate.annotations.CascadeType.ALL}) @JoinColumn(name="id", unique = true, nullable = ...

4. possible bug in cascading with annotations?

I use annotations with hibernate-3.1 rc3. I have discover, that using CascadeType.ALL is not equivalent to {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH}. Here are my entity classes Report and Auftritt with Many-To-One relation: Code: package ftek.model; import javax.persistence.AccessType; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @SuppressWarnings("serial") @Entity(access = AccessType.FIELD) @Table(schema = "report_apps", name = ...

5. Hibernate cascade annotation+swap records

Hi, I have a table where one column is primary key, other two columns are references to other two tables primary key's. The fourth column is a rank column. My task is to update the rank for a person .Here rank is unique for a person so, when i update the rank for a person from 2 to 1, the person ...