KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > samples > ejb > NiceThingsBeanEJB


1 package samples.ejb;
2
3 import javax.ejb.*;
4
5 public class NiceThingsBeanEJB implements SessionBean {
6     
7     public void ejbCreate() {}
8
9     public void ejbActivate() {}
10     public void ejbPassivate() {}
11     public void ejbRemove() {}
12     public void setSessionContext(SessionContext sc) {}
13
14     // "Business" Methods:
15
public String JavaDoc sayHello(String JavaDoc name) {
16         return ( "Hiya " + name + ", how are you?");
17
18     }
19
20     public NiceThings findNiceThingsFor(String JavaDoc name) {
21         // In reality our bean would probably be looking up these nice
22
// things from an entity bean. In our case we'll just cheat :)
23

24         NiceThings niceThings = new NiceThings("cake",
25                                                23,
26                                                "black as night");
27         return niceThings;
28     }
29         
30     public boolean updateNiceThingsFor(String JavaDoc name, NiceThings niceThings) {
31         // In reality this bean would probably try and update nice things
32
// in the relevant entity bean(s) and return a boolean to indicate
33
// whether the update was successful or not. Again, we'll cheat.
34
return true;
35     }
36         
37 }
38
Popular Tags