Skip to content

Instantly share code, notes, and snippets.

@eric2323223
eric2323223 / persistenceJpaConfig.xml
Created September 4, 2012 02:18 — forked from eugenp/persistenceJpaConfig.xml
Transaction configuration with Spring 3.1 - the transaction Configuration in XML
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEmf" />
</bean>
<tx:annotation-driven transaction-manager="txManager" />
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ContextConfiguration {
@Bean
public DataSource dataSource() {
@eric2323223
eric2323223 / applicationContext.xml
Created September 4, 2012 02:11
Sample spring embedded database configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">
@eric2323223
eric2323223 / gist:3615714
Created September 4, 2012 02:03
Sample persistence: hibernate
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="ApplicationEntityManager" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.appfuse.model.Car</class>
<class>org.appfuse.model.Role</class>
<!--
Adding more <class>f.q.c.Name</class> elements here is not required.