1 <?xml version="1.0" encoding="UTF-8"?>
5 * This is a common dao with basic CRUD operations and is not limited to any
6 * persistent layer implementation
8 * Copyright (C) 2008 Imran M Yousuf (imyousuf@smartitengineering.com)
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 3 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 Document : db-beanfactory.xml
27 Created on : May 20, 2008, 8:21 PM
30 This document will contain the Spring Application Context for the DB
31 Persistene Engine Implementation
33 <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "spring-beans.dtd" >
36 Please make sure the following properties are availabe to the context
37 com.smartitengineering.dao.connection.driver_class
38 com.smartitengineering.dao.connection.url
39 com.smartitengineering.dao.connection.username
40 com.smartitengineering.dao.connection.password
41 com.smartitengineering.dao.dialect
42 com.smartitengineering.dao.show_sql
44 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
45 <property name="locations">
47 <value>classpath:db-config.properties</value>
50 <property name="properties" >
52 <prop key="hibernate.connection.driver_class">${com.smartitengineering.dao.connection.driver_class}
54 <prop key="hibernate.connection.url">${com.smartitengineering.dao.connection.url}
56 <prop key="hibernate.connection.username">${com.smartitengineering.dao.connection.username}
58 <prop key="hibernate.connection.password">${com.smartitengineering.dao.connection.password}
60 <prop key="hibernate.dialect">${com.smartitengineering.dao.dialect}
62 <prop key="hibernate.show_sql">${com.smartitengineering.dao.show_sql}
68 <!-- Local C3P0 DataSource that works in any environment -->
69 <!-- (Both DataSource implementations have a "close" method to be called on shutdown) -->
70 <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
71 <property name="driverClass">
72 <value>${hibernate.connection.driver_class}</value>
74 <property name="jdbcUrl">
75 <value>${hibernate.connection.url}</value>
77 <property name="user">
78 <value>${hibernate.connection.username}</value>
80 <property name="password">
81 <value>${hibernate.connection.password}</value>
83 <property name="acquireIncrement">
86 <property name="checkoutTimeout">
89 <property name="initialPoolSize">
92 <property name="maxIdleTime">
95 <!-- Will never expire (seconds)-->
96 <property name="maxPoolSize">
99 <property name="maxStatements">
102 <property name="maxStatementsPerConnection">
105 <property name="minPoolSize">
108 <property name="numHelperThreads">
113 <!-- Hibernate SessionFactory -->
114 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
115 <property name="dataSource">
116 <ref local="dataSource" />
118 <property name="mappingResources">
120 <value>hbm/PublicationHouse.hbm.xml</value>
123 <property name="hibernateProperties">
125 <prop key="hibernate.dialect">${hibernate.dialect}
127 <prop key="hibernate.autoCommit">true
129 <prop key="hibernate.show_sql">${hibernate.show_sql}
131 <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
132 <prop key="hibernate.query.substitutions">true 'T', false 'F'
137 <bean id="abstractDao" class="com.smartitengineering.dao.impl.hibernate.AbstractDAO" abstract="true">
138 <property name="sessionFactory">
139 <ref local="sessionFactory" />
142 <bean id="daoImpl" class="com.smartitengineering.bookstore.serviceimplementation.AbstractDaoImpl" parent="abstractDao">