= Hibernate JPAとは? = J2EE5標準仕様のO/RマッピングのAPIとして、Java Persistence API(JPA)が策定されています。Hibernate JPAはHibernateをこのJPAに対応させたものです。JBoss5からは、EJB3対応を行うために、Hibernate JPAがJPAのコアとして利用されます。 = Tips = Hibernate JPAの利用方法については、他のWebページなりをご覧ください。ここでは、上級者向けのTipsを紹介します。 == 動的にAnnotated Classをロード == JPAで利用できるようにしたエンティティクラスは、通常persistence.xmlから読み込みます。例えば、次のように記述します。 {{{ org.hibernate.ejb.HibernatePersistence example.ejb3.Account example.ejb3.Item .... }}} しかし、これでは動的にクラスを読み込むことができません。動的に読み込みたい場合は、次のようにします。 {{{ Ejb3Configuration configuration = new Ejb3Configuration(); configuration.addAnnotatedClass(Account.class); configuration.addAnnotatedClass(Item.class); ... EntityManager em = configuration.createEntityManagerFactory().createEntityManager(); }}}