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.banknew.ejb;
023:
024: import org.jboss.test.banknew.interfaces.CustomerData;
025: import org.jboss.test.banknew.interfaces.CustomerPK;
026: import org.jboss.test.util.ejb.EntitySupport;
027:
028: /**
029: * The Entity bean represents a bank customer
030: *
031: * @author Andreas Schaefer
032: * @version $Revision: 57211 $
033: *
034: * @ejb:bean name="bank/Customer"
035: * display-name="Bank Customer Entity"
036: * type="CMP"
037: * view-type="remote"
038: * jndi-name="ejb/bank/Customer"
039: * schema="Customer"
040: *
041: * @ejb:interface extends="javax.ejb.EJBObject"
042: *
043: * @ejb:home extends="javax.ejb.EJBHome"
044: *
045: * @ejb:pk extends="java.lang.Object"
046: *
047: * @ejb:transaction type="Required"
048: *
049: * @ejb:data-object extends="java.lang.Object"
050: * setdata="true"
051: *
052: * @ejb:finder signature="java.util.Collection findAll()"
053: *
054: * @ejb:finder signature="java.util.Collection findByBank( java.lang.String pBankId )"
055: * query="SELECT OBJECT(o) FROM Customer o WHERE o.bankId = ?1"
056: *
057: * @jboss:finder-query name="findByBank"
058: * query="bankId = {0}"
059: * order="bankId"
060: *
061: * @jboss:table-name table-name="New_Customer"
062: *
063: * @jboss:create-table create="true"
064: *
065: * @jboss:remove-table remove="true"
066: */
067: public abstract class CustomerBean extends EntitySupport {
068: // Constants -----------------------------------------------------
069:
070: // Attributes ----------------------------------------------------
071:
072: // Static --------------------------------------------------------
073:
074: public static int sId = 0;
075:
076: // Constructors --------------------------------------------------
077:
078: // Public --------------------------------------------------------
079:
080: /**
081: * @ejb:persistent-field
082: * @ejb:pk-field
083: *
084: * @jboss:column-name name="Id"
085: **/
086: abstract public String getId();
087:
088: abstract public void setId(String pId);
089:
090: /**
091: * @ejb:persistent-field
092: *
093: * @jboss:column-name name="Bank_Id"
094: **/
095: abstract public String getBankId();
096:
097: abstract public void setBankId(String pBankId);
098:
099: /**
100: * @ejb:persistent-field
101: *
102: * @jboss:column-name name="Name"
103: **/
104: abstract public String getName();
105:
106: abstract public void setName(String pName);
107:
108: /**
109: * @ejb:interface-method view-type="remote"
110: **/
111: public abstract CustomerData getData();
112:
113: /**
114: * @ejb:interface-method view-type="remote"
115: **/
116: public abstract void setData(CustomerData pData);
117:
118: // EntityHome implementation -------------------------------------
119:
120: /**
121: * @ejb:create-method view-type="remote"
122: **/
123: public CustomerPK ejbCreate(String pBankId, String pName) {
124: setId("" + (sId++));
125: System.out.println("Created Customer with ID: " + getId());
126: setBankId(pBankId);
127: setName(pName);
128:
129: return null;
130: }
131:
132: public void ejbPostCreate(String pBankId, String pName) {
133: }
134: }
135:
136: /*
137: * $Id: CustomerBean.java 57211 2006-09-26 12:39:46Z dimitris@jboss.org $
138: * Currently locked by:$Locker$
139: * Revision:
140: * $Log$
141: * Revision 1.2.16.1 2005/10/29 05:04:35 starksm
142: * Update the LGPL header
143: *
144: * Revision 1.2 2002/05/06 00:07:37 danch
145: * Added ejbql query specs, schema names
146: *
147: * Revision 1.1 2002/05/04 01:08:25 schaefera
148: * Added new Stats classes (JMS related) to JSR-77 implemenation and added the
149: * bank-new test application but this does not work right now properly but
150: * it is not added to the default tests so I shouldn't bother someone.
151: *
152: * Revision 1.1.2.5 2002/04/30 01:21:23 schaefera
153: * Added some fixes to the marathon test and a windows script.
154: *
155: * Revision 1.1.2.4 2002/04/29 21:05:17 schaefera
156: * Added new marathon test suite using the new bank application
157: *
158: * Revision 1.1.2.3 2002/04/17 05:07:24 schaefera
159: * Redesigned the banknew example therefore to a create separation between
160: * the Entity Bean (CMP) and the Session Beans (Business Logic).
161: * The test cases are redesigned but not finished yet.
162: *
163: * Revision 1.1.2.2 2002/04/15 04:28:15 schaefera
164: * Minor fixes regarding to the JNDI names of the beans.
165: *
166: * Revision 1.1.2.1 2002/04/15 02:32:24 schaefera
167: * Add a new test version of the bank because the old did no use transactions
168: * and the new uses XDoclet 1.1.2 to generate the DDs and other Java classes.
169: * Also a marathon test is added. Please specify the jbosstest.duration for
170: * how long and the test.timeout (which must be longer than the duration) to
171: * run the test with run_tests.xml, tag marathon-test-and-report.
172: *
173: * Revision 1.4 2001/01/20 16:32:51 osh
174: * More cleanup to avoid verifier warnings.
175: *
176: * Revision 1.3 2001/01/07 23:14:34 peter
177: * Trying to get JAAS to work within test suite.
178: *
179: * Revision 1.2 2000/09/30 01:00:54 fleury
180: * Updated bank tests to work with new jBoss version
181: *
182: * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
183: * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
184: */
|