Topic: sessionBean调用Hibernate DAO的问题!

  Print this page

1.sessionBean调用Hibernate DAO的问题! Copy to clipboard
Posted by: fmzbj
Posted on: 2004-11-26 09:41

我现在的系统架构是:
Struts的Action调用sessionBean的远程接口
再由sessionBean调用Hibernate DAO(由插件生成的代码,对Hibernate的方法进行全部再封装)

请问你们是把sessionBean与Hibernate放在一个EJB项目中,把Struts等放在web项目中呢?还是把sessionBean放在EJB项目中,把Hibernate和Struts放在Web项目中呢?

我现在是把sessionBean与Hibernate放在一个EJB项目中,把Struts等放在web项目中,可是在调用Hibernate时说找不到hibernate.cfg.xml文件,EJB项目中的目录结构是这样的:

sjrkxtEJB\ejbModule
com.sjrkxt...... //Hibernate DAO类
org............ //EJB的类

hibernate.cfg.xml文件

sjrkxtEJB\ejbModule\META-INF
........ //EJB部署文件

它是放在classes的根目录啊,怎么还是找不到呢?把它放在EJB调用类的目录下、Hibernate DAO目录
下、sjrkxtEJB\ejbModule\META-INF下、sjrkxtEJB下都是不行?

没招了,请各位帮忙!是不是非得像Web项目那样的目录结构(放在JavaSource)它才找得到啊?可是如果放在EJB项目中的话,是不能用JavaSource目录的啊!

2.Re:sessionBean调用Hibernate DAO的问题! [Re: fmzbj] Copy to clipboard
Posted by: didongusa
Posted on: 2004-11-26 12:39

Look, this guy gets troubles. It is the Hibernate's problem.

You can try this, all your hibernate classes are saved in one URL, and make a resource refered by the EJB. Inside the EJB you code JNDI look up the URL and download the class for local use. I don't think this is J2EE project if you play Hibernate.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923