Hi,
I am new to hibernate when run the following code it shows mapping exception how can correct couuld any one guide me. I am using eclipse IDE
may main classCode:
UserDetails userDetails = new UserDetails();
userDetails.setUserId(1);
userDetails.setUserName("Anand");
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(userDetails);
session.getTransaction().commit();
My hibernate.cfg.xml fileCode:
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping class="classes.UserDetails"></mapping>
</session-factory>
Thanks in advance