Help configuring Hibernate,Jpa, Stripesist on Stripes

南笙酒味 提交于 2019-12-13 17:18:12

问题


I need some help configuring JPA Stripersist and Hibernate on a Stripes project I have the Stripersist.jar and JPA.jar, the book i have is not that clear about how to get the "correct" Hibernate jars(i just found so many on the hibernate website), and where to place them(i suppose the classpath). Has some of you managed to configure Stripes and Hibernate,jpa,Stripersist successfully?

Thank you, unfortunately Stripes community is not that big and i cant find any useful info


回答1:


Stripes is a web framework that is totally unaware of the persistence technology. So you might want to start with configuring Stripes first and make sure Stripes is configured correctly and serves you a hello world action:

http://www.stripesframework.org/display/stripes/Quick+Start+Guide

After that you might want to add the striperst.jar to your project. The Stripersist stuff will be picked-up automatically if you add the configuration below to your web.xml and no further configuration is needed for making sure Hibernate will be started when you Stripes web application starts:

<filter>
  <display-name>Stripes Filter</display-name>
  <filter-name>StripesFilter</filter-name>
  <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
  <init-param>
    <param-name>Extension.Packages</param-name>
    <param-value>
      org.stripesstuff.stripersist
    </param-value>
  </init-param>
</filter>

You of course will also have to install all Hibernate jars (note that you will need much more than just the hibernate3.jar, you also need to add all hibernate jars in the /lib/required directory and you also might also want to use a connection pool like c3po).

And most importantly you will need to provide a persistence.xml that configures Hibernate. This configuration is totally unrelated to Stripes/Stripersist, you can use any Hibernate quick start guide you can find on the Net. An excellent starting point is the Redhat documentation:

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-xmlconfig

After that you can use the Stripersist.



来源:https://stackoverflow.com/questions/5740573/help-configuring-hibernate-jpa-stripesist-on-stripes

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