KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > banknew > ejb > CustomerBean


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.test.banknew.ejb;
23
24 import org.jboss.test.banknew.interfaces.CustomerData;
25 import org.jboss.test.banknew.interfaces.CustomerPK;
26 import org.jboss.test.util.ejb.EntitySupport;
27
28 /**
29  * The Entity bean represents a bank customer
30  *
31  * @author Andreas Schaefer
32  * @version $Revision: 41581 $
33  *
34  * @ejb:bean name="bank/Customer"
35  * display-name="Bank Customer Entity"
36  * type="CMP"
37  * view-type="remote"
38  * jndi-name="ejb/bank/Customer"
39  * schema="Customer"
40  *
41  * @ejb:interface extends="javax.ejb.EJBObject"
42  *
43  * @ejb:home extends="javax.ejb.EJBHome"
44  *
45  * @ejb:pk extends="java.lang.Object"
46  *
47  * @ejb:transaction type="Required"
48  *
49  * @ejb:data-object extends="java.lang.Object"
50  * setdata="true"
51  *
52  * @ejb:finder signature="java.util.Collection findAll()"
53  *
54  * @ejb:finder signature="java.util.Collection findByBank( java.lang.String pBankId )"
55  * query="SELECT OBJECT(o) FROM Customer o WHERE o.bankId = ?1"
56  *
57  * @jboss:finder-query name="findByBank"
58  * query="bankId = {0}"
59  * order="bankId"
60  *
61  * @jboss:table-name table-name="New_Customer"
62  *
63  * @jboss:create-table create="true"
64  *
65  * @jboss:remove-table remove="true"
66  */

67 public abstract class CustomerBean
68    extends EntitySupport
69 {
70    // Constants -----------------------------------------------------
71

72    // Attributes ----------------------------------------------------
73

74    // Static --------------------------------------------------------
75

76    public static int sId = 0;
77    
78    // Constructors --------------------------------------------------
79

80    // Public --------------------------------------------------------
81

82    /**
83     * @ejb:persistent-field
84     * @ejb:pk-field
85     *
86     * @jboss:column-name name="Id"
87     **/

88    abstract public String JavaDoc getId();
89    
90    abstract public void setId( String JavaDoc pId );
91    
92    /**
93     * @ejb:persistent-field
94     *
95     * @jboss:column-name name="Bank_Id"
96     **/

97    abstract public String JavaDoc getBankId();
98    
99    abstract public void setBankId( String JavaDoc pBankId );
100    
101    /**
102     * @ejb:persistent-field
103     *
104     * @jboss:column-name name="Name"
105     **/

106    abstract public String JavaDoc getName();
107    
108    abstract public void setName( String JavaDoc pName );
109    
110    /**
111     * @ejb:interface-method view-type="remote"
112     **/

113    public abstract CustomerData getData();
114    
115    /**
116     * @ejb:interface-method view-type="remote"
117     **/

118    public abstract void setData( CustomerData pData );
119    
120    // EntityHome implementation -------------------------------------
121

122    /**
123     * @ejb:create-method view-type="remote"
124     **/

125    public CustomerPK ejbCreate( String JavaDoc pBankId, String JavaDoc pName ) {
126       setId( "" + ( sId++ ) );
127       System.out.println( "Created Customer with ID: " + getId() );
128       setBankId( pBankId );
129       setName( pName );
130       
131       return null;
132    }
133    
134    public void ejbPostCreate( String JavaDoc pBankId, String JavaDoc pName )
135    {
136    }
137 }
138
139 /*
140  * $Id: CustomerBean.java 41581 2006-03-01 16:10:00Z adrian $
141  * Currently locked by:$Locker$
142  * Revision:
143  * $Log$
144  * Revision 1.4 2006/03/01 16:09:58 adrian
145  * Remove xdoclet from jca tests
146  *
147  * Revision 1.2.16.1 2005/10/29 05:04:35 starksm
148  * Update the LGPL header
149  *
150  * Revision 1.2 2002/05/06 00:07:37 danch
151  * Added ejbql query specs, schema names
152  *
153  * Revision 1.1 2002/05/04 01:08:25 schaefera
154  * Added new Stats classes (JMS related) to JSR-77 implemenation and added the
155  * bank-new test application but this does not work right now properly but
156  * it is not added to the default tests so I shouldn't bother someone.
157  *
158  * Revision 1.1.2.5 2002/04/30 01:21:23 schaefera
159  * Added some fixes to the marathon test and a windows script.
160  *
161  * Revision 1.1.2.4 2002/04/29 21:05:17 schaefera
162  * Added new marathon test suite using the new bank application
163  *
164  * Revision 1.1.2.3 2002/04/17 05:07:24 schaefera
165  * Redesigned the banknew example therefore to a create separation between
166  * the Entity Bean (CMP) and the Session Beans (Business Logic).
167  * The test cases are redesigned but not finished yet.
168  *
169  * Revision 1.1.2.2 2002/04/15 04:28:15 schaefera
170  * Minor fixes regarding to the JNDI names of the beans.
171  *
172  * Revision 1.1.2.1 2002/04/15 02:32:24 schaefera
173  * Add a new test version of the bank because the old did no use transactions
174  * and the new uses XDoclet 1.1.2 to generate the DDs and other Java classes.
175  * Also a marathon test is added. Please specify the jbosstest.duration for
176  * how long and the test.timeout (which must be longer than the duration) to
177  * run the test with run_tests.xml, tag marathon-test-and-report.
178  *
179  * Revision 1.4 2001/01/20 16:32:51 osh
180  * More cleanup to avoid verifier warnings.
181  *
182  * Revision 1.3 2001/01/07 23:14:34 peter
183  * Trying to get JAAS to work within test suite.
184  *
185  * Revision 1.2 2000/09/30 01:00:54 fleury
186  * Updated bank tests to work with new jBoss version
187  *
188  * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
189  * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
190  */

191
Popular Tags