001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex005.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 OrderItemPO 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_ORDER_ITEM = "ORDER_ITEM";
052:
053: public OrderItemPO() {
054: super (new Record(table));
055: }
056:
057: public OrderItemPO(Long orderItemId) {
058: this ();
059: setOrderItemId(orderItemId);
060: }
061:
062: public static final String COL_ORDER_ITEM_ID = "ORDER_ITEM_ID";
063: public static final String TCOL_ORDER_ITEM_ID = "ORDER_ITEM.ORDER_ITEM_ID";
064: public static final int ICOL_ORDER_ITEM_ID = 0;
065: public static final int JDBC_TYPE_ORDER_ITEM_ID = -5;
066:
067: public static final String COL_ORDER_ID = "ORDER_ID";
068: public static final String TCOL_ORDER_ID = "ORDER_ITEM.ORDER_ID";
069: public static final int ICOL_ORDER_ID = 1;
070: public static final int JDBC_TYPE_ORDER_ID = -5;
071:
072: public static final String COL_PRODUCT_ID = "PRODUCT_ID";
073: public static final String TCOL_PRODUCT_ID = "ORDER_ITEM.PRODUCT_ID";
074: public static final int ICOL_PRODUCT_ID = 2;
075: public static final int JDBC_TYPE_PRODUCT_ID = -5;
076:
077: public static final String COL_QUANTITY = "QUANTITY";
078: public static final String TCOL_QUANTITY = "ORDER_ITEM.QUANTITY";
079: public static final int ICOL_QUANTITY = 3;
080: public static final int JDBC_TYPE_QUANTITY = -5;
081:
082: public static final String COL_STATE = "STATE";
083: public static final String TCOL_STATE = "ORDER_ITEM.STATE";
084: public static final int ICOL_STATE = 4;
085: public static final int JDBC_TYPE_STATE = 12;
086:
087: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
088: public static final String TCOL_LAST_UPDATED = "ORDER_ITEM.LAST_UPDATED";
089: public static final int ICOL_LAST_UPDATED = 5;
090: public static final int JDBC_TYPE_LAST_UPDATED = 91;
091:
092: public static final String COL_CREATION_DATE = "CREATION_DATE";
093: public static final String TCOL_CREATION_DATE = "ORDER_ITEM.CREATION_DATE";
094: public static final int ICOL_CREATION_DATE = 6;
095: public static final int JDBC_TYPE_CREATION_DATE = 91;
096:
097: private static final MetaTable table = new MetaTable("ORDER_ITEM",
098: "ORDER_ITEM", 7, 1);
099:
100: static {
101: table.setStaticFinal(true);
102: //
103: // Meta Foreign Keys:
104: //
105: table.addToForeignKey("CUSTOMER_ORDER", new ForeignKeyEntry(
106: "ORDER_ID", "ORDER_ID"));
107: //
108: // Meta Natural Key:
109: //
110: // naturalKey has no context
111:
112: //
113: // Meta Columns:
114: //
115:
116: final MetaColumn metaOrderItemId = new MetaColumn(
117: ICOL_ORDER_ITEM_ID, "ORDER_ITEM_ID", "ORDER_ITEM_ID",
118: table);
119: metaOrderItemId.setPrimaryKey(true);
120: metaOrderItemId.setRequired(true);
121: metaOrderItemId.setOptimisticLock(false);
122: metaOrderItemId.setType(ColumnType.LONG);
123: metaOrderItemId.setColumnSize(0);
124: metaOrderItemId.setRemarks("");
125: metaOrderItemId.setDecimalDigits(0);
126: metaOrderItemId.setAutoGenerated(true);
127: metaOrderItemId.setAutoIncrement(false);
128: metaOrderItemId.setJdbcType(-5);
129: metaOrderItemId
130: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.SimpleSequenceKeyGeneratorImpl());
131: {
132: HashMap staticAttributes = new HashMap();
133: staticAttributes.put("name", "ORDER_ITEM_SEQ");
134: metaOrderItemId
135: .setGeneratorStaticAttributes(staticAttributes);
136: }
137: metaOrderItemId.initializeKeyGenerator();
138: table.addToPrimaryKey(new Integer(ICOL_ORDER_ITEM_ID));
139: table.addColumn(metaOrderItemId);
140:
141: final MetaColumn metaOrderId = new MetaColumn(ICOL_ORDER_ID,
142: "ORDER_ID", "ORDER_ID", table);
143: metaOrderId.setPrimaryKey(false);
144: metaOrderId.setRequired(true);
145: metaOrderId.setOptimisticLock(false);
146: metaOrderId.setType(ColumnType.LONG);
147: metaOrderId.setColumnSize(0);
148: metaOrderId.setRemarks("");
149: metaOrderId.setDecimalDigits(0);
150: metaOrderId.setAutoGenerated(false);
151: metaOrderId.setAutoIncrement(false);
152: metaOrderId.setJdbcType(-5);
153: table.addColumn(metaOrderId);
154:
155: final MetaColumn metaProductId = new MetaColumn(
156: ICOL_PRODUCT_ID, "PRODUCT_ID", "PRODUCT_ID", table);
157: metaProductId.setPrimaryKey(false);
158: metaProductId.setRequired(false);
159: metaProductId.setOptimisticLock(false);
160: metaProductId.setType(ColumnType.LONG);
161: metaProductId.setColumnSize(0);
162: metaProductId.setRemarks("");
163: metaProductId.setDecimalDigits(0);
164: metaProductId.setAutoGenerated(false);
165: metaProductId.setAutoIncrement(false);
166: metaProductId.setJdbcType(-5);
167: table.addColumn(metaProductId);
168:
169: final MetaColumn metaQuantity = new MetaColumn(ICOL_QUANTITY,
170: "QUANTITY", "QUANTITY", table);
171: metaQuantity.setPrimaryKey(false);
172: metaQuantity.setRequired(false);
173: metaQuantity.setOptimisticLock(false);
174: metaQuantity.setType(ColumnType.LONG);
175: metaQuantity.setColumnSize(0);
176: metaQuantity.setRemarks("");
177: metaQuantity.setDecimalDigits(0);
178: metaQuantity.setAutoGenerated(false);
179: metaQuantity.setAutoIncrement(false);
180: metaQuantity.setJdbcType(-5);
181: table.addColumn(metaQuantity);
182:
183: final MetaColumn metaState = new MetaColumn(ICOL_STATE,
184: "STATE", "STATE", table);
185: metaState.setPrimaryKey(false);
186: metaState.setRequired(true);
187: metaState.setOptimisticLock(false);
188: metaState.setType(ColumnType.STRING);
189: metaState.setColumnSize(40);
190: metaState.setRemarks("");
191: metaState.setDecimalDigits(0);
192: metaState.setAutoGenerated(false);
193: metaState.setAutoIncrement(false);
194: metaState.setJdbcType(12);
195: table.addColumn(metaState);
196:
197: final MetaColumn metaLastUpdated = new MetaColumn(
198: ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
199: table);
200: metaLastUpdated.setPrimaryKey(false);
201: metaLastUpdated.setRequired(false);
202: metaLastUpdated.setOptimisticLock(false);
203: metaLastUpdated.setType(ColumnType.DATE);
204: metaLastUpdated.setColumnSize(0);
205: metaLastUpdated.setRemarks("");
206: metaLastUpdated.setDecimalDigits(0);
207: metaLastUpdated.setAutoGenerated(true);
208: metaLastUpdated.setAutoIncrement(false);
209: metaLastUpdated.setJdbcType(91);
210: metaLastUpdated
211: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
212: metaLastUpdated.initializeKeyGenerator();
213: table.addColumn(metaLastUpdated);
214:
215: final MetaColumn metaCreationDate = new MetaColumn(
216: ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
217: table);
218: metaCreationDate.setPrimaryKey(false);
219: metaCreationDate.setRequired(false);
220: metaCreationDate.setOptimisticLock(false);
221: metaCreationDate.setType(ColumnType.DATE);
222: metaCreationDate.setColumnSize(0);
223: metaCreationDate.setRemarks("");
224: metaCreationDate.setDecimalDigits(0);
225: metaCreationDate.setAutoGenerated(true);
226: metaCreationDate.setAutoIncrement(false);
227: metaCreationDate.setJdbcType(91);
228: metaCreationDate
229: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
230: metaCreationDate.initializeKeyGenerator();
231: table.addColumn(metaCreationDate);
232:
233: }
234:
235: private Long orderItemId;
236: private Long orderId;
237: private Long productId;
238: private Long quantity;
239: private String state;
240: private Date lastUpdated;
241: private Date creationDate;
242:
243: //
244: // orderItemId:
245: //
246: public Long getOrderItemId() {
247: return this .orderItemId;
248: }
249:
250: public void setOrderItemId(Long orderItemId) {
251: if (record2().setObject(ICOL_ORDER_ITEM_ID, orderItemId)) {
252: this .orderItemId = orderItemId;
253: }
254: }
255:
256: public boolean izNullOrderItemId() {
257: return record2().getObject(ICOL_ORDER_ITEM_ID) == null;
258: }
259:
260: public void setNullOrderItemId() {
261: if (record2().setObject(ICOL_ORDER_ITEM_ID, null)) {
262: this .orderItemId = null;
263: }
264: }
265:
266: //
267: // orderId:
268: //
269: public Long getOrderId() {
270: return this .orderId;
271: }
272:
273: public void setOrderId(Long orderId) {
274: if (record2().setObject(ICOL_ORDER_ID, orderId)) {
275: this .orderId = orderId;
276: }
277: }
278:
279: public boolean izNullOrderId() {
280: return record2().getObject(ICOL_ORDER_ID) == null;
281: }
282:
283: public void setNullOrderId() {
284: if (record2().setObject(ICOL_ORDER_ID, null)) {
285: this .orderId = null;
286: }
287: }
288:
289: //
290: // productId:
291: //
292: public Long getProductId() {
293: return this .productId;
294: }
295:
296: public void setProductId(Long productId) {
297: if (record2().setObject(ICOL_PRODUCT_ID, productId)) {
298: this .productId = productId;
299: }
300: }
301:
302: public boolean izNullProductId() {
303: return record2().getObject(ICOL_PRODUCT_ID) == null;
304: }
305:
306: public void setNullProductId() {
307: if (record2().setObject(ICOL_PRODUCT_ID, null)) {
308: this .productId = null;
309: }
310: }
311:
312: //
313: // quantity:
314: //
315: public Long getQuantity() {
316: return this .quantity;
317: }
318:
319: public void setQuantity(Long quantity) {
320: if (record2().setObject(ICOL_QUANTITY, quantity)) {
321: this .quantity = quantity;
322: }
323: }
324:
325: public boolean izNullQuantity() {
326: return record2().getObject(ICOL_QUANTITY) == null;
327: }
328:
329: public void setNullQuantity() {
330: if (record2().setObject(ICOL_QUANTITY, null)) {
331: this .quantity = null;
332: }
333: }
334:
335: //
336: // state:
337: //
338: public String getState() {
339: return this .state;
340: }
341:
342: public void setState(String state) {
343: if (record2().setObject(ICOL_STATE, state)) {
344: this .state = state;
345: }
346: }
347:
348: public boolean izNullState() {
349: return record2().getObject(ICOL_STATE) == null;
350: }
351:
352: public void setNullState() {
353: if (record2().setObject(ICOL_STATE, null)) {
354: this .state = null;
355: }
356: }
357:
358: //
359: // lastUpdated:
360: //
361: public Date getLastUpdated() {
362: return this .lastUpdated;
363: }
364:
365: public void setLastUpdated(Date lastUpdated) {
366: if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
367: this .lastUpdated = lastUpdated;
368: }
369: }
370:
371: public boolean izNullLastUpdated() {
372: return record2().getObject(ICOL_LAST_UPDATED) == null;
373: }
374:
375: public void setNullLastUpdated() {
376: if (record2().setObject(ICOL_LAST_UPDATED, null)) {
377: this .lastUpdated = null;
378: }
379: }
380:
381: //
382: // creationDate:
383: //
384: public Date getCreationDate() {
385: return this .creationDate;
386: }
387:
388: public void setCreationDate(Date creationDate) {
389: if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
390: this .creationDate = creationDate;
391: }
392: }
393:
394: public boolean izNullCreationDate() {
395: return record2().getObject(ICOL_CREATION_DATE) == null;
396: }
397:
398: public void setNullCreationDate() {
399: if (record2().setObject(ICOL_CREATION_DATE, null)) {
400: this .creationDate = null;
401: }
402: }
403:
404: public void toBeanFields() {
405: toBeanFields(this );
406: }
407:
408: public void toBeanFields(PersistentObject from) {
409: orderItemId = (Long) from.record2().getObject(
410: ICOL_ORDER_ITEM_ID);
411: orderId = (Long) from.record2().getObject(ICOL_ORDER_ID);
412: productId = (Long) from.record2().getObject(ICOL_PRODUCT_ID);
413: quantity = (Long) from.record2().getObject(ICOL_QUANTITY);
414: state = (String) from.record2().getObject(ICOL_STATE);
415: lastUpdated = (Date) from.record2()
416: .getObject(ICOL_LAST_UPDATED);
417: creationDate = (Date) from.record2().getObject(
418: ICOL_CREATION_DATE);
419: super .toBeanFields(from);
420: }
421:
422: public void fromBeanFields(PersistentObject persistentObject) {
423: OrderItemPO from = (OrderItemPO) persistentObject;
424: record2().getEntry(ICOL_ORDER_ITEM_ID).setUnmarkedValue(
425: from.orderItemId, from.orderItemId);
426: record2().getEntry(ICOL_ORDER_ID).setUnmarkedValue(
427: from.orderId, from.orderId);
428: record2().getEntry(ICOL_PRODUCT_ID).setUnmarkedValue(
429: from.productId, from.productId);
430: record2().getEntry(ICOL_QUANTITY).setUnmarkedValue(
431: from.quantity, from.quantity);
432: record2().getEntry(ICOL_STATE).setUnmarkedValue(from.state,
433: from.state);
434: record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
435: from.lastUpdated, from.lastUpdated);
436: record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
437: from.creationDate, from.creationDate);
438: super .fromBeanFieldsDataSaved(persistentObject);
439: }
440:
441: public String toString() {
442:
443: StringBuffer buffer = new StringBuffer();
444: buffer.append("{ " + "class = ").append(
445: this .getClass().getName()).append(" " + "table = ")
446: .append(TABLE_ORDER_ITEM).append(" columns = {");
447:
448: if (record() != null) {
449: buffer.append(COL_ORDER_ITEM_ID).append(" = ").append(
450: record().getObject(ICOL_ORDER_ITEM_ID)).append(" ");
451: buffer.append(COL_ORDER_ID).append(" = ").append(
452: record().getObject(ICOL_ORDER_ID)).append(" ");
453: buffer.append(COL_PRODUCT_ID).append(" = ").append(
454: record().getObject(ICOL_PRODUCT_ID)).append(" ");
455: buffer.append(COL_QUANTITY).append(" = ").append(
456: record().getObject(ICOL_QUANTITY)).append(" ");
457: buffer.append(COL_STATE).append(" = ").append(
458: record().getObject(ICOL_STATE)).append(" ");
459: buffer.append(COL_LAST_UPDATED).append(" = ").append(
460: record().getObject(ICOL_LAST_UPDATED)).append(" ");
461: buffer.append(COL_CREATION_DATE).append(" = ").append(
462: record().getObject(ICOL_CREATION_DATE)).append(" ");
463: } else {
464: buffer.append(COL_ORDER_ITEM_ID).append(" = ").append(
465: orderItemId).append(" ");
466: buffer.append(COL_ORDER_ID).append(" = ").append(orderId)
467: .append(" ");
468: buffer.append(COL_PRODUCT_ID).append(" = ").append(
469: productId).append(" ");
470: buffer.append(COL_QUANTITY).append(" = ").append(quantity)
471: .append(" ");
472: buffer.append(COL_STATE).append(" = ").append(state)
473: .append(" ");
474: buffer.append(COL_LAST_UPDATED).append(" = ").append(
475: lastUpdated).append(" ");
476: buffer.append(COL_CREATION_DATE).append(" = ").append(
477: creationDate).append(" ");
478: }
479: buffer.append("}}");
480: return buffer.toString();
481: }
482:
483: // naturalKey has no context
484:
485: /**
486: * Equals by Basic Peristent object fields (without children objects)
487: */
488: public boolean equalsBasic(Object value) {
489: if (this == value)
490: return true;
491: if (value == null || getClass() != value.getClass())
492: return false;
493:
494: OrderItemPO that = (OrderItemPO) value;
495:
496: if (orderItemId != null ? !orderItemId.equals(that.orderItemId)
497: : that.orderItemId != null)
498: return false;
499: if (orderId != null ? !orderId.equals(that.orderId)
500: : that.orderId != null)
501: return false;
502: if (productId != null ? !productId.equals(that.productId)
503: : that.productId != null)
504: return false;
505: if (quantity != null ? !quantity.equals(that.quantity)
506: : that.quantity != null)
507: return false;
508: if (state != null ? !state.equals(that.state)
509: : that.state != null)
510: return false;
511: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
512: : that.lastUpdated != null)
513: return false;
514: if (creationDate != null ? !creationDate
515: .equals(that.creationDate) : that.creationDate != null)
516: return false;
517: return true;
518: }
519:
520: /**
521: * hashCode by Basic Peristent object fields (without children objects)
522: */
523: public int hashCodeBasic() {
524: int result;
525: long temp;
526: result = (orderItemId != null ? orderItemId.hashCode() : 0);
527: result = 29 * result
528: + (orderId != null ? orderId.hashCode() : 0);
529: result = 29 * result
530: + (productId != null ? productId.hashCode() : 0);
531: result = 29 * result
532: + (quantity != null ? quantity.hashCode() : 0);
533: result = 29 * result + (state != null ? state.hashCode() : 0);
534: result = 29 * result
535: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
536: result = 29 * result
537: + (creationDate != null ? creationDate.hashCode() : 0);
538:
539: return result;
540: }
541: }
|