what is the right way to set flushmode in hibernate

Viewed 7771

Help on setting hibernate's flush property.

I am getting below error.

Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.

I am just confused how would i set the flush property.

<property name="org.hibernate.FlushMode" value="COMMIT"/> 

   <property name="org.hibernate.flushMode" value="COMMIT"/>  

   <property name="org.hibernate.flushMode" value="commit"/>   

   <property name="hibernate.flushMode" value="COMMIT"/>

What is the proper way to set the property without using any java code?

I tried in this way but still its showing the same error.

<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">root</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">update</property> 
        <property name="org.hibernate.flushMode" >commit</property> 
        <mapping class="com.example.User" />
    </session-factory>
</hibernate-configuration>
1 Answers
Related