0

I need to access a SQLite database with java. i get this error:

Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.SQLiteDialect] as strategy [org.hibernate.dialect.Dialect]

whenever i want to create my sessionFactory bean.

database properties:

db.driver.class=org.sqlite.JDBC
db.server.url=jdbc:sqlite:"G:\\Ausbildung\\username\\Database\\informations.db"
db.username=
db.password=

db.hibernate.dialect=org.hibernate.dialect.SQLiteDialect
db.hibernate.schema=DATA
db.hibernate.hbm2ddl.auto=update

bean declaration in xml file:

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
        lazy-init="true">
        <property name="driverClassName">
            <value>${db.driver.class}</value>
        </property>
        <property name="url">
            <value>${db.server.url}</value>
        </property>
        <property name="username">
            <value>${db.username}</value>
        </property>
        <property name="password">
            <value>${db.password}</value>
        </property>
    </bean>
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
        lazy-init="true">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan">
            <list>
                <value>com.mainfirst.bloomberg.invoice.report.model</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${db.hibernate.dialect}</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.default_schema">${db.hibernate.schema}</prop>
                <prop key="hibernate.hbm2ddl.auto">${db.hibernate.hbm2ddl.auto}</prop>
                <prop key="hibernate.connection.CharSet">utf8</prop>
                <prop key="hibernate.connection.characterEncoding">utf8</prop>
                <prop key="hibernate.connection.useUnicode">true</prop>
            </props>
        </property>
    </bean>

I can't find the mistake i made. this construct worked with Apache Derby. I only changed the hibernate.dialect and the driver.class as well as server.url.

if i remove the "" in the db.server.url i get the error

Caused by: java.lang.AbstractMethodError: org.sqlite.Conn.isValid(I)Z

Thanks in advance

1
  • fixed the java.lang.AbstractMethodError by taking newer version of jdbc driver. now only the dialect error exists Commented Nov 24, 2016 at 10:19

1 Answer 1

1

fixed the problem with taking this SQLite dialect for hibernate:

<groupId>com.enigmabridge</groupId>
<artifactId>hibernate4-sqlite-dialect </artifactId>
<version>0.1.0</version>
Sign up to request clarification or add additional context in comments.

Comments

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.