Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's almost the same thing for <code>Spring 3.1</code> and higher.</p> <p>Here an example : </p> <pre><code>&lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:packagesToScan="com.sahandrc.survey" p:dataSource-ref="dataSource" p:jpaPropertyMap-ref="jpaPropertyMap" p:jpaVendorAdapter-ref="hibernateVendor" /&gt; </code></pre> <p>Example with everything in the context file : </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"&gt; &lt;context:property-placeholder location="WEB-INF/database.properties"/&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:packagesToScan="com.sahandrc.survey" p:dataSource-ref="dataSource" p:jpaPropertyMap-ref="jpaPropertyMap" p:jpaVendorAdapter-ref="hibernateVendor" /&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}" p:password="${jdbc.password}" p:maxActive="${dbcp.maxActive}" p:maxIdle="${dbcp.maxIdle}" p:maxWait="${dbcp.maxWait}"/&gt; &lt;util:map id="jpaPropertyMap"&gt; &lt;entry key="generateDdl" value="${hibernate.generate_ddl}"/&gt; &lt;entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}"/&gt; &lt;entry key="hibernate.dialect" value="${hibernate.dialect}"/&gt; &lt;entry key="hibernate.default_schema" value="${hibernate.default_schema}"/&gt; &lt;entry key="hibernate.format_sql" value="${hibernate.format_sql}"/&gt; &lt;/util:map&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt; &lt;/bean&gt; &lt;/beans&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