Query to delete all rows in a table hibernate

try this:

sessionFactory.getCurrentSession().createQuery("delete from User_Role").executeUpdate();

You can remove all instances of a class, one at a time, using this method. It's slower if you have many records, however, you're not duplicating the literal string for the table name.

public static void removeAllInstances(final Class<?> clazz) {
    SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
    Session session = sessionFactory.getCurrentSession();       
    session.beginTransaction();
    final List<?> instances = session.createCriteria(clazz).list();
    for (Object obj : instances) {
        session.delete(obj);
    }
    session.getTransaction().commit();
}

usage:

removeAllInstances(User_Role.class);