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 name="A"
034: * type="CMP"
035: * cmp-version="2.x"
036: * view-type="local"
037: * reentrant="false"
038: * @ejb.pk generate="true"
039: * @ejb.util generate="physical"
040: * @ejb.persistence table-name="CMRTREEA"
041: * @jboss.persistence
042: * create-table="true"
043: * remove-table="true"
044: * @ejb:transaction type="Required"
045: * @ jboss.container-configuration name="custom container"
046: *
047: * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
048: * @version <tt>$Revision: 57211 $</tt>
049: */
050: public abstract class ABean implements EntityBean {
051: // Attributes -----------------------------------------------
052: Category log = Category.getInstance(ABean.class);
053: private EntityContext ctx;
054:
055: // CMP accessors --------------------------------------------
056: /**
057: * @ejb.pk-field
058: * @ejb.persistent-field
059: * @ejb.interface-method
060: */
061: public abstract int getMajorId();
062:
063: public abstract void setMajorId(int id);
064:
065: /**
066: * @ejb.pk-field
067: * @ejb.persistent-field
068: * @ejb.interface-method
069: */
070: public abstract String getMinorId();
071:
072: public abstract void setMinorId(String id);
073:
074: /**
075: * @ejb.interface-method
076: * @ejb.persistent-field
077: */
078: public abstract String getName();
079:
080: /**
081: * @ejb.interface-method
082: */
083: public abstract void setName(String name);
084:
085: /**
086: * @ejb.interface-method
087: * @ejb.relation name="A-B"
088: * role-name="A-has-B"
089: */
090: public abstract Collection getB();
091:
092: /**
093: * @ejb.interface-method
094: */
095: public abstract void setB(Collection c);
096:
097: /**
098: * @throws javax.ejb.CreateException
099: * @ejb.create-method
100: */
101: public APK ejbCreate(int id, String id2, String name)
102: throws CreateException {
103: setMajorId(id);
104: setMinorId(id2);
105: setName(name);
106: return null;
107: }
108:
109: public void ejbPostCreate(int id, String id2, String name) {
110: }
111:
112: /**
113: * @param ctx The new entityContext value
114: */
115: public void setEntityContext(EntityContext ctx) {
116: this .ctx = ctx;
117: }
118:
119: /**
120: * Unset the associated entity context.
121: */
122: public void unsetEntityContext() {
123: this .ctx = null;
124: }
125:
126: public void ejbActivate() {
127: }
128:
129: public void ejbLoad() {
130: }
131:
132: public void ejbPassivate() {
133: }
134:
135: public void ejbRemove() throws RemoveException {
136: }
137:
138: public void ejbStore() {
139: }
140: }
|