package jp.co.okisoft.hibernate.hello;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class Main {

    public static void main(String[] args) {
        Configuration cfg = new Configuration().configure();
        SessionFactory factory = cfg.buildSessionFactory();

        Session session = factory.openSession();
        Transaction tx = session.beginTransaction();

        // Messageインスタンスの生成
        Message msg = new Message("Hello World");

        // Messageインスタンスの永続化
        session.save(msg);

        tx.commit();
        session.close();
    }
}
