Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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:context="http://www.springframework.org/schema/context"
- xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop" 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.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
- http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
- <context:annotation-config />
- <!-- Sesuaikan dengan nama package dao (data access object) yang telah dibuat atau mau dibuat -->
- <context:component-scan base-package="com.asm.dao" />
- <!-- Local Database -->
- <!--koneksi mysql-->
- <bean id="dsGammu_1" class = "com.mchange.v2.c3p0.ComboPooledDataSource">
- <property name="driverClass" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://172.168.100.72:3306/gammu_blast1" />
- <property name="user" value="gammu_blast" />
- <property name="password" value="4k53594mmu" />
- <property name="minPoolSize" value="1" />
- <property name="maxPoolSize" value="2" />
- <property name="maxStatements" value="100" />
- <property name="testConnectionOnCheckout" value="true" />
- </bean>
- <bean id="entityManagerFactoryGammu_1" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="dataSource" ref="dsGammu_1"/>
- <property name="loadTimeWeaver">
- <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
- </property>
- <!-- Sesuaikan dengan nama package entity yang telah atau mau dibuat -->
- <property name="packagesToScan" value="com.acs.gammu.entity"/>
- <property name="jpaVendorAdapter">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
- <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
- <!-- showsql = true sama dengan menampilkan sql atau query di log-->
- <property name="showSql" value="false" />
- <!-- generateddl= true sama dengan create tables and fields in database (syarat database sudah tersedia, otomatis generate tabel dan column)-->
- <property name="generateDdl" value="false" />
- </bean>
- </property>
- <property name="jpaProperties">
- <props>
- <prop key="hibernate.format_sql">true</prop>
- </props>
- </property>
- </bean>
- <!-- transactionManagerInternal biasa dipakai buat aksi simpan, ubah, hapus, cari dll
- contoh :
- @Transactional(value = "transactionManagerGammu_1")
- public void save(BusPendaftaran data) {
- em.persist(data);
- }
- @Transactional(value = "transactionManagerGammu_1")
- public void update(BusPendaftaran data) {
- em.merge(data);
- }
- -->
- <bean id="transactionManagerGammu_1" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="rollbackOnCommitFailure" value="true" />
- <property name="entityManagerFactory" ref="entityManagerFactoryGammu_1"/>
- <property name="jpaDialect">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
- </property>
- </bean>
- <!-- sharedEntityManagerInternal = (Resource / EntityManager)
- contoh :
- @Resource(name = "sharedEntityManagerGammu_1")
- private EntityManager em;
- -->
- <bean id="sharedEntityManagerGammu_1" name="sharedEntityManagerGammu_1" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
- <property name = "entityManagerFactory" ref="entityManagerFactoryGammu_1"/>
- </bean>
- <tx:annotation-driven transaction-manager="transactionManagerGammu_1" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement