views:

20

answers:

0

Hi

I m using JPA to insert a row

My update code as in here

Now i m inserting a row using this code

public void get_image (String id)
{
    Object l = null;
    try
    {
        em = this.getEm();


        EntityTransaction entr = em.getTransaction();

        entr.begin();

        newa.Options o = new newa.Options();
        newa.Roleuser ru = em.find(newa.Roleuser.class, 1 );


        o.setUserId( ru );
        em.persist(o);
        entr.commit();




    }
    catch(Exception e)
    {
        System.out.println("NewPU.get_image exception" + e);
    }
    finally
    {
        if(em != null) {
            em.close();
        }
    }
}

I m getting this error from the server

 INFO: NewPU.get_image exception<openjpa-2.0.0-r422266:935683 fatal user error>
org.apache.openjpa.persistence.InvalidStateException: Detected reentrant flush.
Make sure your flush-time instance callback methods or event listeners 
do not invoke any operations that require the in-progress flush to complete.

I m using openJPA

Any help

Thanks

Pradyut