Results 1 to 2 of 2

Thread: Hibernate + LocalContainerEntityManagerFactoryBean Issue

  1. #1
    Join Date
    Nov 2007
    Posts
    9

    Default Hibernate + LocalContainerEntityManagerFactoryBean Issue

    I'm currently using the LocalContainerEntityManagerFactoryBean with a JPA adapter, using Hibernate as the JPA Vendor.

    My setup is as follows:

    Code:
         <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
            <property name="entityManagerFactory" ref="entityManagerFactory"/>
        </bean>
    
        <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
    
        <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
    
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/>
            <property name="url" value="jdbc:jtds:sqlserver://some-server.com:1433/MyDatabase"/>
            <property name="username" value="dbAdmin"/>
            <property name="password" value="dbAdminPassword"/>
        </bean>
        
        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
            <property name="persistenceUnitName" value="MyApplicationPersistanceUnitName"/>
            <property name="jpaVendorAdapter">
                <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                    <property name="databasePlatform" value="org.hibernate.dialect.SQLServerDialect"/>
                    <property name="generateDdl" value="false"/>
                    <property name="showSql" value="false"/>
                </bean>
            </property>
            <property name="jpaProperties"> 
    			<props> 
    				<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> 
    			</props> 
    		</property> 
            <property name="dataSource" ref="dataSource"/>
        </bean>
    When I run the above with Jetty or WebSphere, it works great, but when I run it with Apache Geronimo, I get this exception:
    javax.persistance.PersistenceException: org.hibernate.HibernateExceptoin: Hibernate Dialect must be explicitly set...
    anyone have some insight as to why this might be happening?

  2. #2
    Join Date
    Nov 2007
    Posts
    9

    Default

    alright, so 5min after posting this, I figured this out.

    I've basicly forgot to put the dialect in the META-INF/persistence.xml.

    But it still boggles my mind, why didn't Jetty or WebSphere complain about this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •