001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex003.pos;
004:
005: import com.completex.objective.components.persistency.key.impl.DefaultNaturalKeyFactory;
006: import java.util.Date;
007: import java.util.HashMap;
008: import java.util.Map;
009: import java.io.InputStream;
010: import java.math.BigDecimal;
011: import java.math.BigInteger;
012: import java.sql.Clob;
013: import java.sql.Blob;
014: import com.completex.objective.components.persistency.*;
015: import com.completex.objective.components.persistency.key.impl.DefaultNaturalKeyFactory;
016:
017: import java.util.Date;
018:
019: public class CustomerOrderPO extends PersistentObject implements
020: java.io.Externalizable {
021: //
022: // Complex object related:
023: //
024:
025: //
026: private static Map registeredMasters;
027: private static Object lock = new Object();
028:
029: protected Object classLock() {
030: return lock;
031: }
032:
033: protected void instantiateRegisteredMasters() {
034: if (registeredMasters == null) {
035: synchronized (lock) {
036: if (registeredMasters == null) {
037: registeredMasters = new HashMap();
038: }
039: }
040: }
041: }
042:
043: protected Map registeredMasters() {
044: return registeredMasters;
045: }
046:
047: //
048: //
049: //
050:
051: public static final String TABLE_CUSTOMER_ORDER = "CUSTOMER_ORDER";
052:
053: public CustomerOrderPO() {
054: super (new Record(table));
055: }
056:
057: public CustomerOrderPO(Long orderId) {
058: this ();
059: setOrderId(orderId);
060: }
061:
062: public static final String COL_ORDER_ID = "ORDER_ID";
063: public static final String TCOL_ORDER_ID = "CUSTOMER_ORDER.ORDER_ID";
064: public static final int ICOL_ORDER_ID = 0;
065: public static final int JDBC_TYPE_ORDER_ID = -5;
066:
067: public static final String COL_CUSTOMER_ID = "CUSTOMER_ID";
068: public static final String TCOL_CUSTOMER_ID = "CUSTOMER_ORDER.CUSTOMER_ID";
069: public static final int ICOL_CUSTOMER_ID = 1;
070: public static final int JDBC_TYPE_CUSTOMER_ID = -5;
071:
072: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
073: public static final String TCOL_LAST_UPDATED = "CUSTOMER_ORDER.LAST_UPDATED";
074: public static final int ICOL_LAST_UPDATED = 2;
075: public static final int JDBC_TYPE_LAST_UPDATED = 91;
076:
077: public static final String COL_CREATION_DATE = "CREATION_DATE";
078: public static final String TCOL_CREATION_DATE = "CUSTOMER_ORDER.CREATION_DATE";
079: public static final int ICOL_CREATION_DATE = 3;
080: public static final int JDBC_TYPE_CREATION_DATE = 91;
081:
082: private static final MetaTable table = new MetaTable(
083: "CUSTOMER_ORDER", "CUSTOMER_ORDER", 4, 1);
084:
085: static {
086: table.setStaticFinal(true);
087: //
088: // Meta Foreign Keys:
089: //
090: table.addToForeignKey("CUSTOMER", new ForeignKeyEntry(
091: "CUSTOMER_ID", "CUSTOMER_ID"));
092: //
093: // Meta Natural Key:
094: //
095: // naturalKey has no context
096:
097: //
098: // Meta Columns:
099: //
100:
101: final MetaColumn metaOrderId = new MetaColumn(ICOL_ORDER_ID,
102: "ORDER_ID", "ORDER_ID", table);
103: metaOrderId.setPrimaryKey(true);
104: metaOrderId.setRequired(true);
105: metaOrderId.setOptimisticLock(false);
106: metaOrderId.setType(ColumnType.LONG);
107: metaOrderId.setColumnSize(0);
108: metaOrderId.setRemarks("");
109: metaOrderId.setDecimalDigits(0);
110: metaOrderId.setAutoGenerated(true);
111: metaOrderId.setAutoIncrement(false);
112: metaOrderId.setJdbcType(-5);
113: metaOrderId
114: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.SimpleSequenceKeyGeneratorImpl());
115: {
116: HashMap staticAttributes = new HashMap();
117: staticAttributes.put("name", "CUSTOMER_ORDER_SEQ");
118: metaOrderId.setGeneratorStaticAttributes(staticAttributes);
119: }
120: metaOrderId.initializeKeyGenerator();
121: table.addToPrimaryKey(new Integer(ICOL_ORDER_ID));
122: table.addColumn(metaOrderId);
123:
124: final MetaColumn metaCustomerId = new MetaColumn(
125: ICOL_CUSTOMER_ID, "CUSTOMER_ID", "CUSTOMER_ID", table);
126: metaCustomerId.setPrimaryKey(false);
127: metaCustomerId.setRequired(true);
128: metaCustomerId.setOptimisticLock(false);
129: metaCustomerId.setType(ColumnType.LONG);
130: metaCustomerId.setColumnSize(0);
131: metaCustomerId.setRemarks("");
132: metaCustomerId.setDecimalDigits(0);
133: metaCustomerId.setAutoGenerated(false);
134: metaCustomerId.setAutoIncrement(false);
135: metaCustomerId.setJdbcType(-5);
136: table.addColumn(metaCustomerId);
137:
138: final MetaColumn metaLastUpdated = new MetaColumn(
139: ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
140: table);
141: metaLastUpdated.setPrimaryKey(false);
142: metaLastUpdated.setRequired(false);
143: metaLastUpdated.setOptimisticLock(false);
144: metaLastUpdated.setType(ColumnType.DATE);
145: metaLastUpdated.setColumnSize(0);
146: metaLastUpdated.setRemarks("");
147: metaLastUpdated.setDecimalDigits(0);
148: metaLastUpdated.setAutoGenerated(true);
149: metaLastUpdated.setAutoIncrement(false);
150: metaLastUpdated.setJdbcType(91);
151: metaLastUpdated
152: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
153: metaLastUpdated.initializeKeyGenerator();
154: table.addColumn(metaLastUpdated);
155:
156: final MetaColumn metaCreationDate = new MetaColumn(
157: ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
158: table);
159: metaCreationDate.setPrimaryKey(false);
160: metaCreationDate.setRequired(false);
161: metaCreationDate.setOptimisticLock(false);
162: metaCreationDate.setType(ColumnType.DATE);
163: metaCreationDate.setColumnSize(0);
164: metaCreationDate.setRemarks("");
165: metaCreationDate.setDecimalDigits(0);
166: metaCreationDate.setAutoGenerated(true);
167: metaCreationDate.setAutoIncrement(false);
168: metaCreationDate.setJdbcType(91);
169: metaCreationDate
170: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
171: metaCreationDate.initializeKeyGenerator();
172: table.addColumn(metaCreationDate);
173:
174: }
175:
176: private Long orderId;
177: private Long customerId;
178: private Date lastUpdated;
179: private Date creationDate;
180:
181: //
182: // orderId:
183: //
184: public Long getOrderId() {
185: return this .orderId;
186: }
187:
188: public void setOrderId(Long orderId) {
189: if (record2().setObject(ICOL_ORDER_ID, orderId)) {
190: this .orderId = orderId;
191: }
192: }
193:
194: public boolean izNullOrderId() {
195: return record2().getObject(ICOL_ORDER_ID) == null;
196: }
197:
198: public void setNullOrderId() {
199: if (record2().setObject(ICOL_ORDER_ID, null)) {
200: this .orderId = null;
201: }
202: }
203:
204: //
205: // customerId:
206: //
207: public Long getCustomerId() {
208: return this .customerId;
209: }
210:
211: public void setCustomerId(Long customerId) {
212: if (record2().setObject(ICOL_CUSTOMER_ID, customerId)) {
213: this .customerId = customerId;
214: }
215: }
216:
217: public boolean izNullCustomerId() {
218: return record2().getObject(ICOL_CUSTOMER_ID) == null;
219: }
220:
221: public void setNullCustomerId() {
222: if (record2().setObject(ICOL_CUSTOMER_ID, null)) {
223: this .customerId = null;
224: }
225: }
226:
227: //
228: // lastUpdated:
229: //
230: public Date getLastUpdated() {
231: return this .lastUpdated;
232: }
233:
234: public void setLastUpdated(Date lastUpdated) {
235: if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
236: this .lastUpdated = lastUpdated;
237: }
238: }
239:
240: public boolean izNullLastUpdated() {
241: return record2().getObject(ICOL_LAST_UPDATED) == null;
242: }
243:
244: public void setNullLastUpdated() {
245: if (record2().setObject(ICOL_LAST_UPDATED, null)) {
246: this .lastUpdated = null;
247: }
248: }
249:
250: //
251: // creationDate:
252: //
253: public Date getCreationDate() {
254: return this .creationDate;
255: }
256:
257: public void setCreationDate(Date creationDate) {
258: if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
259: this .creationDate = creationDate;
260: }
261: }
262:
263: public boolean izNullCreationDate() {
264: return record2().getObject(ICOL_CREATION_DATE) == null;
265: }
266:
267: public void setNullCreationDate() {
268: if (record2().setObject(ICOL_CREATION_DATE, null)) {
269: this .creationDate = null;
270: }
271: }
272:
273: public void toBeanFields() {
274: toBeanFields(this );
275: }
276:
277: public void toBeanFields(PersistentObject from) {
278: orderId = (Long) from.record2().getObject(ICOL_ORDER_ID);
279: customerId = (Long) from.record2().getObject(ICOL_CUSTOMER_ID);
280: lastUpdated = (Date) from.record2()
281: .getObject(ICOL_LAST_UPDATED);
282: creationDate = (Date) from.record2().getObject(
283: ICOL_CREATION_DATE);
284: super .toBeanFields(from);
285: }
286:
287: public void fromBeanFields(PersistentObject persistentObject) {
288: CustomerOrderPO from = (CustomerOrderPO) persistentObject;
289: record2().getEntry(ICOL_ORDER_ID).setUnmarkedValue(
290: from.orderId, from.orderId);
291: record2().getEntry(ICOL_CUSTOMER_ID).setUnmarkedValue(
292: from.customerId, from.customerId);
293: record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
294: from.lastUpdated, from.lastUpdated);
295: record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
296: from.creationDate, from.creationDate);
297: super .fromBeanFieldsDataSaved(persistentObject);
298: }
299:
300: public String toString() {
301:
302: StringBuffer buffer = new StringBuffer();
303: buffer.append("{ " + "class = ").append(
304: this .getClass().getName()).append(" " + "table = ")
305: .append(TABLE_CUSTOMER_ORDER).append(" columns = {");
306:
307: if (record() != null) {
308: buffer.append(COL_ORDER_ID).append(" = ").append(
309: record().getObject(ICOL_ORDER_ID)).append(" ");
310: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
311: record().getObject(ICOL_CUSTOMER_ID)).append(" ");
312: buffer.append(COL_LAST_UPDATED).append(" = ").append(
313: record().getObject(ICOL_LAST_UPDATED)).append(" ");
314: buffer.append(COL_CREATION_DATE).append(" = ").append(
315: record().getObject(ICOL_CREATION_DATE)).append(" ");
316: } else {
317: buffer.append(COL_ORDER_ID).append(" = ").append(orderId)
318: .append(" ");
319: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
320: customerId).append(" ");
321: buffer.append(COL_LAST_UPDATED).append(" = ").append(
322: lastUpdated).append(" ");
323: buffer.append(COL_CREATION_DATE).append(" = ").append(
324: creationDate).append(" ");
325: }
326: buffer.append("}}");
327: return buffer.toString();
328: }
329:
330: // naturalKey has no context
331:
332: /**
333: * Equals by Basic Peristent object fields (without children objects)
334: */
335: public boolean equalsBasic(Object value) {
336: if (this == value)
337: return true;
338: if (value == null || getClass() != value.getClass())
339: return false;
340:
341: CustomerOrderPO that = (CustomerOrderPO) value;
342:
343: if (orderId != null ? !orderId.equals(that.orderId)
344: : that.orderId != null)
345: return false;
346: if (customerId != null ? !customerId.equals(that.customerId)
347: : that.customerId != null)
348: return false;
349: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
350: : that.lastUpdated != null)
351: return false;
352: if (creationDate != null ? !creationDate
353: .equals(that.creationDate) : that.creationDate != null)
354: return false;
355: return true;
356: }
357:
358: /**
359: * hashCode by Basic Peristent object fields (without children objects)
360: */
361: public int hashCodeBasic() {
362: int result;
363: long temp;
364: result = (orderId != null ? orderId.hashCode() : 0);
365: result = 29 * result
366: + (customerId != null ? customerId.hashCode() : 0);
367: result = 29 * result
368: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
369: result = 29 * result
370: + (creationDate != null ? creationDate.hashCode() : 0);
371:
372: return result;
373: }
374: }
|