/* * Created on: 24-Jan-2006 * Author: Dibyendu Majumdar */ package schema1.entity.tpcc; import java.sql.Timestamp; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Version; @Entity @Table(name = "ORDER_HDR", schema = "TPCC") @IdClass(schema1.entity.tpcc.Order.OrderPK.class) public class Order { int orderId; int districtId; int warehouseId; int customerId; int version; Timestamp entryDateTime; int carrierId; int orderLinesCount; int allLocal; Customer customer; @Column(name="O_ALL_LOCAL") public int getAllLocal() { return allLocal; } @Column(name="O_CARRIER_ID") public int getCarrierId() { return carrierId; } @Column(name="O_C_ID", nullable=false, insertable=false, updatable=false) public int getCustomerId() { return customerId; } @Id @Column(name="O_D_ID", nullable=false, insertable=false, updatable=false) public int getDistrictId() { return districtId; } @Column(name="O_ENTRY_D") @Temporal(TemporalType.TIMESTAMP) public Timestamp getEntryDateTime() { return entryDateTime; } @Id @Column(name="O_ID", nullable=false) @TableGenerator(name = "ORDER_ID_SEQUENCE", table = "IDGENERATOR", schema = "TPCC", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "ORDER_ID_SEQUENCE", initialValue=1, allocationSize=10) @GeneratedValue(strategy = GenerationType.TABLE, generator = "ORDER_ID_SEQUENCE") public int getOrderId() { return orderId; } @Column(name="O_OL_CNT") public int getOrderLinesCount() { return orderLinesCount; } @Version @Column(name="O_VERSION") public int getVersion() { return version; } @Id @Column(name="O_W_ID", nullable=false, insertable=false, updatable=false) public int getWarehouseId() { return warehouseId; } @ManyToOne @JoinColumns({ @JoinColumn(name="O_W_ID", referencedColumnName="C_W_ID"), @JoinColumn(name="O_D_ID", referencedColumnName="C_D_ID"), @JoinColumn(name="O_C_ID", referencedColumnName="C_ID") }) public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public void setAllLocal(int allLocal) { this.allLocal = allLocal; } public void setCarrierId(int carrierId) { this.carrierId = carrierId; } public void setCustomerId(int customerId) { this.customerId = customerId; } public void setDistrictId(int districtId) { this.districtId = districtId; } public void setEntryDateTime(Timestamp entryDateTime) { this.entryDateTime = entryDateTime; } public void setOrderId(int orderId) { this.orderId = orderId; } public void setOrderLinesCount(int orderLinesCount) { this.orderLinesCount = orderLinesCount; } public void setVersion(int version) { this.version = version; } public void setWarehouseId(int warehouseId) { this.warehouseId = warehouseId; } public static class OrderPK { int warehouseId; int districtId; int orderId; public int getDistrictId() { return districtId; } public int getOrderId() { return orderId; } public int getWarehouseId() { return warehouseId; } public void setDistrictId(int districtId) { this.districtId = districtId; } public void setOrderId(int orderId) { this.orderId = orderId; } public void setWarehouseId(int warehouseId) { this.warehouseId = warehouseId; } } }