KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > fannuaire > PersonneEC


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: PersonneEC.java,v 1.1 2003/12/05 14:16:52 legrasi Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 // PersonneEC.java
27

28 package org.objectweb.jonas.jtests.beans.fannuaire;
29
30 import java.rmi.RemoteException JavaDoc;
31 import java.sql.Connection JavaDoc;
32 import java.sql.SQLException JavaDoc;
33 import java.sql.Statement JavaDoc;
34 import javax.ejb.CreateException JavaDoc;
35 import javax.ejb.DuplicateKeyException JavaDoc;
36 import javax.ejb.EJBException JavaDoc;
37 import javax.ejb.FinderException JavaDoc;
38 import javax.ejb.RemoveException JavaDoc;
39 import javax.ejb.EJBObject JavaDoc;
40 import javax.ejb.EntityBean JavaDoc;
41 import javax.ejb.EntityContext JavaDoc;
42 import javax.naming.Context JavaDoc;
43 import javax.naming.InitialContext JavaDoc;
44 import javax.naming.NamingException JavaDoc;
45 import javax.sql.DataSource JavaDoc;
46 import javax.transaction.NotSupportedException JavaDoc;
47 import javax.transaction.Status JavaDoc;
48 import javax.transaction.SystemException JavaDoc;
49 import javax.transaction.UserTransaction JavaDoc;
50
51 //import org.objectweb.jonas.common.Log;
52
//import org.objectweb.util.monolog.api.Logger;
53
//import org.objectweb.util.monolog.api.BasicLevel;
54

55 /**
56  * This is an entity bean with "container managed persistence version 1.x".
57  * This class extends the similar entity bean with "CMP version 2.x",
58  * and implements methods specifics to this bean.
59  * @author Philippe Durieux, Helene Joanin (jonas team)
60  */

61 public class PersonneEC extends PersonneEC2 implements EntityBean JavaDoc {
62
63     boolean dirty = false;
64     boolean isModifiedCalled = false;
65     boolean ejbStoreCalled = false;
66
67     // ------------------------------------------------------------------
68
// State of the bean.
69
// They must be public for Container Managed Persistance.
70
// ------------------------------------------------------------------
71
public String JavaDoc nom;
72     public String JavaDoc numero;
73
74     // ------------------------------------------------------------------
75
// Accessors and setters implementation
76
// ------------------------------------------------------------------
77

78     /**
79      * getNumero / Tx Attribute = Required
80      */

81     public String JavaDoc getNumero() {
82         // logger.log(BasicLevel.DEBUG, "");
83
return numero;
84     }
85
86     /**
87      * setNumero / Tx Attribute = Required
88      */

89     public void setNumero(String JavaDoc s) {
90         //logger.log(BasicLevel.DEBUG, "");
91
numero = s;
92         dirty = true;
93     }
94
95     /**
96      * setNumero / Tx Attribute = Supports
97      */

98     public void setNumeroNTX(String JavaDoc s) {
99         //logger.log(BasicLevel.DEBUG, "");
100
super.setNumeroNTX(s);
101         dirty = true;
102     }
103
104     /**
105      * setNom - Attention: on modifie la PK!!!
106      */

107     public void setNom(String JavaDoc s) {
108         //logger.log(BasicLevel.DEBUG, "");
109
nom = s;
110         dirty = true;
111     }
112
113     /**
114      * getNom
115      */

116     public String JavaDoc getNom() {
117         //logger.log(BasicLevel.DEBUG, "");
118
return nom;
119     }
120
121
122     // ------------------------------------------------------------------
123
// isModified method
124
// ------------------------------------------------------------------
125
public boolean isModified() {
126         isModifiedCalled = true;
127         return dirty;
128     }
129
130     // ------------------------------------------------------------------
131
// EntityBean implementation
132
// ------------------------------------------------------------------
133

134     public void ejbLoad() {
135         //logger.log(BasicLevel.DEBUG, "");
136
super.ejbLoad();
137         dirty = false;
138     }
139
140     public void ejbStore() {
141         //logger.log(BasicLevel.DEBUG, "");
142
ejbStoreCalled = true;
143         super.ejbStore();
144         dirty = false;
145     }
146     
147     // ------------------------------------------------------------------
148
// Personne implementation
149
// ------------------------------------------------------------------
150

151     public boolean isDirty() {
152         //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" isDirty ="+dirty+" "+numero);
153
return dirty;
154     }
155
156     public void reset() {
157         //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" reset "+numero);
158
isModifiedCalled = false;
159         ejbStoreCalled = false;
160     }
161
162     public boolean isModifiedCalled() {
163         //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" isModifiedCalled ="+isModifiedCalled+" "+numero);
164
return isModifiedCalled;
165     }
166
167     public boolean ejbStoreCalled() {
168         //logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" ejbStoreCalled ="+ejbStoreCalled+" "+numero);
169
return ejbStoreCalled;
170     }
171         
172 }
173
Popular Tags