001: /**
002: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017: * USA
018: *
019: * Component of: Red Hat Application Server
020: *
021: * Initial Developers: Aizaz Ahmed
022: * Vivek Lakshmanan
023: * Andrew Overholt
024: * Matthew Wringe
025: */package olstore.entity;
026:
027: import javax.ejb.EntityBean;
028:
029: import olstore.entity.UserLocal;
030:
031: /**
032: * @ejb.bean name="Friend"
033: * description="This bean is used as an alias to User to work around the inability to define a many-many self-referencing relationship."
034: * type="CMP"
035: * schema="olstore_friend"
036: * primkey-field="id"
037: * reentrant="false"
038: * cmp-version="2.x"
039: * view-type="local"
040: * local-jndi-name="FriendLocal_L"
041: *
042: * @ejb.transaction
043: * type="Required"
044: *
045: *
046: * --
047: * This is needed for JOnAS.
048: * If you are not using JOnAS you can safely remove the tags below.
049: * @jonas.bean ejb-name="Friend"
050: * jndi-name="FriendLocal"
051: * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_friend"
052: * automatic-pk="true"
053: * --
054: *
055: * @ejb.persistence
056: *
057: *--
058: * This is needed for JOnAS.
059: * If you are not using JOnAS you can safely remove the tags below.
060: * @jonas.finder-method-jdbc-mapping method-name="findAll"
061: * jdbc-where-clause=""
062: * @jonas.jdbc-mapping jndi-name="jdbc_1"
063: * jdbc-table-name="olstore_friend"
064: *
065: *--
066: *
067: **/
068:
069: public abstract class FriendBean implements EntityBean {
070:
071: /**
072: * The ejbCreate method.
073: *
074: * @ejb.create-method
075: */
076: public java.lang.String ejbCreate(UserLocal user)
077: throws javax.ejb.CreateException {
078: return null;
079: }
080:
081: /**
082: * The container invokes this method immediately after it calls ejbCreate.
083: *
084: */
085: public void ejbPostCreate(UserLocal user)
086: throws javax.ejb.CreateException {
087: setUser(user);
088: }
089:
090: /**
091: * Returns user.
092: *
093: * @return user
094: *
095: * @ejb.relation
096: * name="Friend-User"
097: * role-name="Friend-is-an-alias-of-User"
098: * target-ejb="User"
099: * target-multiple="yes"
100: *
101: * @ejb.relation
102: * name="User-Friend"
103: * role-name="Friends-are-Users"
104: * target-ejb="User"
105: * target-multiple="yes"
106: *
107: * @ejb.interface-method
108: *
109: */
110:
111: public abstract UserLocal getUser();
112:
113: /**
114: *
115: * @param User
116: *
117: * @ejb.interface-method
118: *
119: */
120:
121: public abstract void setUser(UserLocal User);
122:
123: /**
124: * Returns the friend id
125: * @return the friend id
126: *
127: * @ejb.persistent-field
128: * @ejb.persistence
129: * column-name="id"
130: * sql-type="INTEGER"
131: * @ejb.pk-field
132: * @ejb.interface-method
133: *
134: */
135: public abstract java.lang.Integer getId();
136:
137: /**
138: * Sets the friend id
139: *
140: * @param java.lang.Integer the new friend id value
141: *
142: * @ejb.interface-method
143: */
144: public abstract void setId(java.lang.Integer friendId);
145:
146: }
|