Home Get Dialect within some class inside Spring MVC + Hibernate application
Reply: 0

Get Dialect within some class inside Spring MVC + Hibernate application

user1653 Published in July 23, 2018, 1:43 pm

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="hibernate.hbm2ddl.auto">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 need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.522952 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO