This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Cascade Type problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Cascade Type problem" Watch "Cascade Type problem" New topic

Cascade Type problem

masse Satriana

Joined: Sep 21, 2008
Posts: 8
Hi All,
Is there any clue how using CascadeType in bidirectional relationship?
for example :
I have two tables 1 is Customers and second is FormOrder ( owner of relationship)

The problem is when I insert new record in FormOrder which also specify new Customer, this code should be working. ( since this is not default JPA to persist related entity , so that we are using CascadeType.persist)

The fact is annoying me since there are a message "javax.persistence.EntityExistsException:
Exception Description: Cannot persist detached object"

Any clue would be greatly accepted.

Thanks in advance.

A warm family is worthy enough than hard working.
masse Satriana

Joined: Sep 21, 2008
Posts: 8
Hi All,
Case is closed.
This all is my failure not seeing duplicated data on table FormOrder.
All code in my previous post is working fine.

Masse Satriana
I agree. Here's the link:
subject: Cascade Type problem
It's not a secret anymore!