Questions tagged [hibernate-cascade]
87 questions
0
votes
0 answers
JPA Hibernate using CascadeType.PERSIST on child (inverse side)
I have 2-way association between NaturalPerson and Client entity and I would like to persist NaturalPerson while Client is persisted and also inversely persist Client while NaturalPerson is persistent. In order to achieve this i created relationship…

Michał Ziobro
- 10,759
- 11
- 88
- 143
0
votes
1 answer
How to cascade child deletion using Hibernate?
I currently have a setup similar to:
@MappedSuperclass
public abstract class AbstractEntity implements Serializable {
private Long id;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
…

Kęstutis
- 1,011
- 2
- 12
- 22
0
votes
0 answers
Unable to understand JPA cascade behaviour on delete using hibernate
I have three tables/entities which are Event, Participant, and ParticipantEvent. ParticipantEvent is kind of like join table of many to many relationship but I have made it as an entity. And the mapping goes like this.
public class Event {
…

Mani Rai
- 665
- 2
- 9
- 22
0
votes
1 answer
org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade when collection objecs have a one to one association
I run into the "deleted object would be re-saved by cascade" problem when I try to remove a TicketLine object from a collection that belongs to the Ticket class and TicketLine has a OneToOne association to class Reservation.
Tickets defines a…

arcasys
- 41
- 6
0
votes
1 answer
Where to set cascade and fetch in Bidirectional relationship
On a bidirectional relationship in hibernate/JPA, which entity (or both?) do you specify the fetch mode and cascade type? An example:
@Entity
@Table(name="EMPLOYER")
public Employer implements Serializable
{
@OneToMany(mappedBy="employer")
…

Leveticus
- 33
- 1
- 7
0
votes
0 answers
@OneToOne not deleted referred element on change
I have @OneToOne unidirectional relation between Parent and Child. When Parent is being merge I want to delete Child, when provided Child object is different than that existed in database. This is my relation in Parent class:
@OneToOne(fetch =…

Ziemo
- 941
- 8
- 27
0
votes
1 answer
How to properly delete a complex object using Hibernate?
Here is the problem. When I'm trying to delete a Catalog object from database, Hibernate also removing all Catalog objects with associated Type and Genre Ids. For example, if I’m removing Catalog with Type.id=1 and Genre.id=1 Hibernate delete every…

Flavio
- 895
- 3
- 14
- 19
0
votes
1 answer
org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan"
I am trying to copy a persistent object and modifies it, and then persists (
insert new record), but not work!
E.g.:
The objcet A(Persistent)
The object B = copy (A)
modify B
insert B / / Error
Following fragments of my code, thank…

snipes
- 1
- 1
- 2
0
votes
1 answer
Why does hibernate stop working after some time?
I do have a system running on Apache tomcat 7 (7.0.34 if that makes any difference) with a mapping with a property like this
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST,CascadeType.MERGE})
@JoinTable(name = "device_document",
…

aldo.lares
- 1
- 2
0
votes
1 answer
Hibernate cascade update into collections' objects in that haven't changed
Using Hibernate 3.3, JPA 1.x and Hsqldb 1.8
I'm having an issue with cascading updates to objects that contain collections of other objects. Here's a contrived (slightly) example to illustrate (getters/setters omitted). Sorry its lots of code, I…

Obiphil
- 361
- 1
- 6
- 17
0
votes
2 answers
Issue in deleting a parent-child object in Hibernate "deleted object would be re-saved by cascade"
I have the following two entities:
1- Deal
@OneToMany(cascade=CascadeType.ALL,mappedBy = "deal", fetch = FetchType.EAGER)
@Fetch( FetchMode.SELECT)
private List dealCheckList;
2- DealCheckList
@JoinColumn(name = "DEAL_ID",…

Anand
- 20,708
- 48
- 131
- 198
-1
votes
1 answer
Spring repository cascade
I'm using Spring Data repository to save my entities, but for some reason the cascade doesn't work for the test saveCountryAndNewCity() : the city doesn't get saved but it works for saveCityAndNewCountry() which is similar. Can someone help me to…

user3876570
- 1
- 1