I am completely new in Hibernate and got such an stacktrace:
hql> from TracksEntity
[2014-04-26 21:13:45] org.hibernate.MappingException: Unable to load clas
My mistake was a camel case problem. I had an embedded entity "IndexPK" and wrote "IndexPk" in the mapping file. I compared it ~20 times.... till I figured this out.
I had a similar problem when the mapping file wouldn´t load correctly. The answer to this problem seems to be that we need to use the correct import statements in our Model classes.
Changing the import to import javax.persistence.Entity
instead of using the one from hibernate package ( ie org.hibernate.annotations.Entity
), fixed the issue in my case.
This issue is a real pain , and I spent more than 1/2 day looking at all corners, when a simple import fixed the issue.
Hope this helps.
Sounds quite silly but i was putting my entity Class in a package which is not the same i put in the mapping.. and hibernate of course could not find it... just for reference.. maybe a recheck can solve your problem best regards.
I was having the same issue, After adding this dependency it's resolved.
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
write in this pattern
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/dairy
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.current_session_context_class">thread</property>
<!-- MAPPING -->
<!-- <mapping class="com.om.model.Test" /> -->
<mapping class="com.om.model.RateCalculationBean" />
</session-factory>
and also no need to mention scema
To resolve this issue add maven spring-boot dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>