oops sorry ignore what I said, I'm not awake yet. > It's my understanding that you shouldn't be calling setId(5) if you're using > @generated, the annotation means the id is generated and not set by you isn't > it? > > > Hi all, > > > > I have a basic problem with openjpa 1.0.0. Merging and object results in > > this exception: > > > > <openjpa-1.0.0-r420667:568756 nonfatal user error> > > org.apache.openjpa.persistence.InvalidStateException: The generated > > value processing detected an existing value assigned to this field: > > package.MyEntity.id. This existing value was either provided via an > > initializer or by calling the setter method. You either need to remove > > the @GeneratedValue annotation or modify the code to remove the > > initializer processing. > > > > I try to do just a simple operation of updating MyEntity.someField in > > database, for id=5, like this: > > > > MyEntity myEntity = new Entity(); > > myEntity.setId(5); > > myEntity.setSomeField("abc"); > > em = emf.createEntityManager(); > > em.getTransaction().begin(); > > em.merge(myEntity); > > em.getTransaction().commit(); > > em.close(); > > > > I tried to google, but no luck. Exception is thrown when merge method is > > called. > > > > Field id in MyEntity have @GeneratedValue(strategy = > > GenerationType.IDENTITY). > > > > Any suggestions? How do I update someField in MyEntity? > > > > Regards, > > Ognjen > > -- > Ted Leung > [EMAIL PROTECTED] > > You know things are getting a little fishy when you're commenting out > comments.
-- Ted Leung [EMAIL PROTECTED] You know things are getting a little fishy when you're commenting out comments.