openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Cortez <>
Subject Re: Migration from hibernate
Date Wed, 03 Aug 2016 20:24:56 GMT
Hi Enrique,
Strange. I was almost certain that Hibernate would work that way as well. If just leave the
defaults one, the EntityManager doesn't know what to do with a detached entity instance.
I've tried with one sample project and this is what I get with Hibernate:org.hibernate.TransientPropertyValueException:
object references an unsaved transient instance

If I add the Cascade then it works fine.
Maybe you have Cascade set up somewhere else?
      From: Enrique Rodríguez Lasterra <>
 Sent: Wednesday, August 3, 2016 5:29 AM
 Subject: Migration from hibernate
Hi, i'm new on the list. I'm migrating a project from tomcat+hibernate to

My problem is with a @ManyToOne relationship.

I have a Customer entity with a relationship with CustomerType.

When i create a new customer i don't whant to save-update customertype.

This pseudo-code work with hibernate

Customer c = new Customer();
CustomerType ct = new CustomerType();

When i execute it with openjpa, i get an exception that CustomerType is
detached and i shoud user Cascade.Persist, but this is not what i want.

I know that one way to resolve the problema is to find CustomerType on
EntityManager instead to create a new object for that... but this change is
very complex in my application.

Is this a problem of openjpa or hibernate implementation?

Enrique Rodriguez Lasterra
lasterra AT gmail DOT com

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message