KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > entity > FriendBean


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  * FriendBean.java
29  *
30  * Created on Aug 16, 2004
31  *
32  */

33 package olstore.entity;
34
35 import javax.ejb.EntityBean;
36
37 import olstore.entity.UserLocal;
38
39 /**
40  * @ejb.bean name="Friend"
41  * description="This bean is used as an alias to User to work around the inability to define a many-many self-referencing relationship."
42  * type="CMP"
43  * schema="olstore_friend"
44  * primkey-field="id"
45  * reentrant="false"
46  * cmp-version="2.x"
47  * view-type="local"
48  * local-jndi-name="FriendLocal_L"
49  *
50  * @ejb.transaction
51  * type="Required"
52  *
53  *
54  * --
55  * This is needed for JOnAS.
56  * If you are not using JOnAS you can safely remove the tags below.
57  * @jonas.bean ejb-name="Friend"
58  * jndi-name="FriendLocal"
59  * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_friend"
60  * automatic-pk="true"
61  * --
62  *
63  * @ejb.persistence
64  *
65  *--
66  * This is needed for JOnAS.
67  * If you are not using JOnAS you can safely remove the tags below.
68  * @jonas.finder-method-jdbc-mapping method-name="findAll"
69  * jdbc-where-clause=""
70  * @jonas.jdbc-mapping jndi-name="jdbc_1"
71  * jdbc-table-name="olstore_friend"
72  *
73  *--
74  *
75  **/

76
77 public abstract class FriendBean implements EntityBean {
78     
79     /**
80      * The ejbCreate method.
81      *
82      * @ejb.create-method
83      */

84     public java.lang.String ejbCreate(UserLocal user)
85     throws javax.ejb.CreateException {
86         return null;
87     }
88     
89     /**
90      * The container invokes this method immediately after it calls ejbCreate.
91      *
92      */

93     public void ejbPostCreate(UserLocal user) throws javax.ejb.CreateException {
94         setUser (user);
95     }
96     
97     /**
98      * Returns user.
99      *
100      * @return user
101      *
102      * @ejb.relation
103      * name="Friend-User"
104      * role-name="Friend-is-an-alias-of-User"
105      * target-ejb="User"
106      * target-multiple="yes"
107      *
108      * @ejb.relation
109      * name="User-Friend"
110      * role-name="Friends-are-Users"
111      * target-ejb="User"
112      * target-multiple="yes"
113      *
114      * @ejb.interface-method
115      *
116      */

117     
118     public abstract UserLocal getUser ();
119     
120     /**
121      *
122      * @param User
123      *
124      * @ejb.interface-method
125      *
126      */

127     
128     public abstract void setUser (UserLocal User);
129     
130     /**
131      * Returns the friend id
132      * @return the friend id
133      *
134      * @ejb.persistent-field
135      * @ejb.persistence
136      * column-name="id"
137      * sql-type="INTEGER"
138      * @ejb.pk-field
139      * @ejb.interface-method
140      *
141      */

142     public abstract java.lang.Integer getId();
143     
144     /**
145      * Sets the friend id
146      *
147      * @param java.lang.Integer the new friend id value
148      *
149      * @ejb.interface-method
150      */

151     public abstract void setId(java.lang.Integer friendId);
152     
153     
154     
155 }
156
Popular Tags