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 javax.ejb.CreateException;
025:
026: import org.jboss.test.banknew.interfaces.AccountData;
027: import org.jboss.test.banknew.interfaces.AccountPK;
028: import org.jboss.test.util.ejb.EntitySupport;
029:
030: /**
031: * The Entity bean represents a bank account
032: *
033: * @author Andreas Schaefer
034: * @version $Revision: 57211 $
035: *
036: * @ejb:bean name="bank/Account"
037: * display-name="Bank Account Entity"
038: * type="CMP"
039: * view-type="remote"
040: * jndi-name="ejb/bank/Account"
041: * schema="Account"
042: *
043: * @ejb:interface extends="javax.ejb.EJBObject"
044: *
045: * @ejb:home extends="javax.ejb.EJBHome"
046: *
047: * @ejb:pk extends="java.lang.Object"
048: *
049: * @ejb:transaction type="Required"
050: *
051: * @ejb:data-object setdata="true"
052: * extends="java.lang.Object"
053: *
054: * @ejb:finder signature="java.util.Collection findAll()"
055: * query="SELECT OBJECT(o) from Account AS o"
056: *
057: * @ejb:finder signature="java.util.Collection findByCustomer( java.lang.String pCustomerId )"
058: * query="SELECT OBJECT(o) from Account AS o WHERE o.customerId = ?1"
059: *
060: * @jboss:finder-query name="findByCustomer"
061: * query="Customer_Id = {0}"
062: * order="Type"
063: *
064: * @ejb:finder signature="org.jboss.test.banknew.interfaces.Account findByCustomerAndType( java.lang.String pCustomerId, int pType )"
065: * query="SELECT OBJECT(o) from Account AS o WHERE o.customerId = ?1 AND o.type = ?2"
066: *
067: * @jboss:finder-query name="findByCustomerAndType"
068: * query="Customer_Id = {0} AND Type = {1}"
069: *
070: * @jboss:table-name table-name="New_Account"
071: *
072: * @jboss:create-table create="true"
073: *
074: * @jboss:remove-table remove="true"
075: */
076: public abstract class AccountBean extends EntitySupport {
077: // Constants -----------------------------------------------------
078:
079: // Attributes ----------------------------------------------------
080:
081: // Static --------------------------------------------------------
082:
083: // Constructors --------------------------------------------------
084:
085: // Public --------------------------------------------------------
086:
087: /**
088: * @ejb:persistent-field
089: * @ejb:pk-field
090: *
091: * @jboss:column-name name="Id"
092: **/
093: abstract public String getId();
094:
095: abstract public void setId(String pId);
096:
097: /**
098: * @ejb:persistent-field
099: *
100: * @jboss:column-name name="Customer_Id"
101: **/
102: abstract public String getCustomerId();
103:
104: abstract public void setCustomerId(String pCustomerId);
105:
106: /**
107: * @ejb:persistent-field
108: *
109: * @jboss:column-name name="Type"
110: **/
111: abstract public int getType();
112:
113: abstract public void setType(int pType);
114:
115: /**
116: * @ejb:persistent-field
117: * @ejb:interface-method view-type="remote"
118: *
119: * @jboss:column-name name="Balance"
120: **/
121: abstract public float getBalance();
122:
123: abstract public void setBalance(float pAmount);
124:
125: /**
126: * @ejb:interface-method view-type="remote"
127: **/
128: public abstract void setData(AccountData pData);
129:
130: /**
131: * @ejb:interface-method view-type="remote"
132: **/
133: public abstract AccountData getData();
134:
135: // protected abstract void makeDirty();
136:
137: // protected abstract void makeClean();
138:
139: // EntityBean implementation -------------------------------------
140: /**
141: * @ejb:create-method view-type="remote"
142: **/
143: public AccountPK ejbCreate(AccountData pData)
144: throws CreateException {
145: setId(pData.getCustomerId() + ":" + pData.getType());
146: setData(pData);
147:
148: return null;
149: }
150:
151: public void ejbPostCreate(AccountData data) throws CreateException {
152: }
153: }
154:
155: /*
156: * $Id: AccountBean.java 57211 2006-09-26 12:39:46Z dimitris@jboss.org $
157: * Currently locked by:$Locker$
158: * Revision:
159: * $Log$
160: * Revision 1.2.16.2 2006/03/01 15:58:56 adrian
161: * Remove xdoclet from the jca tests + other tidyup
162: *
163: * Revision 1.2.16.1 2005/10/29 05:04:35 starksm
164: * Update the LGPL header
165: *
166: * Revision 1.2 2002/05/06 00:07:36 danch
167: * Added ejbql query specs, schema names
168: *
169: * Revision 1.1 2002/05/04 01:08:25 schaefera
170: * Added new Stats classes (JMS related) to JSR-77 implemenation and added the
171: * bank-new test application but this does not work right now properly but
172: * it is not added to the default tests so I shouldn't bother someone.
173: *
174: * Revision 1.1.2.5 2002/04/30 01:21:23 schaefera
175: * Added some fixes to the marathon test and a windows script.
176: *
177: * Revision 1.1.2.4 2002/04/29 21:05:17 schaefera
178: * Added new marathon test suite using the new bank application
179: *
180: * Revision 1.1.2.3 2002/04/17 05:07:24 schaefera
181: * Redesigned the banknew example therefore to a create separation between
182: * the Entity Bean (CMP) and the Session Beans (Business Logic).
183: * The test cases are redesigned but not finished yet.
184: *
185: * Revision 1.1.2.2 2002/04/15 04:28:15 schaefera
186: * Minor fixes regarding to the JNDI names of the beans.
187: *
188: * Revision 1.1.2.1 2002/04/15 02:32:24 schaefera
189: * Add a new test version of the bank because the old did no use transactions
190: * and the new uses XDoclet 1.1.2 to generate the DDs and other Java classes.
191: * Also a marathon test is added. Please specify the jbosstest.duration for
192: * how long and the test.timeout (which must be longer than the duration) to
193: * run the test with run_tests.xml, tag marathon-test-and-report.
194: *
195: * Revision 1.2.2.1 2001/12/27 22:00:02 starksm
196: *
197: * Set dirty to false in ejbStore
198: *
199: * Revision 1.2 2001/01/07 23:14:34 peter
200: * Trying to get JAAS to work within test suite.
201: *
202: * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
203: * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
204: */
|