All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ppfuse-hibernate.2.0-m3.source-code.applicationContext-dao.xml Maven / Gradle / Ivy

There is a newer version: 3.5.0
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <!-- Hibernate SessionFactory -->
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
        <property name="hibernateProperties">
            <value>
                hibernate.dialect=${hibernate.dialect}
                hibernate.hbm2ddl.auto=update
                hibernate.query.substitutions=true 'Y', false 'N'
            </value>
            <!-- Turn batching off for better error messages under PostgreSQL -->
            <!-- hibernate.jdbc.batch_size=0 -->
        </property>
    </bean>

    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <!-- UniversalDao - can be used when doing standard CRUD - made available 
        for those who don't mind casting.  If you don't want to cast, look at 
        'fooDao' below. -->
    <bean id="universalDao" class="org.appfuse.dao.hibernate.UniversalDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="lookupDao" class="org.appfuse.dao.hibernate.LookupDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="userDao" class="org.appfuse.dao.hibernate.UserDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="roleDao" class="org.appfuse.dao.hibernate.RoleDaoHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    
    <!-- If you want to be able to do simple CRUD for new domain objects without 
        having to cast, you don't have create a Dao interface and implementation 
        for that domain object, you simply have to do the following.  
        
        eg... 'fooDao'
    
    <bean id="fooDao" class="org.appfuse.dao.hibernate.GenericDaoHibernate">
        <constructor-arg value="org.appfuse.model.Foo"/>
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    
    You will need to create a Dao interface and implementation for that 
        domain object if you need more than simple CRUD to occur.  
        (finders, bulk update/delete, etc.)
    -->

    <!-- Add new DAOs here -->

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy