+1  A: 

You need to start at the beginning: Sun's JPA tutorial.

This might help as well.

You need to create the persistence.xml and put it in the META-INF directory for your project.

Hibernate is one concrete implementation for JPA, but there are others (e.g., JDO).

duffymo
JDO is a specification for persistence to any type of datastore. It is *not* an implementation of JPA. OpenJPA is an implementation of JPA, as is DataNucleus, or EclipseLink.
DataNucleus
So when Google App Engine tells that they require JPA, and Hibernate or JDO are two of my persistence implementation choices, you're telling me that they have no idea of what they're doing? Sounds like you're arguing semantics here.
duffymo
You said that "there are other" implementations of JPA, and mentioned JDO in that context. So I simply corrected the statement since JDO has no relation to JPA ;-)Google AppEngine provides support for JDO and JPA, and that support is provided through the DataNucleus implementation of JDO for BigTable, and the DataNucleus implementation of JPA for BigTable. They do not support Hibernate (which is for RDBMS datastore only). Obviously some other group could provide another implementation of JDO or JPA for BigTable datastore if they wanted, the benefit of having specifications for persistence.
DataNucleus
Okay, thank you for the correction. After viewing your bio, I'm glad to take instruction from an authority on the subject.
duffymo
+4  A: 

Replace the <jpaconfiguration /> with the <configuration /> tag, as detailed in Hibernate Tools docs:

<configuration
    configurationfile="hibernate.cfg.xml"
    propertyfile="hibernate.properties"
    entityresolver="EntityResolver classname"
    namingstrategy="NamingStrategy classname">
andri
+1 for finding the docs for hibernate tools -- I wish envers had docs of similar quality :(
Jason S
+4  A: 

Just to give you high level prespective. JPA is standard persistence API provided by SUN.
You can use any persistence framework like Hibernate,TopLink,JDO etc as persistence provider with JPA.

So just to make things clear

Your code -----> JPA ----->Persistence Provider(Hibernate).

Its will be good practice to use JPA as it is standard library.

So what is your persistence provider information should only be known to JPA and not your code specific XML's.

This is how your persistence.xml will look like

<persistence version="1.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_1_0.xsd"&gt;
<persistence-unit name="QuarkFrameworkPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
</persistence-unit>

And your Application context will look like (Dependent on JPA , no mention of Hibernate)

    <bean id="dataSource"
 class="org.springframework.jdbc.datasource.DriverManagerDataSource"
 p:driverClassName="com.mysql.jdbc.Driver" p:url="${db.url}" />




<!-- ADD PERSISTENCE SUPPORT HERE (jpa,etc) -->

<bean id="entityManagerFactory"
 class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
 <property name="persistenceUnitName" value="QuarkFrameworkPU" />
 <property name="dataSource" ref="dataSource" />
 <property name="jpaVendorAdapter">
  <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
   <property name="showSql" value="true" />
  </bean>
 </property>
</bean>

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
 <property name="entityManagerFactory" ref="entityManagerFactory" />
 <property name="dataSource" ref="dataSource" />
</bean>
Khangharoth
> You can use any persistence framework like Hibernate,TopLink,JDO etc as persistence provider with JPA.No you can't. You can use any JPA *implementation*. JDO is a specification for persistence, just like JPA is a specification for persistence.
DataNucleus
hmmm not sure about JDO ..need to check
Khangharoth
+1  A: 

You need annotationconfiguration not jpaconfiguration.

qbn
got it. (technically I need either annotationconfiguration or configuration, but in my case I'm using annotations.)
Jason S
Right, but annotationconfiguration is your best bet. The envers guys just fixed the issue with making those audit tables' schema when using annotationconfiguration and hibernatetool via ANT.
qbn