質問

I am thinking of developing a new JSF application and have decided to go with managed beans and util classes to handle business logic.

For database integration and handling persistence should i stick to JPA API or use the Hibernate specific one? Which one is better among two.

My application is a mid size application.

正しい解決策はありません

他のヒント

You are thinking good way to developing your your JSF Application.

You should go through the JPA. Beacause JPA is good for database integration and easy to handle. It is far better.

Create the HibernateUtil call and provide you persistence init name.

Ex:

public class HibernateUtil {

    private static final EntityManagerFactory entityManagerFactory;
    static {
                try {
                     entityManagerFactory = Persistence.createEntityManagerFactory("**PersistenceUnitName**");
                     System.out.println("Entity Menager Test.............."+ entityManagerFactory);
                } catch (Throwable ex) {

                    System.err.println("Initial SessionFactory creation failed." + ex);
                    throw new ExceptionInInitializerError(ex);

                  }
    }

public static EntityManagerFactory getEntityManagerFactory() {
         return entityManagerFactory;
    }

}

Persistence unit name is should match to with Persistence.xml file and then crete the Entity classes, DAO and services.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top