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://" />
  <property name="username" value="doolloop2" />
  <property name="password" value="doolloop" />

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
     <property name="mappingLocations">
    <property name="hibernateProperties">
  <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> 
  <prop key="hibernate.show_sql">true</prop> 
  <prop key="">update</prop> 
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />

In Addition, I have some class which needs to get Hibernate Dialect inside on of it method. Is class is not Configured as bean inside Spring Framework.

How can I access Hibernate Dialect property from this class? I believe it should be some static class,but I don't know how can I do it. Please help.


You could separate the properties from the spring config. Put them in a properties file, then reference that in a PropertyPlaceholderConfigurer bean ( ). Then you could inject that value into whatever bean it is that you need the value in the same way you are injecting it into the sessionFactory bean.

Need Your Help

How do I fix SVN 'Working copy text base is corrupt'?

svn repository

After many happy commits to my svn repo, all of the sudden the relationship went sour...svn flipped her lid and yelled: "Working copy text base is corrupt!"

CData not being parsed with NSXmlparser

ios ipad xml-parsing nsxmlparser cdata

I receive response in the form of xml from a service,which i parse using nsxmlparser.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.