I was facing this issue when I started
implementing my first hibernate application. I have tried to find the solution
over the technical forums. But I could not really get the answer which has fixed the
issue. So I am posting the solution which would help you too. Reason: hibernate.cfg.xml does not
have the resource mapping where the entity mapping is done.
Resolution: Add the mapping file name (where
entity mapping is done) to the hibernate.cfg.xml .Highlighted in red color below.
<session-factory>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/HibDB</property>
<property name="connection.username">root</property>
<property name="connection.password">pass123</property>
<mapping resource="com\sabhahit\mapping\Student.hbm.xml"/>
</session-factory>
<property name="connection.url">jdbc:mysql://localhost:3306/HibDB</property>
<property name="connection.password">pass123</property>
</session-factory>
hey where should we save hibernate.cfg.xml inside package or src folder only
ReplyDeletehey where should we save hibernate.cfg.xml inside package or src folder only
ReplyDelete