KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > entity > PropertyBean


1 /**
2  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  *
19  * Component of: Red Hat Application Server
20  *
21  * Initial Developers: Aizaz Ahmed
22  * Vivek Lakshmanan
23  * Andrew Overholt
24  * Matthew Wringe
25  *
26  */

27
28 /*
29  * PropertyBean.java
30  *
31  * Created on Aug 13, 2004
32  *
33  */

34 package olstore.entity;
35
36 import javax.ejb.EntityBean;
37
38 /**
39  * @ejb.bean name="Property"
40  * description="This bean is used to store extra information about items."
41  * type="CMP"
42  * schema="olstore_properties"
43  * reentrant="false"
44  * cmp-version="2.x"
45  * view-type="local"
46  * local-jndi-name="PropertyLocal_L"
47  *
48  * @ejb.relation
49  * name="Item-Property"
50  * role-name="Property-belongs-to-Item"
51  * cascade-delete="yes"
52  * target-ejb="Item"
53  * target-multiple="yes"
54  *
55  * @ejb.relation
56  * name="Type-Property"
57  * role-name="Property-belongs-to-Type"
58  * cascade-delete="yes"
59  * target-ejb="Type"
60  * target-multiple="yes"
61  *
62  * @ejb.transaction
63  * type="Required"
64  *
65  * @ejb:pk
66  * class="java.lang.Object"
67  * generate="false"
68  *
69  * --
70  * This is needed for JOnAS.
71  * If you are not using JOnAS you can safely remove the tags below.
72  * @jonas.bean ejb-name="Property"
73  * jndi-name="PropertyLocal"
74  * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_properties"
75  * --
76  *
77  * @ejb.persistence
78  *
79  * @ejb.finder
80  * query="SELECT OBJECT(a) FROM olstore_properties as a"
81  * signature="java.util.Collection findAll()"
82  *
83  * @ejb.finder
84  * query="SELECT OBJECT(a) FROM olstore_properties as a WHERE a.name = ?1"
85  * signature="java.util.Collection findByName(java.lang.String name)"
86  *
87  *--
88  * This is needed for JOnAS.
89  * If you are not using JOnAS you can safely remove the tags below.
90  * @jonas.finder-method-jdbc-mapping method-name="findAll"
91  * jdbc-where-clause=""
92  * @jonas.jdbc-mapping jndi-name="jdbc_1"
93  * jdbc-table-name="olstore_properties"
94  *
95  *--
96  *
97  **/

98
99 public abstract class PropertyBean implements EntityBean {
100     
101     /**
102      * The ejbCreate method.
103      *
104      * @ejb.create-method
105      */

106     public java.lang.String ejbCreate(String name, String value)
107     throws javax.ejb.CreateException {
108         setName(name);
109         setValue(value);
110         return null;
111     }
112     
113     /**
114      * The container invokes this method immediately after it calls ejbCreate.
115      *
116      */

117     public void ejbPostCreate(String name, String value) throws javax.ejb.CreateException {
118     }
119     
120     /**
121      * Returns the name
122      * @return the name
123      *
124      * @ejb.persistent-field
125      * @ejb.persistence
126      * column-name="name"
127      * sql-type="VARCHAR"
128      *
129      * @ejb.interface-method
130      *
131      */

132     public abstract java.lang.String getName();
133     
134     /**
135      * Sets the name
136      *
137      * @param java.lang.String the new name value
138      *
139      * @ejb.interface-method
140      */

141     public abstract void setName(java.lang.String name);
142     
143     /**
144      * Returns the value
145      * @return the value
146      *
147      * @ejb.persistent-field
148      * @ejb.persistence
149      * column-name="value"
150      * sql-type="VARCHAR"
151      *
152      * @ejb.interface-method
153      *
154      */

155     public abstract java.lang.String getValue();
156     
157     /**
158      * Sets the value
159      *
160      * @param java.lang.String the new value
161      *
162      * @ejb.interface-method
163      */

164     public abstract void setValue(java.lang.String value);
165     
166 }
167
Popular Tags