[英]Call an ejb entity class from an independent web application (netbeans)
I'm making a small webshop application for school in Netbeans. 我正在为Netbeans的学校制作一个小型网上商店应用程序。 I have a Customer entity class in an EJB module together with a local session bean and a remote session bean. 我在EJB模块中有一个Customer实体类,还有一个本地会话bean和一个远程会话bean。
Next I have an independent web application, which can of course call the remote session bean. 接下来,我有一个独立的Web应用程序,它当然可以调用远程会话Bean。
From the application I can call a method in the remote session bean to give me all customers. 从应用程序中,我可以在远程会话bean中调用一个方法来给我所有客户。 But what should the session bean return? 但是会话bean应该返回什么?
What's the best choice? 最好的选择是什么?
(Oh and I'm using wicket as framework, if that has anything to do with this) (哦,我正在使用检票口作为框架,如果与此有关的话)
EDIT: 编辑:
So my setup is like this : 所以我的设置是这样的:
It's not working though. 虽然没有用。 When I deploy the ear, I get this error: 当我展开耳朵时,出现以下错误:
Error in annotation processing: java.lang.NoClassDefFoundError: shop2/database/customer/CustomerBeanRemote
I'm not sure where to put the persistence file. 我不确定将持久性文件放在何处。 Now it is in the ejb module. 现在它在ejb模块中。 But I don't think this is actually the problem. 但是我不认为这实际上是问题所在。
Can you maybe guide me through how to make the project. 您能否指导我完成该项目。 It is the first time I work with EJB and Java EE. 这是我第一次使用EJB和Java EE。
Thanks! 谢谢!
You must create a client project contain all your entities and interfaces, and use this project in the EJB module and web project. 您必须创建一个包含所有实体和接口的客户端项目,并在EJB模块和Web项目中使用该项目。
In this case you can return a list of customer to the web project by using the remote interface 在这种情况下,您可以使用远程界面将客户列表返回到Web项目
Of course, you must deploy the ejb project + the client project in an ear project. 当然,您必须在耳朵项目中部署ejb项目+客户端项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.