Domanda

I'm fairly new to the Java EE space, so pardon my ignorance here; I inherited an application which is using guice-persist and hibernate to handle the ORM.

I'm attempting to use a CriteriaQuery, but I'm finding that my jaxax.persistence.EntityManager appears to be this interface (from EJB), rather than the one I want (from JPA), so I'm unable to use createQuery(CriteriaQuery).

This is a Maven project, and I'm unclear where this EJB code is coming from -- everything I can see from Guice-Persist and Hibernate is showing the JPA interface, not the EJB one, so I have no idea where this EJB package is coming from.

Any ideas here? Do I have a stray Maven dependency that's introducing EJB into my project, or does it sound like I misunderstood the persistence layer and am actually needing EJB in my application?

I'll be happy to post more information if you let me know what you need.

EDIT:

Upon closer inspection, I'm starting to suspect my "remoter" project has a malformed pom.xml. Dependency tree below.

    [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ texasU ---
    [INFO] texasU:texasU:war:1.1.2-SNAPSHOT
    [INFO] +- com.google.gwt:gwt-user:jar:2.5.0-rc1:provided
    [INFO] |  +- (javax.validation:validation-api:jar:1.0.0.GA:compile - scope updat
    ed from provided; omitted for duplicate)
    [INFO] |  +- javax.validation:validation-api:jar:sources:1.0.0.GA:provided
    [INFO] |  \- org.json:json:jar:20090211:provided
    [INFO] +- com.google.gwt:gwt-servlet:jar:2.5.0-rc1:runtime
    [INFO] +- com.arcbees.core:arcbees-core:jar:1.0-SNAPSHOT:provided
    [INFO] |  +- (com.google.gwt:gwt-servlet:jar:2.4.0:provided - omitted for confli
    ct with 2.5.0-rc1)
    [INFO] |  +- com.google.appengine:appengine-api-1.0-sdk:jar:1.6.1:provided
    [INFO] |  +- (com.gwtplatform:gwtp-dispatch-server-guice:jar:0.8-SNAPSHOT:provid
    ed - omitted for duplicate)
    [INFO] |  +- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile - sc
    ope updated from provided; omitted for duplicate)
    [INFO] |  +- (com.google.inject:guice:jar:3.0:compile - scope updated from provi
    ded; omitted for duplicate)
    [INFO] |  +- (com.google.inject.extensions:guice-servlet:jar:3.0:provided - omit
    ted for duplicate)
    [INFO] |  +- (com.google.inject.extensions:guice-assistedinject:jar:3.0:provided
     - omitted for duplicate)
    [INFO] |  +- javax.persistence:persistence-api:jar:1.0:provided
    [INFO] |  +- org.restlet.gae:org.restlet:jar:2.1-RC2:provided
    [INFO] |  \- org.restlet.gae:org.restlet.ext.servlet:jar:2.1-RC2:provided
    [INFO] |     \- (org.restlet.gae:org.restlet:jar:2.1-RC2:provided - omitted for
    duplicate)
    [INFO] +- com.gwtplatform:gwtp-mvp-client:jar:0.8-SNAPSHOT:provided
    [INFO] |  \- com.gwtplatform:gwtp-clients-common:jar:0.8-SNAPSHOT:provided
    [INFO] |     \- (com.google.inject:guice:jar:3.0:provided - omitted for duplicat
    e)
    [INFO] +- com.gwtplatform:gwtp-dispatch-client:jar:0.8-SNAPSHOT:provided
    [INFO] |  +- (com.gwtplatform:gwtp-clients-common:jar:0.8-SNAPSHOT:provided - om
    itted for duplicate)
    [INFO] |  +- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:provided - o
    mitted for duplicate)
    [INFO] |  \- (com.google.inject:guice:jar:3.0:provided - omitted for duplicate)
    [INFO] +- com.gwtplatform:gwtp-dispatch-server-guice:jar:0.8-SNAPSHOT:compile
    [INFO] |  +- com.gwtplatform:gwtp-dispatch-server:jar:0.8-SNAPSHOT:compile
    [INFO] |  |  \- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile -
     omitted for duplicate)
    [INFO] |  +- (com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile - om
    itted for duplicate)
    [INFO] |  \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
    [INFO] +- com.gwtplatform:gwtp-dispatch-shared:jar:0.8-SNAPSHOT:compile
    [INFO] +- com.gwtplatform:gwtp-processors:jar:0.8-SNAPSHOT:provided
    [INFO] +- com.google.inject:guice:jar:3.0:compile
    [INFO] |  +- javax.inject:javax.inject:jar:1:compile
    [INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
    [INFO] +- com.google.inject.extensions:guice-servlet:jar:3.0:compile
    [INFO] |  \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
    [INFO] +- com.google.inject.extensions:guice-assistedinject:jar:3.0:compile
    [INFO] |  \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
    [INFO] +- com.google.gwt.inject:gin:jar:1.5.0:provided
    [INFO] |  +- (com.google.inject:guice:jar:3.0-rc2:provided - omitted for conflic
    t with 3.0)
    [INFO] |  +- (com.google.inject.extensions:guice-assistedinject:jar:3.0-rc2:prov
    ided - omitted for conflict with 3.0)
    [INFO] |  \- (com.google.gwt:gwt-servlet:jar:2.2.0:provided - omitted for confli
    ct with 2.5.0-rc1)
    [INFO] +- mysql:mysql-connector-java:jar:5.1.21:compile
    [INFO] +- org.hibernate:hibernate-core:jar:4.1.4.Final:compile
    [INFO] |  +- antlr:antlr:jar:2.7.7:compile
    [INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
    [INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar
    :1.0.0.Final:compile
    [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
    [INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Fin
    al:compile
    [INFO] |  +- org.javassist:javassist:jar:3.15.0-GA:compile
    [INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:
    compile
    [INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile - omitted
     for conflict with 3.1.0.GA)
    [INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.4.Final:compile
    [INFO] |  +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - omitted for
     duplicate)
    [INFO] |  +- (org.hibernate:hibernate-core:jar:4.1.4.Final:compile - omitted for
     duplicate)
    [INFO] |  +- (org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:ja
    r:1.0.0.Final:compile - omitted for duplicate)
    [INFO] |  +- (dom4j:dom4j:jar:1.6.1:compile - omitted for duplicate)
    [INFO] |  +- (org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Fi
    nal:compile - omitted for duplicate)
    [INFO] |  +- (org.javassist:javassist:jar:3.15.0-GA:compile - omitted for duplic
    ate)
    [INFO] |  \- (org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final
    :compile - omitted for duplicate)
    [INFO] +- org.hibernate:hibernate-validator:jar:4.3.0.Final:compile
    [INFO] |  +- javax.validation:validation-api:jar:1.0.0.GA:compile
    [INFO] |  \- (org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile - omitted fo
    r conflict with 3.1.0.GA)
    [INFO] +- com.google.inject.extensions:guice-persist:jar:3.0:compile
    [INFO] |  \- (com.google.inject:guice:jar:3.0:compile - omitted for duplicate)
    [INFO] +- org.hibernate:hibernate-c3p0:jar:4.1.4.Final:compile
    [INFO] |  +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - omitted for
     duplicate)
    [INFO] |  +- (org.hibernate:hibernate-core:jar:4.1.4.Final:compile - omitted for
     duplicate)
    [INFO] |  \- c3p0:c3p0:jar:0.9.1:compile
    [INFO] +- com.googlecode.gwtquery:gwtquery:jar:1.1.0:provided
    [INFO] +- com.google.guava:guava:jar:13.0-rc2:compile
    [INFO] +- com.google.guava:guava-gwt:jar:13.0-rc2:provided
    [INFO] |  \- (com.google.guava:guava:jar:13.0-rc2:provided - omitted for duplica
    te)
    [INFO] +- org.mindrot:jbcrypt:jar:0.3m:compile
    [INFO] +- javax.mail:mail:jar:1.4.5:compile
    [INFO] |  \- javax.activation:activation:jar:1.1:compile
    [INFO] +- edu.utsouthwestern.qbri.remoter:service-bundle:jar:1.0-SNAPSHOT:compil
    e
    [INFO] |  +- org.nuiton.thirdparty:Rserve:jar:0.6-1:compile
    [INFO] |  +- org.nuiton.thirdparty:REngine:jar:0.6-1:compile
    [INFO] |  +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.5.1:compile
    [INFO] |  |  +- xml-resolver:xml-resolver:jar:1.2:compile
    [INFO] |  |  +- asm:asm:jar:3.3:compile
    [INFO] |  |  +- org.apache.cxf:cxf-api:jar:2.5.1:compile
    [INFO] |  |  |  +- org.apache.cxf:cxf-common-utilities:jar:2.5.1:compile
    [INFO] |  |  |  |  +- (org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile
    - omitted for duplicate)
    [INFO] |  |  |  |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.1:runtime
    [INFO] |  |  |  |     \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
    [INFO] |  |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile
    [INFO] |  |  |  +- org.apache.neethi:neethi:jar:3.0.1:compile
    [INFO] |  |  |  \- wsdl4j:wsdl4j:jar:1.6.2:compile
    [INFO] |  |  +- org.apache.cxf:cxf-rt-core:jar:2.5.1:compile
    [INFO] |  |  |  +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
    cate)
    [INFO] |  |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
    [INFO] |  |  |  +- (org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile - o
    mitted for duplicate)
    [INFO] |  |  |  \- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.
    1:compile
    [INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.1:compile
    [INFO] |  |  |  +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
    cate)
    [INFO] |  |  |  +- org.apache.cxf:cxf-tools-common:jar:2.5.1:compile
    [INFO] |  |  |  |  +- (wsdl4j:wsdl4j:jar:1.6.2:compile - omitted for duplicate)
    [INFO] |  |  |  |  +- (com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile - omitted f
    or duplicate)
    [INFO] |  |  |  |  +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for du
    plicate)
    [INFO] |  |  |  |  +- (org.apache.cxf:cxf-common-utilities:jar:2.5.1:compile - o
    mitted for duplicate)
    [INFO] |  |  |  |  \- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted fo
    r duplicate)
    [INFO] |  |  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.5.1:compile
    [INFO] |  |  |     +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for du
    plicate)
    [INFO] |  |  |     +- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted fo
    r duplicate)
    [INFO] |  |  |     \- (com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile - omitted f
    or duplicate)
    [INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.5.1:compile
    [INFO] |  |  |  +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
    cate)
    [INFO] |  |  |  \- (org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.5.1:compile - o
    mitted for duplicate)
    [INFO] |  |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.5.1:compile
    [INFO] |  |  |  +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
    cate)
    [INFO] |  |  |  +- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted for d
    uplicate)
    [INFO] |  |  |  \- (org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.1:compile - omit
    ted for duplicate)
    [INFO] |  |  \- org.apache.cxf:cxf-rt-ws-addr:jar:2.5.1:compile
    [INFO] |  |     +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
    cate)
    [INFO] |  |     +- (org.apache.cxf:cxf-common-utilities:jar:2.5.1:compile - omit
    ted for duplicate)
    [INFO] |  |     \- (org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.1:compile - omit
    ted for duplicate)
    [INFO] |  \- org.apache.cxf:cxf-rt-transports-http:jar:2.5.1:compile
    [INFO] |     +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for duplicat
    e)
    [INFO] |     +- org.apache.cxf:cxf-rt-transports-common:jar:2.5.1:compile
    [INFO] |     |  +- (org.apache.cxf:cxf-api:jar:2.5.1:compile - omitted for dupli
    cate)
    [INFO] |     |  \- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted for d
    uplicate)
    [INFO] |     +- (org.apache.cxf:cxf-rt-core:jar:2.5.1:compile - omitted for dupl
    icate)
    [INFO] |     \- org.springframework:spring-web:jar:3.0.6.RELEASE:compile
    [INFO] |        +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplic
    ate)
    [INFO] |        +- org.springframework:spring-beans:jar:3.0.6.RELEASE:compile
    [INFO] |        |  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile
     - omitted for duplicate)
    [INFO] |        +- org.springframework:spring-context:jar:3.0.6.RELEASE:compile
    [INFO] |        |  +- org.springframework:spring-aop:jar:3.0.6.RELEASE:compile
    [INFO] |        |  |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for
    duplicate)
    [INFO] |        |  |  +- (org.springframework:spring-asm:jar:3.0.6.RELEASE:compi
    le - omitted for duplicate)
    [INFO] |        |  |  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:com
    pile - omitted for duplicate)
    [INFO] |        |  |  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:comp
    ile - omitted for duplicate)
    [INFO] |        |  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compil
    e - omitted for duplicate)
    [INFO] |        |  +- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile
     - omitted for duplicate)
    [INFO] |        |  +- org.springframework:spring-expression:jar:3.0.6.RELEASE:co
    mpile
    [INFO] |        |  |  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:comp
    ile - omitted for duplicate)
    [INFO] |        |  \- org.springframework:spring-asm:jar:3.0.6.RELEASE:compile
    [INFO] |        \- org.springframework:spring-core:jar:3.0.6.RELEASE:compile
    [INFO] |           +- (org.springframework:spring-asm:jar:3.0.6.RELEASE:compile
    - omitted for duplicate)
    [INFO] |           \- commons-logging:commons-logging:jar:1.1.1:compile
    [INFO] +- org.apache.commons:commons-io:jar:1.3.2:compile
    [INFO] +- com.googlecode.gwt.charts:gwt-charts:jar:0.9.5:compile
    [INFO] +- junit:junit:jar:4.10:test
    [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.1:test
    [INFO] +- org.mockito:mockito-all:jar:1.9.5-rc1:test
    [INFO] +- org.jukito:jukito:jar:1.1:test
    [INFO] |  +- org.mockito:mockito-core:jar:1.8.5:test
    [INFO] |  |  +- (org.hamcrest:hamcrest-core:jar:1.1:test - omitted for duplicate
    )
    [INFO] |  |  \- org.objenesis:objenesis:jar:1.0:test
    [INFO] |  +- (junit:junit:jar:4.5:test - omitted for conflict with 4.10)
    [INFO] |  +- (com.google.inject:guice:jar:3.0:test - omitted for duplicate)
    [INFO] |  \- (com.google.inject.extensions:guice-assistedinject:jar:3.0:test - o
    mitted for duplicate)
    [INFO] +- org.seleniumhq.selenium:selenium-java:jar:2.22.0:test
    [INFO] |  +- org.seleniumhq.selenium:selenium-android-driver:jar:2.22.0:test
    [INFO] |  |  \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
    [INFO] |  |     +- cglib:cglib-nodep:jar:2.1_3:test
    [INFO] |  |     +- (org.json:json:jar:20080701:test - omitted for conflict with
    20090211)
    [INFO] |  |     +- (org.seleniumhq.selenium:selenium-api:jar:2.22.0:test - omitt
    ed for duplicate)
    [INFO] |  |     +- (org.apache.httpcomponents:httpclient:jar:4.1.2:test - omitte
    d for duplicate)
    [INFO] |  |     +- (com.google.guava:guava:jar:12.0:test - omitted for conflict
    with 13.0-rc2)
    [INFO] |  |     +- (org.apache.commons:commons-exec:jar:1.1:test - omitted for d
    uplicate)
    [INFO] |  |     +- (net.java.dev.jna:jna:jar:3.4.0:test - omitted for duplicate)

    [INFO] |  |     \- (net.java.dev.jna:platform:jar:3.4.0:test - omitted for dupli
    cate)
    [INFO] |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.22.0:test
    [INFO] |  |  \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
    - omitted for duplicate)
    [INFO] |  +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.22.0:test
    [INFO] |  |  +- org.seleniumhq.selenium:selenium-api:jar:2.22.0:test
    [INFO] |  |  |  \- (com.google.guava:guava:jar:12.0:test - omitted for conflict
    with 13.0-rc2)
    [INFO] |  |  +- net.sourceforge.htmlunit:htmlunit:jar:2.9:test
    [INFO] |  |  |  +- xalan:xalan:jar:2.7.1:test
    [INFO] |  |  |  |  \- xalan:serializer:jar:2.7.1:test
    [INFO] |  |  |  |     \- (xml-apis:xml-apis:jar:1.3.04:test - omitted for duplic
    ate)
    [INFO] |  |  |  +- commons-collections:commons-collections:jar:3.2.1:test
    [INFO] |  |  |  +- commons-lang:commons-lang:jar:2.6:test
    [INFO] |  |  |  +- org.apache.httpcomponents:httpmime:jar:4.1.2:test
    [INFO] |  |  |  |  +- (org.apache.httpcomponents:httpcore:jar:4.1.2:test - omitt
    ed for duplicate)
    [INFO] |  |  |  |  \- (commons-logging:commons-logging:jar:1.1.1:test - omitted
    for duplicate)
    [INFO] |  |  |  +- commons-codec:commons-codec:jar:1.4:test
    [INFO] |  |  |  +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.9:test
    [INFO] |  |  |  +- xerces:xercesImpl:jar:2.9.1:test
    [INFO] |  |  |  |  \- xml-apis:xml-apis:jar:1.3.04:test
    [INFO] |  |  |  +- net.sourceforge.nekohtml:nekohtml:jar:1.9.15:test
    [INFO] |  |  |  +- net.sourceforge.cssparser:cssparser:jar:0.9.5:test
    [INFO] |  |  |  |  \- org.w3c.css:sac:jar:1.3:test
    [INFO] |  |  |  +- (commons-io:commons-io:jar:2.0.1:test - omitted for duplicate
    )
    [INFO] |  |  |  \- (commons-logging:commons-logging:jar:1.1.1:compile - scope up
    dated from test; omitted for duplicate)
    [INFO] |  |  \- org.apache.httpcomponents:httpclient:jar:4.1.2:test
    [INFO] |  |     +- org.apache.httpcomponents:httpcore:jar:4.1.2:test
    [INFO] |  |     \- (commons-logging:commons-logging:jar:1.1.1:compile - scope up
    dated from test; omitted for duplicate)
    [INFO] |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.22.0:test
    [INFO] |  |  +- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
    - omitted for duplicate)
    [INFO] |  |  +- commons-io:commons-io:jar:2.0.1:test
    [INFO] |  |  \- org.apache.commons:commons-exec:jar:1.1:test
    [INFO] |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.22.0:test
    [INFO] |  |  +- net.java.dev.jna:jna:jar:3.4.0:test
    [INFO] |  |  +- net.java.dev.jna:platform:jar:3.4.0:test
    [INFO] |  |  \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
    - omitted for duplicate)
    [INFO] |  +- org.seleniumhq.selenium:selenium-iphone-driver:jar:2.22.0:test
    [INFO] |  |  \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
    - omitted for duplicate)
    [INFO] |  +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.22.0:test
    [INFO] |  |  +- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.22.0:test
    - omitted for duplicate)
    [INFO] |  |  \- (org.webbitserver:webbit:jar:0.4.6:test - omitted for duplicate)

    [INFO] |  +- org.seleniumhq.selenium:selenium-support:jar:2.22.0:test
    [INFO] |  |  \- (org.seleniumhq.selenium:selenium-api:jar:2.22.0:test - omitted
    for duplicate)
    [INFO] |  \- org.webbitserver:webbit:jar:0.4.6:test
    [INFO] |     \- org.jboss.netty:netty:jar:3.2.7.Final:test
    [INFO] +- info.cukes:cucumber-java:jar:1.0.11:test
    [INFO] |  \- info.cukes:cucumber-core:jar:1.0.11:test
    [INFO] |     +- info.cukes:gherkin:jar:2.11.1:test
    [INFO] |     \- info.cukes:cucumber-html:jar:0.2.1:test
    [INFO] +- info.cukes:cucumber-guice:jar:1.0.11:test
    [INFO] |  \- (info.cukes:cucumber-java:jar:1.0.11:test - omitted for duplicate)
    [INFO] \- info.cukes:cucumber-junit:jar:1.0.11:test
    [INFO]    \- (info.cukes:cucumber-core:jar:1.0.11:test - omitted for duplicate)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.014s
    [INFO] Finished at: Tue Sep 11 09:08:32 CDT 2012
    [INFO] Final Memory: 13M/218M
    [INFO] ------------------------------------------------------------------------

