001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: PersonneEC.java 3845 2003-12-05 14:19:55Z legrasi $
023: * --------------------------------------------------------------------------
024: */
025:
026: // PersonneEC.java
027: package org.objectweb.jonas.jtests.beans.fannuaire;
028:
029: import java.rmi.RemoteException;
030: import java.sql.Connection;
031: import java.sql.SQLException;
032: import java.sql.Statement;
033: import javax.ejb.CreateException;
034: import javax.ejb.DuplicateKeyException;
035: import javax.ejb.EJBException;
036: import javax.ejb.FinderException;
037: import javax.ejb.RemoveException;
038: import javax.ejb.EJBObject;
039: import javax.ejb.EntityBean;
040: import javax.ejb.EntityContext;
041: import javax.naming.Context;
042: import javax.naming.InitialContext;
043: import javax.naming.NamingException;
044: import javax.sql.DataSource;
045: import javax.transaction.NotSupportedException;
046: import javax.transaction.Status;
047: import javax.transaction.SystemException;
048: import javax.transaction.UserTransaction;
049:
050: //import org.objectweb.jonas.common.Log;
051: //import org.objectweb.util.monolog.api.Logger;
052: //import org.objectweb.util.monolog.api.BasicLevel;
053:
054: /**
055: * This is an entity bean with "container managed persistence version 1.x".
056: * This class extends the similar entity bean with "CMP version 2.x",
057: * and implements methods specifics to this bean.
058: * @author Philippe Durieux, Helene Joanin (jonas team)
059: */
060: public class PersonneEC extends PersonneEC2 implements EntityBean {
061:
062: boolean dirty = false;
063: boolean isModifiedCalled = false;
064: boolean ejbStoreCalled = false;
065:
066: // ------------------------------------------------------------------
067: // State of the bean.
068: // They must be public for Container Managed Persistance.
069: // ------------------------------------------------------------------
070: public String nom;
071: public String numero;
072:
073: // ------------------------------------------------------------------
074: // Accessors and setters implementation
075: // ------------------------------------------------------------------
076:
077: /**
078: * getNumero / Tx Attribute = Required
079: */
080: public String getNumero() {
081: // logger.log(BasicLevel.DEBUG, "");
082: return numero;
083: }
084:
085: /**
086: * setNumero / Tx Attribute = Required
087: */
088: public void setNumero(String s) {
089: //logger.log(BasicLevel.DEBUG, "");
090: numero = s;
091: dirty = true;
092: }
093:
094: /**
095: * setNumero / Tx Attribute = Supports
096: */
097: public void setNumeroNTX(String s) {
098: //logger.log(BasicLevel.DEBUG, "");
099: super .setNumeroNTX(s);
100: dirty = true;
101: }
102:
103: /**
104: * setNom - Attention: on modifie la PK!!!
105: */
106: public void setNom(String s) {
107: //logger.log(BasicLevel.DEBUG, "");
108: nom = s;
109: dirty = true;
110: }
111:
112: /**
113: * getNom
114: */
115: public String getNom() {
116: //logger.log(BasicLevel.DEBUG, "");
117: return nom;
118: }
119:
120: // ------------------------------------------------------------------
121: // isModified method
122: // ------------------------------------------------------------------
123: public boolean isModified() {
124: isModifiedCalled = true;
125: return dirty;
126: }
127:
128: // ------------------------------------------------------------------
129: // EntityBean implementation
130: // ------------------------------------------------------------------
131:
132: public void ejbLoad() {
133: //logger.log(BasicLevel.DEBUG, "");
134: super .ejbLoad();
135: dirty = false;
136: }
137:
138: public void ejbStore() {
139: //logger.log(BasicLevel.DEBUG, "");
140: ejbStoreCalled = true;
141: super .ejbStore();
142: dirty = false;
143: }
144:
145: // ------------------------------------------------------------------
146: // Personne implementation
147: // ------------------------------------------------------------------
148:
149: public boolean isDirty() {
150: //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" isDirty ="+dirty+" "+numero);
151: return dirty;
152: }
153:
154: public void reset() {
155: //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" reset "+numero);
156: isModifiedCalled = false;
157: ejbStoreCalled = false;
158: }
159:
160: public boolean isModifiedCalled() {
161: //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" isModifiedCalled ="+isModifiedCalled+" "+numero);
162: return isModifiedCalled;
163: }
164:
165: public boolean ejbStoreCalled() {
166: //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" ejbStoreCalled ="+ejbStoreCalled+" "+numero);
167: return ejbStoreCalled;
168: }
169:
170: }
|