Java Reference
In-Depth Information
<beans
<beans xmlns= "http://www.springframework.org/schema/beans"
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx= "http://www.springframework.org/schema/tx"
xsi:schemaLocation= "
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"
default-autowire= "byName" >
<bean
<bean id= "entityManagerFactory"
class= "org.springframework.orm.jpa.
LocalContainerEntityManagerFactoryBean" >
<property
<property name= "jpaVendorAdapter" >
<bean
<bean class= "org.springframework.orm.jpa.vendor
.HibernateJpaVendorAdapter" >
<property
<property name= "showSql" value= "false" //>
<property
<property name= "generateDdl" value= "true" //>
<property
<property name= "databasePlatform"
value= "org.hibernate.dialect.HSQLDialect" //>
</bean>
</property>
</bean>
</property>
</bean>
</bean>
<bean
<bean id= "dataSource"
class= "org.apache.commons.dbcp.BasicDataSource"
destroy-method= "close" >
<property
<property name= "driverClassName"
value= "org.hsqldb.jdbcDriver" //>
<property
<property name= "url" value= "jdbc:hsqldb:test/db/myDB" //>
<property
<property name= "username" value= "sa" //>
<property
<property name= "password" value= "" //>
</bean>
</bean>
<bean
<bean id= "transactionManager"
class= "org.springframework.orm.jpa.JpaTransactionManager" //>
<tx:annotation-driven/>
The first part of the Spring configuration file is the configuration required to get JPA and
Spring to work together. While the package structure for the Spring example is simpler than
the EJB one, you can see that the configuration is a bit more complex.
<bean
<bean class= "org.springframework.orm
.jpa.support.PersistenceAnnotationBeanPostProcessor" //>
Search WWH ::




Custom Search