I try to use jpa in google cloud sql.This is my source.
== persistence.xml ==
<persistence-unit name="transactions-optional">
<provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider>
<properties>
<property name="datanucleus.NontransactionalRead"
value="true"/>
<property name="datanucleus.NontransactionalWrite"
value="true"/>
<property name="datanucleus.ConnectionURL"
value="appengine"/>
</properties>
</persistence-unit>
== EMFService ==
public class EMFService {
private static final EntityManagerFactory emfInstance =
Persistence.createEntityManagerFactory("transactions-optional");
private EMFService() { }
public static EntityManagerFactory get() {
return emfInstance;
}
}
== Implemetation java source ==
EntityManager em = EMFService.get().createEntityManager();
Members ma = new Members(); // This is Entity class
ma.setID("aaa");
ma.setPasswd("ccc");
ma.setName("vvv");
em.persist(ma);
Members m = em.find(Members.class, "aaa");
if( m.equals(ma))* // this statement returns true value.
*
But statement does not commit the value. I can't find the ma object value
in database records.
Pls, advise me how to set auto_commit in persistence.xml. Thanks in
advanced!
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/8mNmeQSV4PEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.