Appengine JPA persist data problem

There is sometime coding JPA persist data problem may occured.

For example, I have a code that is about:

public class MemberBean {

    public void registerMember(Members member) {
        EntityManager em = EMF.get().createEntityManager();
        try {
        } finally {

As you can see that, if you run this code, sometimes you will got:

Problem accessing /fyhaosecs. Reason:

    Illegal argument
Caused by:
javax.persistence.PersistenceException: Illegal argument
	at org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForJDOException(
	at org.datanucleus.jpa.EntityManagerImpl.close(
	at com.fyhao.secs.MemberBean.registerMember(
	at com.fyhao.secs.FyhaosecsServlet.doGet(
	at javax.servlet.http.HttpServlet.service(
	at javax.servlet.http.HttpServlet.service(


The solution is: just add em.refresh(member); after you persist.

You can also refer to this link:

Author: fyhao

Jebsen & Jessen Comms Singapore INTI University College Bsc (Hon) of Computer Science, Coventry University

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.