Announcement Announcement Module
Collapse
No announcement yet.
Hibernate Dialect must be explicitly set Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate Dialect must be explicitly set

    Hello,

    I'm trying to configure and make a test with Spring and Hibernate.

    All object were generated by beaworkshop10 from existing database
    and it throws an exception after I have generated ORM Spring classes.


    What is missing? Or maybe I have forgot to deploy something?
    Do I need to configure tomcat?



    I got the following exception:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
    ...
    ...
    org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

    hibernate.cfg.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE hibernate-configuration PUBLIC
    	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    	"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    
    <hibernate-configuration>
    	<session-factory>
    		<property name="hibernate.dialect">org.hibernate.dialect.GenericDialect</property>
    		<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
    		<property name="hibernate.connection.url">jdbc:postgresql://localhost/database</property>
    		<property name="hibernate.connection.username">postgres</property>
    		<property name="hibernate.connection.password">postgres</property>
    		<property name="hibernate.default_schema">public</property>
    		<mapping resource="orm/ObjectOne.hbm.xml"/>
    		<mapping resource="orm/ObjectTwo.hbm.xml"/>
    	</session-factory>
    </hibernate-configuration>

    applicationContext.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>	
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	</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>
    	<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
    		<property name="transactionManager" ref="transactionManager"/>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="persist*">PROPAGATION_REQUIRED,-Exception</prop>
    				<prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="MyappService" parent="baseTransactionProxy">
    		<property name="target">
    			<bean class="dao.MyappSpringService">
    				<property name="dao">
    					<bean class="dao.MyappHibernateDao">
    						<property name="sessionFactory" ref="sessionFactory"/>
    					</bean>
    				</property>
    			</bean>
    		</property>
    	</bean>
    	</beans>
    Last edited by projuri; Jul 21st, 2007, 09:57 AM.

  • #2
    solved

    problem has been solved after adding the following line to the applicationContext.xml

    Code:
    <property name="configLocation" value="WEB-INF/classes/hibernate.cfg.xml"/>

    Comment


    • #3
      Hibernate Dialect must be explicitly set

      Hi Friends ,
      i am Siva, i am new member to this forum and learning hibenrate and spring .
      i am getting the following error when i tried to execute my example program in spring .
      Hibernate Dialect must be explicitly set.

      can anyone help me regarding this problem?




      Thanks n Regards..
      Siva

      Comment


      • #4
        Without any configuration it is going to be hard to pin point your problem. But you probably haven't set the Hibernate Dialect. Read chapter 12.2 of the reference guide for more information.

        Comment

        Working...
        X