01: package samples.ejb;
02:
03: import javax.ejb.*;
04:
05: public class NiceThingsBeanEJB implements SessionBean {
06:
07: public void ejbCreate() {
08: }
09:
10: public void ejbActivate() {
11: }
12:
13: public void ejbPassivate() {
14: }
15:
16: public void ejbRemove() {
17: }
18:
19: public void setSessionContext(SessionContext sc) {
20: }
21:
22: // "Business" Methods:
23: public String sayHello(String name) {
24: return ("Hiya " + name + ", how are you?");
25:
26: }
27:
28: public NiceThings findNiceThingsFor(String name) {
29: // In reality our bean would probably be looking up these nice
30: // things from an entity bean. In our case we'll just cheat :)
31:
32: NiceThings niceThings = new NiceThings("cake", 23,
33: "black as night");
34: return niceThings;
35: }
36:
37: public boolean updateNiceThingsFor(String name,
38: NiceThings niceThings) {
39: // In reality this bean would probably try and update nice things
40: // in the relevant entity bean(s) and return a boolean to indicate
41: // whether the update was successful or not. Again, we'll cheat.
42: return true;
43: }
44:
45: }
|