How to use Hibernate with JSF

烈酒焚心 提交于 2019-12-11 07:47:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!