java - Get Dialect within some class inside Spring MVC + Hibernate application -
i have hibernate transaction manager configured inside spring mvc controller.
<bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="org.postgresql.driver" /> <property name="url" value="jdbc:postgresql://127.0.0.1/doolloop2" /> <property name="username" value="doolloop2" /> <property name="password" value="doolloop" /> </bean> <bean id="sessionfactory" class="org.springframework.orm.hibernate3.localsessionfactorybean"> <property name="datasource" ref="datasource" /> <property name="mappinglocations"> <list> <value>web-inf/mapping/user.hbm.xml</value> </list> </property> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.postgresqldialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <bean id="txmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory" /> </bean> in addition, have class needs hibernate dialect inside on of method. class not configured bean inside spring framework.
how can access hibernate dialect property class? believe should static class,but don't know how can it. please help.
you separate properties spring config. put them in properties file, reference in propertyplaceholderconfigurer bean ( http://almaer.com/blog/spring-propertyplaceholderconfigurer-a-nice-clean-way-to-share ). inject value whatever bean need value in same way injecting sessionfactory bean.
Comments
Post a Comment