openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fay Wang <fyw...@yahoo.com>
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
David,<br>
&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>
<br>
-Fay<br>
<br>
&nbsp;&nbsp;&nbsp; <br><br>--- On <b>Tue, 4/1/08, David Goodenough
<i>&lt;david.goodenough@btconnect.com&gt;</i></b> wrote:<br><blockquote
style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From:
David Goodenough &lt;david.goodenough@btconnect.com&gt;<br>Subject: How to diagnose
rather cryptic error messages<br>To: users@openjpa.apache.org<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
are
 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(ProxySetupStateManager.java:234)<br>
       at
 uk.co.dga.bm.jpa.User.pcProvideField(User.java)<br>        at <br>org.apache.openjpa.meta.ProxySetupStateManager.setProxyData(ProxySetupStateManager.java:58)<br>
       at <br>org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1731)<br>
       at <br>org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1613)<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:675)<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:575)<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:500)<br>
       at <br>org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:302)<br>
       at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2372)<br>   
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2225)<br>      
 at
 <br>org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005)<br>
       at <br>org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)<br>
       at uk.co.dga.bm.loader.CreateUser.run(CreateUser.java:34)<br>        at uk.co.dga.bm.loader.CreateUser.main(CreateUser.java:41)<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="http://us.rd.yahoo.com/evt=47523/*http://tc.deals.yahoo.com/tc/blockbuster/text5.com">one
month of Blockbuster Total Access</a>, No Cost.

Mime
View raw message