4

When I try to save a new istance on the db I get Spring database is locked. I'm using

  <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                    <version>5.2.4.Final</version>
                    <exclusions>
                        <exclusion>
                            <groupId>asm</groupId>
                            <artifactId>asm</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>asm</groupId>
                            <artifactId>asm-attrs</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>cglib</groupId>
                            <artifactId>cglib</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>javax.el</groupId>
                            <artifactId>el-api</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <version>5.2.4.Final</version>
                    <scope>runtime</scope>
                </dependency>

And for sqlite dialect

    <dependency>
                    <groupId>com.github.gwenn</groupId>
                    <artifactId>sqlite-dialect</artifactId>
                    <version>master</version>
                </dependency>

Do exist a better dialect for hibernate5 that close the connection after findAll? Or Some configuration in the xml? The configurations are:

<bean id="emf"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan" value="com.accenture.moparva.datalayer.models" />
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
        </property>
        <property name="jpaProperties">
            <props>

                <prop key="hibernate.dialect">${jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
                <prop key="hibernate.connection.release_mode">auto</prop>
                <prop key="hibernate.transaction.auto_close_session">false</prop>
                <prop key="maxActive">1</prop>

            </props>
        </property>

    </bean>

The error is:

GRAVE: Servlet.service() for servlet [spring] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: error performing isolated work; nested exception is org.hibernate.exception.GenericJDBCException: error performing isolated work] with root cause
java.sql.SQLException: database is locked
        at org.sqlite.core.DB.throwex(DB.java:859)
        at org.sqlite.core.DB.exec(DB.java:142)
        at org.sqlite.jdbc3.JDBC3Connection.commit(JDBC3Connection.java:165)
        at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.d
1

0

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.