By Sunkara Ravi Prakash Software Architect (Java & Voip Sip Protocol) Afxisi Inc LLC
By Sunkara Ravi Prakash Software Architect (Java & Voip Sip Protocol) Afxisi Inc LLC
Some Plug-in’s are they are which can do caring the session
objects, If you’re going use the Struts2 with hibernates[which
using AbstractGenricDAO Patterns with cacade pattern].
Org.springframework.jdbc,datasource.DriverManagerDataConfig,
Org.springframework.beans.factory.config.PropertiesFacortyBean
Org.springframework.orm.hibernate.LocalSessionFactoryBean
Org,springframework.org.hibernate.hibernateTransactionManager.
@param of the sessionfactory object of LocalSessionFactoryBean
@returns the Transactionmanager object.
Should access bean reference of SessionFactory to
HibenateTransactionManager.
The above class most do configure in spring context initial to access the
Business Objects.
Spring context.
DataSource of drivermanager, this
jndiobjectfactorybean
Spring DAO.
Exception handler to orm
Spring Core.
Bean.factory.config.ProperrtiesBeanFactory
class.
Bean name id.
Developers has understands the how AOP will calls the Objects of bean
name.
Before that lets gives a sample applicationcontext.xml of hibernate
and springs.
<bean id="dataSoruce" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url" value="jdbc:mysql://localhost/springdb"/>
<property name="username" value="root"/>
<property name="password" value="admin1234"/>
</bean>
Above bean is a spring context module, for jndiobjectfactorybean
Jdbc jndi property, dataSource.
<bean id="hibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.connection.pool_size">10</prop>
<prop key="show_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</prop>
</props>
</property>
</bean>
hibernateProperties bean object, from spring core, for
factoryBean object.
<bean id="exampleSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBe
an">
<property name="dataSource" >
<ref local="dataSoruce"/>
</property>
<property name="hibernateProperties">
<ref bean="hibernateProperties"/>
</property>
<property name="mappingResources">
<list>
<value>Person.hbm.xml</value>
</list>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionM
anager">
<property name="sessionFactory"><ref
bean="exampleSessionFactory"/></property>
</bean>
<bean id="personsDAO"
class="org.springframework.transaction.interceptor.TransactionP
roxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="target">
<ref local="personDetails"/>
</property>
<property name="transactionAttributes">
<props>
<prop
key="addPerson">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
PersonImpl personimpls =
(PersonImpl)xmlbeancontext(“personDetails”);
Personimpl.addPerson(person); // person is persistence class,