AlexBrand
AlexBrand

Reputation: 12429

cannot resolve class 'jdbc' - Hibernate

I am just starting out with Hibernate and I have been trying to wire it up with H2.

My hibernate.cfg.xml file looks like this:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="connection.url">org.h2.Driver</property>
        <property name="connection.driver_class">jdbc:h2:mem:test</property>
        <property name="connection.username">sa</property>
        <property name="connection.password"/>
        <!-- DB schema will be updated if needed -->
        <!-- <property name="hbm2ddl.auto">update</property> -->

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
    </session-factory>
</hibernate-configuration>

I am getting an error that says: Cannot resolve class 'jdbc'. I installed H2 with Maven.

Upvotes: 0

Views: 1371

Answers (1)

Daniel Williams
Daniel Williams

Reputation: 8885

I believe you might want to use '.' instead of ':' in your class name.

See http://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/session-configuration.html

Or it also looks like you have the driver class and the connection url properties swapped.

Upvotes: 2

Related Questions