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.cmrstress.ejb;
023:
024: import javax.ejb.EntityBean;
025: import javax.ejb.EntityContext;
026: import javax.ejb.RemoveException;
027:
028: import org.apache.log4j.Logger;
029:
030: /**
031: * The problem child.
032: *
033: * This code is based upon the original test case provided by Andrew May.
034: *
035: * @version <tt>$Revision: 57211 $</tt>
036: * @author <a href="mailto:steve@resolvesw.com">Steve Coy</a>.
037: *
038: * @ejb.bean name="Child"
039: * type="CMP"
040: * cmp-version="2.x"
041: * view-type="local"
042: * jndi-name="cmrstress/Child"
043: * primkey-field="id"
044: * schema="Child"
045: *
046: * @ejb.pk class="java.lang.String"
047: * generate="false"
048: *
049: * @ejb.persistence table-name="StressedChild"
050: *
051: * @ejb.home generate="both"
052: * @ejb.interface generate="local"
053: *
054: * @ejb.transaction type="Supports"
055: *
056: * @jboss.persistence
057: * create-table="true"
058: * remove-table="true"
059: * @jboss.tuned-updates tune="true"
060: */
061: public abstract class ChildBean implements EntityBean {
062: /**
063: * CMP get method for Id attribute.
064: * @ejb.interface-method view-type="local"
065: * @ejb.persistent-field
066: * @jboss.column-name name="id"
067: * jboss.method-attributes read-only="true"
068: */
069: public abstract String getId();
070:
071: /**
072: * CMP set method for Id attribute.
073: * @ejb.interface-method view-type="local"
074: * @ejb.transaction type="Mandatory"
075: */
076: public abstract void setId(String id);
077:
078: /**
079: * CMP get method for Name attribute.
080: * @ejb.interface-method view-type="local"
081: * @ejb.persistent-field
082: * @jboss.column-name name="name"
083: * jboss.method-attributes read-only="true"
084: */
085: public abstract String getName();
086:
087: /**
088: * CMP set method for Name attribute.
089: * @ejb.interface-method view-type="local"
090: * @ejb.transaction type="Mandatory"
091: */
092: public abstract void setName(String name);
093:
094: /**
095: * CMP get method for Value attribute.
096: * @ejb.interface-method view-type="local"
097: * @ejb.persistent-field
098: * @jboss.column-name name="value"
099: * jboss.method-attributes read-only="true"
100: */
101: public abstract String getValue();
102:
103: /**
104: * CMP set method for Value attribute.
105: * @ejb.interface-method view-type="local"
106: * @ejb.transaction type="Mandatory"
107: */
108: public abstract void setValue(String value);
109:
110: /**
111: * Create method for Entity.
112: * @ejb.create-method view-type="local"
113: * @ejb.transaction type="Mandatory"
114: */
115: public String ejbCreate(String id, String name, String value)
116: throws javax.ejb.CreateException {
117: msLog.debug("Created with pk: " + id);
118: setId(id);
119: setName(name);
120: setValue(value);
121: return null;
122: }
123:
124: public void ejbPostCreate(String id, String name, String value) {
125: }
126:
127: /**
128: * @see javax.ejb.EntityBean#ejbActivate()
129: */
130: public void ejbActivate() {
131: }
132:
133: /**
134: * @see javax.ejb.EntityBean#ejbLoad()
135: */
136: public void ejbLoad() {
137: }
138:
139: /**
140: * @see javax.ejb.EntityBean#ejbPassivate()
141: */
142: public void ejbPassivate() {
143: }
144:
145: /**
146: * @see javax.ejb.EntityBean#ejbRemove()
147: */
148: public void ejbRemove() throws RemoveException {
149: }
150:
151: /**
152: * @see javax.ejb.EntityBean#ejbStore()
153: */
154: public void ejbStore() {
155: }
156:
157: /**
158: * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
159: */
160: public void setEntityContext(EntityContext arg0) {
161: }
162:
163: /**
164: * @see javax.ejb.EntityBean#unsetEntityContext()
165: */
166: public void unsetEntityContext() {
167: }
168:
169: private static final Logger msLog = Logger
170: .getLogger(ChildBean.class);
171:
172: }
|