openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <...@cndavies.com>
Subject RE: tomcat6+openjpa+jsf
Date Mon, 31 May 2010 15:22:52 GMT
Just on a hunch, 

Try em.clear() between the first commit and the find, I had a strange issue
like this before:

em.getTransaction().commit();
em.clear();
Person fx = em.find(Person.class, 1);


-----Original Message-----
From: davidautentico [mailto:davidautentico@hotmail.com] 
Sent: Tuesday, 1 June 2010 1:10 AM
To: users@openjpa.apache.org
Subject: RE: tomcat6+openjpa+jsf


Same error with this code:

emf =
Persistence.createEntityManagerFactory("person",System.getProperties());
			EntityManager em = emf.createEntityManager();

			em.getTransaction().begin();
			Person p1 = new Person();
			p1.setIdPerson(1);
			p1.setMail("mail1");
			p1.setName("p1");
			em.persist(p1);
			em.getTransaction().commit();

			Person fx = em.find(Person.class, 1);
			em.getTransaction().begin();
			if (fx!=null){
			        fx.setMail("ea");
			        em.merge(p1);
			}

			em.getTransaction().commit();
			em.close();
-- 
View this message in context:
http://openjpa.208410.n2.nabble.com/tomcat6-openjpa-jsf-tp5120836p5122147.ht
ml
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message