openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fay Wang <>
Subject Re: How to diagnose rather cryptic error messages
Date Tue, 01 Apr 2008 22:17:32 GMT
<table cellspacing='0' cellpadding='0' border='0' ><tr><td style='font: inherit;'>Hi
&nbsp;&nbsp;&nbsp; Did you call entityManager.flush( ) or
entityManager.getTransaction( ).commit( ) after calling&nbsp;
EntityManager.persist (userObject)?<br>
&nbsp;&nbsp;&nbsp; The flush or commit will write the object to the DB.<br>
&nbsp;&nbsp;&nbsp; <br><br>--- On <b>Tue, 4/1/08, David Goodenough
<i>&lt;;</i></b> wrote:<br><blockquote
style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From:
David Goodenough &lt;;<br>Subject: How to diagnose
rather cryptic error messages<br>To:<br>Date: Tuesday,
April 1, 2008, 7:04 AM<br><br><pre>I am relatively new to JPA, and trying
to get to grips with what I can <br>and can not do with it.<br><br>So I
thought I would try creating a small system (which will grow) which<br>has amongst other
things User objects and Role objects in it.<br><br>OpenJPA has successfully taken
my list of Entities and created the<br>relevant tables.  The Entity classes have all
been enhanced.  I am using<br>OpenJPA 1.0.2.<br><br>I create a Role object
(which does not contain a reference to other <br>objects) and persist it.  No errors
 reported, but the object does<br>not appear as a record in the DB.  Does a persist
have to be inside <br>a Transaction?  The manual is confusing as it says that "this
action can<br>only be performed in the context of an active transaction" right at the<br>end
of the description of persist, but I read it (given the way it was <br>laid out) to
apply to the remove action which immediately follows it.<br><br>Then create a
User object, which amongst other things has a List of<br>Role objects in it, so I add
the Role object I just create to it, fill in all <br>the other fields, and try to persist
it.  <br><br>I get back an exception which says:-<br><br>Exception
in thread "main" &lt;openjpa-1.0.2-r420667:627158 fatal<br>general error&gt;
<br>org.apache.openjpa.persistence.PersistenceException: null<br>        at <br>org.apache.openjpa.meta.ProxySetupStateManager.providedStringField(<br>
       at<br>        at <br>org.apache.openjpa.meta.ProxySetupStateManager.setProxyData(<br>
       at <br>org.apache.openjpa.meta.ClassMetaData.resolveMeta(<br>
       at <br>org.apache.openjpa.meta.ClassMetaData.resolve(<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.processBuffer(<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.resolveMeta(<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.resolve(<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.getMetaData(<br>
       at org.apache.openjpa.kernel.BrokerImpl.persist(<br>   
    at org.apache.openjpa.kernel.BrokerImpl.persist(<br>      
       at <br>org.apache.openjpa.persistence.EntityManagerImpl.persist(<br>
       at<br>        at<br><br>which
is not very helpful.  How do I get more information on exactly what it <br>is trying
to do so that I can fix it?<br><br>David</pre></blockquote></td></tr></table><br>

      <hr size=1>You rock. That's why Blockbuster's offering you <a href="*">one
month of Blockbuster Total Access</a>, No Cost.

View raw message