J2EE development based on Spring + Session Bean + Hibernate

zhaozj2021-02-16  59

The way I used to use Spring Hibernate. Recently, as the application system increases, the system is required to be called each other, so it is determined to join the session bean. 1, EJB class first inherited

org.springframework.ejb.support.AbstractStatelessSessionBean, use of such may simplify some operations can only achieve onEjbCreate: protected void onEjbCreate () throws CreateException {userDao = (UserDAO) getDao (ServicesConstants.CONTEXT_USERDAO, UserDAO.class);} In addition, Env-Entry is added to EJBJAR.XML, and the corresponding xdoclet tag is shown below:

@ ejb.env-entry name = "EJB / BeanFactoryPath" type = "java.lang.string" value = "/ usermanager-ejb.xml" 2, the content file content corresponding to EJB in Spring is as follows: java: jdbc / **** < / Property> com / vrgrid / user / pojos / userdata.hbm.xml *** net.sf.hibernate.diaalect.raclediaAlaforct false false 3, in order to simplify the client's call, as follows the client's configuration file:

vrgrid / UserManagerLocal com.vrgrid.user.module.userManager This is only necessary to use the following statement Yes: UserManager usermgr = (userManager) Beanfactory.getBean ("UserManager"); It can be seen that using the Spring framework can save us a lot of development time, and it is also very convenient to maintain. This thing is really good.

转载请注明原文地址:https://www.9cbs.com/read-17278.html

New Post(0)