Click here to Skip to main content
15,895,667 members
Articles / Programming Languages / Java

Pivot 1.4, Spring and Hibernate is my RPG Game

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
29 Mar 2010CPOL12 min read 37.9K   550   8  
Pivot 1.4, Spring and Hibernate is my RPG Game
<?xml version="1.0" encoding="UTF-8"?>
<!-- 
/**
 * A tutorial for Article Pivot 1.4, Spring and Hibernate is my RPG Game.
 * 
 * Author	: Adrabi Abderrahim
 * E-mail	: adrabi[at]gmail[dot]com
 * Year		: 2010
 * License	: The Code Project Open License (CPOL) 
 * 				http://www.codeproject.com/info/cpol10.aspx
 * 
 */
 -->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

	<!-- @Required process -->
	<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>
	
	<!-- @Exception translation bean post process -->
	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
	
	<!-- @External Configuration (name by default)-->
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>classpath:jdbc.properties</value>
			</list>
		</property>
	</bean>

	<!-- @Spring datasource can handler just one database -->
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${jdbc.driverClassName}"></property>
		<property name="url" value="${jdbc.url}"></property>
		<property name="username" value="${jdbc.username}"></property>
		<property name="password" value="${jdbc.password}"></property>
	</bean>

	<!-- Hibernate Session Factory --> 
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
		<property name="dataSource" ref="dataSource"></property>
		<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
				<prop key="hibernate.query.substitutions">true 'Y',false 'N'</prop>
				<prop key="hibernate.cache.use_second_level_cache">true</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<prop key="hibernate.use_sql_comments">true</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
	
	<!-- Mob DAO -->
	<bean id="mobDAO" class="adrabi.codeproject.model.dao.MobDAOImpl">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
</beans>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
Morocco Morocco
Adrabi!, Just another Ghost in the Shell =)

Comments and Discussions