English 中文(简体)
Hibernate 3.6 + JPA2 + Guice-persist + Maven
原标题:Hibernate 3.6 + JPA2 + Guice-persist + Maven

是否可能使用Hibernate 3.6 + JPA2 + Guice-persist + Maven通过maven?

我曾尝试过很多套房,并且没有工作。

我已注意到,光电灯-公用公用公用公用公用公用公用公用公示,如果排除,我就使用<条码>。 Errorjection Constructionor, java.lang.NoClassDefFoundError:org/hibernate/annotations/common/reflectionManager差错。

此时此刻,我寄希望于:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>foo</artifactId>
<name>Foo</name>
<description>bar. </description>
<packaging>jar</packaging>

<!-- ~le propriedades com as versoes das coisas~ -->
<properties>
    <hibernateVersion>3.6.10.Final</hibernateVersion>
    <bval.version>0.4</bval.version>
</properties>

<!-- ~le dependencias~ -->
<dependencies>
    <!-- ~ le jsr303 ~ -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>
    <dependency>
        <groupId>br.com.caelum.stella</groupId>
        <artifactId>caelum-stella-bean-validation</artifactId>
        <version>2.0-beta1</version>
    </dependency>

    <!-- ~ le hibernate... ~ -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernateVersion}</version>
        <exclusions>
            <exclusion>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-commons-annotations</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernateVersion}</version>
        <exclusions>
            <exclusion>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-commons-annotations</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-c3p0</artifactId>
        <version>${hibernateVersion}</version>
    </dependency>


    <!-- ~ le ehcache ~ -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-ehcache</artifactId>
        <version>${hibernateVersion}</version>
    </dependency>


    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901.jdbc4</version>
    </dependency>

    <!-- ~ le cglib ~ -->
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>

    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>${guiceVersion}</version>
    </dependency>
    <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-persist</artifactId>
        <version>${guiceVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-core</artifactId>
        <version>${bval.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-jsr303</artifactId>
        <version>${bval.version}</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
</dependencies>

我坚持这样做:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="scuv" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>br.com.digitaldoc.scuv.model.Produto</class>
    <class>br.com.digitaldoc.scuv.model.Cliente</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <!-- Validation modes: AUTO, CALLBACK, NONE -->
    <validation-mode>AUTO</validation-mode>
    <properties>
      <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
      <property name="hibernate.id.new_generator_mappings" value="true"/>
      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://127.0.0.1:5432/SCUV"/>
      <property name="javax.persistence.jdbc.user" value="postgres"/>
      <property name="javax.persistence.jdbc.password" value="postgre"/>
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
      <!-- ehcache second level cache config -->
      <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/>
      <property name="hibernate.cache.use_query_cache" value="true"/>
      <property name="hibernate.cache.use_second_level_cache" value="true"/>
      <property name="hibernate.generate_statistics" value="true"/>
      <property name="net.sf.ehcache.configurationResourceName" value="META-INF/ehcache.xml"/>
      <!-- c3p0 connection pool config -->
      <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/>
     <property name="c3p0.acquire_increment" value="1"/>
      <property name="c3p0.idle_test_period" value="100"/>
      <!-- seconds -->
      <property name="c3p0.max_size" value="100"/>
      <property name="c3p0.max_statements" value="0"/>
      <property name="c3p0.min_size" value="10"/>
      <property name="c3p0.timeout" value="100"/>
    </properties>
  </persistence-unit>
</persistence>

And I inject my EntityManager with Guice... Am I doing something wrong? Thanks in advance.

最佳回答

我仅用EclipseLink取代秘密。 没有做罚款。

问题回答

暂无回答




相关问题
Multiple Hibernate instances using C3P0

I am facing a weird problem and it seems to be c3p0 related. I am starting two instances of an app in the same java vm which interact with each other. After some operations "APPARENT DEADLOCK" ...

Hibernate vs Ibatis caching

We can speed up a hibernate app easyly with 2nd level cache using infinispan or ehcache/terracotta,... but ibatis only have a simple interface to implement for caching. And hibernate knows more ...

Using annotations to implement a static join in hibernate

I m relatively new to hibernate and was wondering if someone could help me out. While I have no issues implementing a normal join on multiple columns in hibernate using the @JoinColumns tag, I m ...

Hibernate query with fetch question

I have a 2 entities in a One-To-Many relationship: OfficeView.java: public class OfficeView implements java.io.Serializable { private Integer officeId; private String addr1; private ...

hibernate interceptors : afterTransactionCompletion

I wrote a Hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[]...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

Hibernate/GORM: collection was not processed by flush()

I have an integration test in my Grails application that fails when I try to save an entity of type Member invitingMember.save(flush: true) This raises the following exception org.hibernate....

Hibernate Criteria API equivalent for "elements()"

Is it possible to implement the following query using Criteria API? select order from ORDER as order,ITEM as item where item.itemID like ITM_01 and item in elements(order.items)

热门标签