简体   繁体   中英

How to deploy JavaEE 7 / JPA 2.1 Dynamic Web Application to IBM Liberty Profile WITHOUT web.xml

I have a Dynamic Web Application that access a DB2 v10 zOS Database.

I wish to use Hibernate 5 as my JPA 2.1 Provider and access my EntityManager via CDI.

I do not want to use the Spring Framework at all; I also do not wish to have a web.xml file.

How can I configure my persistence context and persistence unit WITHOUT using web.xml when deploying my application to WebSphere Application Server Liberty v9 Beta?

The first result on google for "websphere liberty hibernate" gave me the link to a sample app that uses Liberty with Hibernate.

WASdev Liberty + Hibernate sample

Note that the jpaApp.war DOES use a web.xml, but this can easily be avoided by using the proper @WebServlet annotation and changing the persistence.xml to point to a server-defined datasource instead of a component-defined datasource.

@WebServlet(displayName="JPA Servlet", urlPatterns="/JPAServlet")
public class JPAServlet extends HttpServlet {
    // ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM