import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Environment;

public class PersonDriver {
  public static void main(String[] args) {
    SessionFactory sessionFactory = new AnnotationConfiguration()
        .addAnnotatedClass(Person.class)
        .setProperty("hibernate.dialect""org.hibernate.dialect.MySQLDialect")
        .setProperty("hibernate.connection.url""jdbc:mysql:///test")
        .setProperty("hibernate.connection.driver_class""com.mysql.jdbc.Driver")
        .setProperty("hibernate.connection.url""jdbc:mysql:///test")
        .setProperty("hibernate.connection.username""mysql")
        .setProperty("hibernate.connection.password""")
        .setProperty(Environment.HBM2DDL_AUTO,"update")
        .buildSessionFactory();
    Session sess = sessionFactory.openSession();

    Person p = new Person();
    p.email = "bob@jadn.com";
    p.name = "Bob Herrmann";

    Transaction tx = sess.beginTransaction();
    sess.persist(p);
    tx.commit();
  }
}