问题
How to configure the jsf mavenized project with hibernate. While googling i found many guides related to this topic with different form of implementations. Please point out to refer a correct guide on this topic. i am just trying to do a simple database operation using hibernate.
回答1:
If you use JPA hibernate all configurations will be similar as described in J2EE tutorial - Accessing Databases from Web Applications + you add your Maven dependencies (hibernate + db driver).
回答2:
If you're using hibernate, not JPA, all you need to do is put your hibernate.cfg.xml file in proj/src/main/resources and call new Configuration() and configuration.buildSessionFactory() in your project. For detailed documentation on the various options refer to the JBoss' documentation for your version here.
来源:https://stackoverflow.com/questions/6844335/how-to-use-hibernate-with-jsf