001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.cmp2.cmrtree.ejb;
023:
024: import org.apache.log4j.Category;
025:
026: import javax.ejb.EntityBean;
027: import javax.ejb.EntityContext;
028: import javax.ejb.RemoveException;
029: import javax.ejb.CreateException;
030: import java.util.Collection;
031:
032: /**
033: * @ejb.bean
034: * name="B"
035: * type="CMP"
036: * cmp-version="2.x"
037: * view-type="local"
038: * reentrant="false"
039: * @ejb.pk generate="true"
040: * @ejb.util generate="physical"
041: * @ejb.persistence table-name="CMRTREEB"
042: * @jboss.persistence
043: * create-table="true"
044: * remove-table="true"
045: * @ejb:transaction type="Required"
046: * @ jboss.container-configuration name="custom container"
047: *
048: * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
049: * @version <tt>$Revision: 57211 $</tt>
050: */
051: public abstract class BBean implements EntityBean {
052: // Attributes -----------------------------------------------
053: Category log = Category.getInstance(BBean.class);
054: private EntityContext ctx;
055:
056: // CMP accessors --------------------------------------------
057: /**
058: * @ejb.pk-field
059: * @ejb.persistent-field
060: * @ejb.interface-method
061: */
062: public abstract int getMajorId();
063:
064: public abstract void setMajorId(int id);
065:
066: /**
067: * @ejb.pk-field
068: * @ejb.persistent-field
069: * @ejb.interface-method
070: */
071: public abstract String getMinorId();
072:
073: public abstract void setMinorId(String id);
074:
075: /**
076: * @ejb.persistent-field
077: * @ejb.interface-method
078: */
079: public abstract String getName();
080:
081: /**
082: * @ejb.interface-method
083: */
084: public abstract void setName(String id);
085:
086: /**
087: * @ejb.persistent-field
088: * @ejb.interface-method
089: */
090: public abstract String getAMinorId();
091:
092: /**
093: * @ejb.interface-method
094: */
095: public abstract void setAMinorId(String aid);
096:
097: /**
098: * @ejb.persistent-field
099: * @ejb.interface-method
100: */
101: public abstract String getParentBMinorId();
102:
103: /**
104: * @ejb.interface-method
105: */
106: public abstract void setParentBMinorId(String bid);
107:
108: /**
109: * @ejb.interface-method
110: * @ejb.relation name="B-Children"
111: * role-name="B-has-children"
112: */
113: public abstract Collection getChildren();
114:
115: /**
116: * @ejb.interface-method
117: */
118: public abstract void setChildren(Collection c);
119:
120: /**
121: * @ejb.interface-method
122: * @ejb.relation
123: * name="B-Children"
124: * role-name="child-has-Parent"
125: * cascade-delete="true"
126: * @jboss.relation
127: * fk-constraint="false"
128: * related-pk-field="majorId"
129: * fk-column="majorId"
130: * @jboss.relation
131: * fk-constraint="false"
132: * related-pk-field="minorId"
133: * fk-column="parentBMinorId"
134: */
135: public abstract BLocal getParent();
136:
137: /**
138: * @ejb.interface-method
139: */
140: public abstract void setParent(BLocal a);
141:
142: /**
143: * @ejb.interface-method
144: * @ejb.relation
145: * name="A-B"
146: * role-name="B-has-A"
147: * cascade-delete="true"
148: * @jboss.relation
149: * fk-constraint="false"
150: * related-pk-field="majorId"
151: * fk-column="majorId"
152: * @jboss.relation
153: * fk-constraint="false"
154: * related-pk-field="minorId"
155: * fk-column="AMinorId"
156: */
157: public abstract ALocal getA();
158:
159: /**
160: * @ejb.interface-method
161: */
162: public abstract void setA(ALocal a);
163:
164: /**
165: * @ejb.create-method
166: * @throws CreateException
167: */
168: public BPK ejbCreate(int majorId, String minorId, String name)
169: throws CreateException {
170: setMajorId(majorId);
171: setMinorId(minorId);
172: setName(name);
173: return null;
174: }
175:
176: public void ejbPostCreate(int majorId, String minorId, String name) {
177: }
178:
179: /**
180: * @param ctx The new entityContext value
181: */
182: public void setEntityContext(EntityContext ctx) {
183: this .ctx = ctx;
184: }
185:
186: /**
187: * Unset the associated entity context.
188: */
189: public void unsetEntityContext() {
190: this .ctx = null;
191: }
192:
193: public void ejbActivate() {
194: }
195:
196: public void ejbLoad() {
197: }
198:
199: public void ejbPassivate() {
200: }
201:
202: public void ejbRemove() throws RemoveException {
203: }
204:
205: public void ejbStore() {
206: }
207: }
|