[appengine-java] NPE trying to create JPA EntityManagerFactory in integration tests

2009-12-01 Thread Felipe Cypriano
Hello,

I'm trying to do integrations tests in my app, but I get a
NullPointerException when this line is executed:

private static final EntityManagerFactory instance =
Persistence.createEntityManagerFactory(transactions-optional)


See:
Caused by: java.lang.NullPointerException
at org.datanucleus.jpa.EntityManagerFactoryImpl.initialisePMF
(EntityManagerFactoryImpl.java:452)
at org.datanucleus.jpa.EntityManagerFactoryImpl.init
(EntityManagerFactoryImpl.java:355)
at
org.datanucleus.store.appengine.jpa.DatastoreEntityManagerFactory.init
(DatastoreEntityManagerFactory.java:63)
at
org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider.createEntityManagerFactory
(DatastorePersistenceProvider.java:35)
at javax.persistence.Persistence.createEntityManagerFactory
(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory
(Persistence.java:33)
at javax.persistence.Persistence$createEntityManagerFactory.call
(Unknown Source)
at org.grails.appengine.AppEngineEntityManagerFactory.clinit
(AppEngineEntityManagerFactory.groovy:13)


Has anybody any ideas of why I'm getting NullPointerException in
datanucleos jpa EntityManagerFactoryImpl? Any advice that help me to
find how to solve the problem is very welcome, for example what line
452 of EntityManagerFactoryImpl expects?


Regards,
Felipe Cypriano

--

You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: jdo on app engine

2009-12-01 Thread Felipe Cypriano
I don't know about any jdo tool. And how would you generate a class
from a schema-less datastore like Google's BigTable?

You can use ID as Long, yes. But you need Key object when need to do
atomic transaction between multiple entities. To understand it you
*must* read all the topics about the datastore:
http://code.google.com/intl/en/appengine/docs/java/datastore/

On 1 dez, 04:30, asianCoolz second.co...@gmail.com wrote:
 1.any tool to generate jdo pojo?
 2. any impact of using primary key as long and autoincrement it rather
 than using jdo 's key ? I do understand that max autoincrement for
 sequence is e+27,  how about KEY ?

--

You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: Is it possible to implement Open EntityManager in View to avoid JDODetachedFieldAccessException?

2009-11-30 Thread Felipe Cypriano
Thanks,

Using these properties solve the problem.

On 28 nov, 08:09, datanucleus andy_jeffer...@yahoo.com wrote:
  I'm using Spring therefore I tried to configure the
  OpenEntityManagerInViewInterceptor, if this works as it's supposed to
  I shouldn't get JDODetachedFieldAccessException anymore, but I still
  get it.

 And what state are the objects in when you access the field ?
 detached ? and what PersistenceContext is used ?
 As perhttp://www.datanucleus.org/products/accessplatform_2_0/jpa/object_lif...
 DataNucleus 1.x supports Transaction out of the box (whereas
 DataNucleus 2.x supports both).
 You could easily use the persistence properties
 datanucleus.DetachAllOnCommit = false
 datanucleus.DetachOnClose=true
 if you wanted Extended.

--

You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Is it possible to implement Open EntityManager in View to avoid JDODetachedFieldAccessException?

2009-11-27 Thread Felipe Cypriano
Hello,

I'm very new to app-engine but I'm used to JPA and I can't find a way
to use Open EntityManager in View with app-engine and JPA.

My code is structured like this:
DomainDAO - This is where I access the datastore through JPA
DomainService - Some business logic before saving
DomainController - To show the domain on the page

This is a sample method of one of my DAOs:

public Guardian findByGoogleUserId(String userId) {
if (userId) {
def result = jpaTemplate.findByNamedParams(select g from
Guardian g where g.googleUserId = :userId, [userId: userId])
if (result) {
return result[0]
}
}
return null
}

I'm using Spring therefore I tried to configure the
OpenEntityManagerInViewInterceptor, if this works as it's supposed to
I shouldn't get JDODetachedFieldAccessException anymore, but I still
get it.

Is it possible to implement this pattern with app-engine and JPA?

--

You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.