RemoteR is supposed to be a CXF SOAP web service that runs autonomously. All I want in this project is the "client" portion which is able to make requests to the web service hosted elsewhere. So seeing spring dependencies in my current project is making me suspect that I may have some JPA collisions here.

È stato utile?

Soluzione

You can see which dependecies including transitive dependencies you have via

mvn dependency:tree

However I would assume this jar comes from your application server. Is it jOnAS by chance?

Here is an example of a depending on Hibernate which implements JPA

    <properties>        
            <hibernate.version>4.1.4-Final</hibernate.version>
    </properties>
    ......
    ......
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernate.version}</version>         
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>         
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-annotations</artifactId>
        <version>${hibernate.version}</version>         
    </dependency>

Altri suggerimenti

You mix a lot of notions here, let me clarify...

First JPA vs EJB - JPA stands for java persistence architecture - its a specification, a part of Java EE spec, that describes how to implement ORM and store your stuff in the database. Under the hood it can be implemented with hibernate, toplink or any other ORM framework.

Now EJB - stands for Enterprise Java Beans is another spec that address the business logic and defines how to create code invoked remotely. Historically (before EJB3) the spec of ejb mentioned both JPA and EJB hence the mix. But now the separation is very clear.

Regarding your question.

javax.persistence.EntityManager is a class of JPA, but the whole Criteria API was added only in JPA 2.0 So your first link doesn't include it only because it describes the JPA 1.0 specification

What should you do? The answer is as usual 'it depends' :)

In the ideal world I would tell you something like: " upgrade to the JPA 2.0 and use Criteria API"

Technically you should update dependency versions in your pom.xml (you said that your project is mavenized) and you'll be fine.

However in practice its not that easy:

  • Java EE is implemented by container (a.k.a. application server) so the chances are that you're running your project inside JBoss/Glassfish/WebShere, you name it. Usually each version of application server implements specific version on Java EE.

    JPA 1.0 is a part of Java EE 5.0 and JPA 2.0 (with your criteria api) is a part of Java EE 6.0

    So you should be sure that the application server is able to run the Java EE 6 if you really want to use this criteria api.

  • Another issue I have to mention is that under the hood the ORM framework also evolves, so if you're upgrading you'll get the newer version of, say, hibernate.

    This can introduce some inconsistencies, especially in complicated queries.

So the choice is yours.

Disclaimer: I haven't used guice-persist so my answer addresses applications running inside a Java EE container.

Hope it helps

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top