0

Hi I am new to hibernate when run the following code it shows mapping exception how can correct couuld any one guide me
may main class

    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 file

<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"/>

</session-factory>

Thanks in advance

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by anand01
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.