2

this is the relevant part from my context.xml file:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="packagesToScan" value="com.netomedia.model"/>  
<property name="jpaProperties">
    <props>
        <prop key="hibernate.hbm2ddl.auto">update</prop>
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
    </props>
</property>
<!-- <property name="persistenceUnitName" value="punit"/> -->
<property name="dataSource" ref="dataSource"/>
<property name="jpaDialect">
    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
</property>
<property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="database" value="MYSQL"/>
        <!-- <property name="databasePlatform" value="${hibernate.dialect}"/> -->
        <property name="showSql" value="false"/>               
        <property name="generateDdl" value="false"/>
        <!-- <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/> -->
        <!--  <property name="hibernate.connection.autocommit" value="false"/> -->
    </bean>
</property>
<property name="jpaPropertyMap">
    <map>
        <entry key="hibernate.connection.autocommit" value="false" />
    </map>
</property>

i wanted to know if this is the correct way to configure hibernate.dialect and what is the difference between them:

<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>

or

<property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/>

thank you!!

1 Answer 1

2

I am not sure if other is valid syntax, but this works:

<property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/>

Update: I believe either one of them should work, prop key=hibernate.dilect is hibernate property and property name=databasePlatform is spring property.

you can wish to add one or more hibernate specific properties under < props>...

Sign up to request clarification or add additional context in comments.

1 Comment

thank you! i should delete the <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.