Tuesday, November 2, 2010

Re: Problems with JDO

Hi Caio,

Ensure that you do not instantiate factory more than once.

Look at http://code.google.com/appengine/docs/java/gettingstarted/usingdatastore.html

[snip]
public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("transactions-
optional");

private PMF() {}

public static PersistenceManagerFactory get() {
return pmfInstance;
}
}
[/snip]

And in case you've just started your application, do review objectify
at http://code.google.com/p/objectify-appengine. It's fantastic and
will ensure that you never come across issues that you've posted :)

Hope that helps!


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.com


On Nov 3, 12:16 am, Caio <caio.nery1...@yahoo.com.br> wrote:
> Hello,
> I'm having some troubles with JDO. I have declared two independent
> entity classes (with no relationship), and this way, I've used them in
> two different java classes contexts. Then, the program execution
> generated an exception about the duplicated name of
> PersistenceManagerFactory. I have corrected the name of this object at
> jdoconfig.xml but a new exception ocurred:
> javax.jdo.JDOFatalUserException. In addition, if you want to see the
> complete error list, read below:
>
> Caused by: javax.jdo.JDOFatalUserException: Application code attempted
> to create a PersistenceManagerFactory named transactions, but one with
> this name already exists!  Instances of PersistenceManagerFactory are
> extremely slow to create and it is usually not necessary to create one
> with a given name more than once.  Instead, create a singleton and
> share it throughout your code.  If you really do need to create a
> duplicate PersistenceManagerFactory (such as for a unittest suite),
> set the appengine.orm.disable.duplicate.pmf.exception system property
> to avoid this error.
>
> THANK U FOR HELPING!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment