远程EJB返回类型 [英] Remote EJB return type

查看:59
本文介绍了远程EJB返回类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想返回我创建的一个名为User的类的实例。我应该在哪里放置此类,以便我的EJB在调用方法时可以将其返回?
我的意思是,我应该只将其放在接口项目中,还是在ejb模块中以及在war模块中?

I want to return an instance of a class I created, named User. Where should I put this class, so that my EJB can return it when I call a method? I mean, should I put it only in the interface project, or in the ejb module and in the war module?

谢谢

推荐答案

如果要使用具体的实现,则应该在EJB文件夹和war项目中都有一个自定义对象的副本。不过,您可能在.war中有一个接口,该接口由EJB模块方法返回,并且EJB nethod调用将返回该接口的具体实例。在这种情况下,您通过其接口引用具体实现。如果您的EJB和战争在不同的机器上,则应将自定义类设置为 Serializable

You should have a copy of your custom object in both EJB folder, and in your war project, if you want to use concrete implementation. Nevertheless, you might have an interface in your .war, which EJB module method returns, and EJB nethod call would return a concrete instance of that interface. In this case you refer to concrete implementation by its interface. In case your EJB and war are on different machines, you should make your custom class Serializable.

这篇关于远程EJB返回类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