Kat
Kat

Reputation: 666

Call an ejb entity class from an independent web application (netbeans)

I'm making a small webshop application for school in Netbeans. I have a Customer entity class in an EJB module together with a local session bean and a remote session bean.

Next I have an independent web application, which can of course call the remote session bean.

From the application I can call a method in the remote session bean to give me all customers. But what should the session bean return?

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. 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.

Thanks!

Upvotes: 3

Views: 1362

Answers (1)

john miran
john miran

Reputation: 393

You must create a client project contain all your entities and interfaces, and use this project in the EJB module and web project.

In this case you can return a list of customer to the web project by using the remote interface

Of course, you must deploy the ejb project + the client project in an ear project.

Upvotes: 1

Related Questions