-1

my problem is that I have two ejb in the first I have a class that is called country and the second a class called user. I want to know what is the best way to do this, inmport the first ejb in the second or declare an atribute called idCountry in the user class and I make traiement in the controller of jsf .

2 Answers 2

0

What is the Country class? Is it annotated with @Stateless or @Stateful or is it just a POJO? Without seeing your code it is difficult to provide an exact answer.

If Country has been annotated with @Stateless or @Stateful then it will be managed by the EJB container. You can use the following code to inject Country into User @EJB private Country country;

If Country is just a POJO then you can use private Country country = new Country()

0

no it's an entity , I want to use it in another ejb what is the best way to do this.

@Entity
public class User implements Serializable {
...
Country country;
}

Or

@Entity
public class User implements Serializable {
...
Long idCountry;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.