Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just to give you high level prespective. JPA is standard persistence API provided by SUN.<br> You can use any persistence framework like Hibernate,TopLink,JDO etc as persistence provider with JPA.<br></p> <p>So just to make things clear </p> <p>Your code -----> JPA ----->Persistence Provider(Hibernate).</p> <p>Its will be good practice to use JPA as it is standard library.</p> <p>So what is your persistence provider information should only be known to JPA and not your code specific XML's.</p> <p>This is how your persistence.xml will look like</p> <pre><code>&lt;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; &lt;persistence-unit name="QuarkFrameworkPU" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;/persistence-unit&gt; </code></pre> <p></p> <p>And your Application context will look like (Dependent on JPA , no mention of Hibernate)</p> <pre><code> &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="com.mysql.jdbc.Driver" p:url="${db.url}" /&gt; &lt;!-- ADD PERSISTENCE SUPPORT HERE (jpa,etc) --&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="persistenceUnitName" value="QuarkFrameworkPU" /&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="jpaVendorAdapter"&gt; &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt; &lt;property name="showSql" value="true" /&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload