KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ejb > FileBean


1 package test.ejb;
2
3 import java.util.Date JavaDoc;
4 import javax.ejb.CreateException JavaDoc;
5 import javax.ejb.EntityBean JavaDoc;
6 import javax.ejb.EntityContext JavaDoc;
7 import javax.ejb.RemoveException JavaDoc;
8
9 /**
10  * @author <a HREF="mailto:julien_viet@yahoo.fr">Julien Viet</a>
11  * @version $Revision: 1.1 $
12  *
13  * @ejb.bean
14  * name="File"
15  * displayContent-name="File"
16  * type="CMP"
17  * cmp-version="2.x"
18  * view-type="local"
19  * local-jndi-name="${ejb.prefix}/File"
20  * schema="file"
21  * primkey-field="id"
22  *
23  * @ejb.pk
24  * class="java.lang.String"
25  *
26  * @ejb.transaction
27  * type="Required"
28  *
29  * @ejb.finder
30  * signature="test.ejb.FileBeanLocal findByPrimaryKey(java.lang.String id)"
31  *
32  * @ejb.finder
33  * signature="java.util.Collection findAll()"
34  * query="SELECT OBJECT(f) FROM file AS f"
35  *
36  * @ejb.finder
37  * signature="java.util.Collection findRangeOrderById(java.lang.Integer start, java.lang.Integer size)"
38  * query="SELECT OBJECT(f) FROM file AS f"
39  *
40  * @ejb.finder
41  * signature="java.util.Collection findRangeOrderByCreationDate(java.lang.Integer start, java.lang.Integer size)"
42  * query="SELECT OBJECT(f) FROM file AS f"
43  *
44  * @ejb.finder
45  * signature="java.util.Collection findRangeOrderByContentType(java.lang.Integer start, java.lang.Integer size)"
46  * query="SELECT OBJECT(f) FROM file AS f"
47  *
48  * @jboss.query
49  * signature="java.util.Collection findRangeOrderById(java.lang.Integer start, java.lang.Integer size)"
50  * query="SELECT OBJECT(f) FROM file AS f ORDER BY f.id OFFSET ?1 LIMIT ?2"
51  *
52  * @jboss.query
53  * signature="java.util.Collection findRangeOrderByCreationDate(java.lang.Integer start, java.lang.Integer size)"
54  * query="SELECT OBJECT(f) FROM file AS f ORDER BY f.creationDate OFFSET ?1 LIMIT ?2"
55  *
56  * @jboss.query
57  * signature="java.util.Collection findRangeOrderByContentType(java.lang.Integer start, java.lang.Integer size)"
58  * query="SELECT OBJECT(f) FROM file AS f ORDER BY f.contentType OFFSET ?1 LIMIT ?2"
59  *
60  * @jboss.persistence
61  * create-table="true"
62  * remove-table="true"
63  *
64  * @jboss.read-ahead
65  * strategy="on-load"
66  * page-size="10"
67  * eager-load-group="lightweight"
68  *
69  * @jboss.eager-load-group
70  * name="lightweight"
71  *
72  * @jboss.lazy-load-group
73  * name="heavyweight"
74  *
75  * @jboss.load-group
76  * name="lightweight"
77  *
78  * @jboss.load-group
79  * name="heavyweight"
80  *
81  */

82 public abstract class FileBean
83    implements EntityBean JavaDoc
84 {
85
86    /**
87     * @ejb.create-method
88     */

89    public String JavaDoc ejbCreate(String JavaDoc id, String JavaDoc contentType, byte[] content)
90    throws CreateException JavaDoc
91    {
92       setId(id);
93       setContentType(contentType);
94       setContent(content);
95       setCreationDate(new Date JavaDoc());
96       return null;
97    }
98
99    public void ejbPostCreate(String JavaDoc id, int uid, String JavaDoc contentType, byte[] content)
100    {
101    }
102
103    /**
104     * @ejb.interface-method
105     * @ejb.persistent-field
106     * @ejb.pk-field
107     * @jboss.load-group
108     * name="lightweight"
109     * @jboss.load-group
110     * name="heavyweight"
111     */

112    public abstract String JavaDoc getId();
113
114    /**
115     * @ejb.interface-method
116     */

117    public abstract void setId(String JavaDoc id);
118
119    /**
120     * @ejb.interface-method
121     * @ejb.persistence
122     * @jboss.load-group
123     * name="heavyweight"
124     */

125    public abstract byte[] getContent();
126
127    /**
128     * @ejb.interface-method
129     */

130    public abstract void setContent(byte[] content);
131
132    /**
133     * @ejb.interface-method
134     * @ejb.persistence
135     * @jboss.load-group
136     * name="lightweight"
137     * @jboss.load-group
138     * name="heavyweight"
139     */

140    public abstract String JavaDoc getContentType();
141
142    /**
143     * @ejb.interface-method
144     */

145    public abstract void setContentType(String JavaDoc contentType);
146
147    /**
148     * @ejb.interface-method
149     * @ejb.persistence
150     * @jboss.load-group
151     * name="lightweight"
152     * @jboss.load-group
153     * name="heavyweight"
154     */

155    public abstract java.util.Date JavaDoc getCreationDate();
156
157    /**
158     * @ejb.interface-method
159     */

160    public abstract void setCreationDate(java.util.Date JavaDoc creationDate);
161
162    public void ejbActivate() { }
163    public void ejbPassivate() { }
164    public void ejbRemove() throws RemoveException JavaDoc { }
165    public void setEntityContext(EntityContext JavaDoc entityContext) { }
166    public void unsetEntityContext() { }
167    public void ejbLoad() { }
168    public void ejbStore() { }
169
170 }
171
Popular Tags