This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

More then one ejb Impl in EJB 3, possible?  RSS feed

 
Bess Moore
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all the geniues,
can i get some help in the EJB Please please please

much much appreciated

-------------------------------------------
public interface Customer {
public void addCustomer(Customer cust) throws CustException;
}

@Stateless
@Remote
public class CustomerDefaultImpl implements Customer {
public void addCustomer(Customer cust) throws CustException {
Default rule
}
}


@Stateless
@Remote
public class CustomerCompanyAImpl implements Customer {
public void addCustomer(Customer cust) throws CustException {
Customised rule
}
}

Would these scenarios be possible?
If I need to use the different Impl ejb in different circumstances, how can I use it? at the moment I am using the dependency @EJB private Customer cust, but how can I tell the system which one to use?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the beanName attribute of @EJB. Assuming the bean name is the same as the bean implementation class name then the example that you provided would look like:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!