0

I'm developing an application that uses GAE, Guice, JPA 2.0 and Jersey. I want to get rid of adding each entity class as a <class> element in my persistence.xml.

Answers for this question talk only about Hibernate, but AFAIK only supported JPA provider for Google App Engine is DataNucleus.

My project structure (my only entity right now is TestObject.java; target directory is generated via Maven):

├── README.md
├── datanucleus.log
├── nb-configuration.xml
├── pom.xml
├── src
│   └── main
│       ├── java
│       │   └── cz
│       │       └── cvut
│       │           └── oi
│       │               └── wa2
│       │                   ├── ioc
│       │                   │   ├── Configuration.java
│       │                   │   └── ServletListener.java
│       │                   └── rest
│       │                       ├── JSONService.java
│       │                       └── TestObject.java
│       ├── resources
│       │   └── META-INF
│       │       └── persistence.xml
│       └── webapp
│           └── WEB-INF
│               ├── appengine-web.xml
│               └── web.xml
└── target
    ├── classes
    │   ├── META-INF
    │   │   └── persistence.xml
    │   └── cz
    │       └── cvut
    │           └── oi
    │               └── wa2
    │                   ├── ioc
    │                   └── rest
    ├── generated-sources
    │   └── annotations
    ├── maven-archiver
    │   └── pom.properties
    ├── rss-reader-backend-1.0-SNAPSHOT
    │   ├── META-INF
    │   └── WEB-INF
    │       ├── appengine-generated
    │       │   └── local_db.bin
    │       ├── appengine-web.xml
    │       ├── classes
    │       │   └── META-INF
    │       │       └── persistence.xml
    │       ├── lib
    │       │   ├── activation-1.1.jar
    │       │   ├── aopalliance-1.0.jar
    │       │   ├── appengine-api-1.0-sdk-1.7.7.jar
    │       │   ├── asm-3.1.jar
    │       │   ├── datanucleus-api-jpa-3.0.11.jar
    │       │   ├── datanucleus-appengine-2.0.1.jar
    │       │   ├── datanucleus-core-3.0.11.jar
    │       │   ├── geronimo-jpa_2.0_spec-1.1.jar
    │       │   ├── guice-3.0.jar
    │       │   ├── guice-persist-3.0.jar
    │       │   ├── guice-servlet-3.0.jar
    │       │   ├── jackson-core-asl-1.9.2.jar
    │       │   ├── jackson-jaxrs-1.9.2.jar
    │       │   ├── jackson-mapper-asl-1.9.2.jar
    │       │   ├── jackson-xc-1.9.2.jar
    │       │   ├── javax.inject-1.jar
    │       │   ├── jaxb-api-2.2.2.jar
    │       │   ├── jaxb-impl-2.2.3-1.jar
    │       │   ├── jdo-api-3.0.1.jar
    │       │   ├── jersey-core-1.17.1.jar
    │       │   ├── jersey-guice-1.17.1.jar
    │       │   ├── jersey-json-1.17.1.jar
    │       │   ├── jersey-server-1.17.1.jar
    │       │   ├── jersey-servlet-1.17.1.jar
    │       │   ├── jettison-1.1.jar
    │       │   ├── jta-1.1.jar
    │       │   ├── rss-reader-backend-1.0-SNAPSHOT.jar
    │       │   └── stax-api-1.0-2.jar
    │       └── web.xml
    ├── rss-reader-backend-1.0-SNAPSHOT.war
    └── surefire

Is my requirement possible with this devstack?

Community
  • 1
  • 1
Ondřej Mirtes
  • 5,054
  • 25
  • 36

1 Answers1

2

DataNucleus core certainly supports classpath scanning when exclude-unlisted-classes is not present when used with JavaEE or JavaSE. The log (DEBUG level) would show what is being discovered.

DataNucleus
  • 15,497
  • 3
  • 32
  • 37
  • I am not sure what am I supposed to do. I updated the question with my project structure. – Ondřej Mirtes Apr 20 '13 at 18:35
  • Perhaps think about your question. You asked does DataNucleus support CLASSPATH scanning so you don't need to put class entries in persistence.xml. I answered that, and pointed to the log as the way of seeing what is happening. If you have some "problem" then raise a question based around that problem. – DataNucleus Apr 21 '13 at 07:57
  • I don't know how to edit or even print my CLASSPATH with App Engine/Maven and what "DataNucleus will search for annotated classes starting at the root of the persistence-unit (the root directory in the CLASSPATH that contains the "META-INF/persistence.xml" file)" exactly means. – Ondřej Mirtes Apr 21 '13 at 08:17
  • The CLASSPATH is accessed via ClassLoaders, and things in the CLASSPATH are accessible via ClassLoader.getResources; this is what DataNucleus uses. How GAE puts things in the CLASSPATH is not something I can answer since it's not something I use, and DataNucleus core uses the CLASSPATH that is provided. System.getProperty("java.class.path") is the CLASSPATH which can easily be used for diagnostics – DataNucleus Apr 21 '13 at 08:24