y"> (int Primary Key NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), varchar (100) not null CHECK (LENGTH (Name) gt; 0), UK_Employee_Name UNIQUE (Name)
); table ADMIN.Product
(int Primary Key NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), varchar (100) not null CHECK (LENGTH (Name) gt; 0), varchar (100), int not null default 0, UK_Product_Name UNIQUE (Name)
); table ADMIN.Shipment
(int Primary Key NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), int not null, int not null, Timestamp, int not null, FK_Shiment_Product Foreign Key (ProductId) References Product (Id), FK_Shiment_Employee Foreign Key (ResponsiblePersonId) References Employee (Id)
); into ADMIN.EMPLOYEE (Name) ( James Winkles ); into ADMIN.EMPLOYEE (Name) ( John Snipes ); into ADMIN.EMPLOYEE (Name) ( Gregory House ); into ADMIN.EMPLOYEE (Name) ( Jessica Gamilton ); into ADMIN.EMPLOYEE (Name) ( Sarah Daniels ); into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock) ( Strepsils raquo ;, Ecoemical Inc. raquo ;, 500); into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock) ( Tera Flu raquo ;, Bio Pharm raquo ;, 700); into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock ) ( Vikodin raquo ;, Biogeticals raquo ;, 300); into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock) ( Coldrex raquo ;, Green Generation raquo ;, +1000); into ADMIN.PRODUCT (Name, Manufacturer, QuantityInStock) ( Ascorbic acid raquo ;, Ecoemical Inc. raquo ;, 2000); into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId) (1, 200, TIMESTAMP ( 20.03.2011 raquo ;, 12:00: 00 ), 1); into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId) (2, 400, TIMESTAMP ( 20.03.2011 raquo ;, 13: 00: 00 ), 1); into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId) (1, 100, TIMESTAMP ( 20.03.2011 raquo ;, 14: 00: 00 ), 3); into ADMIN.Shipment (ProductId, Quantity, DateTime , ResponsiblePersonId) (3, 300, TIMESTAMP ( 20.03.2011 raquo ;, 15: 00: 00 ), 2); into ADMIN.Shipment (ProductId, Quantity, DateTime, ResponsiblePersonId) (5, 500, TIMESTAMP ( 20.03.2011 raquo ;, 16: 00: 00 ), 5);
Додаток Б
Листинги вихідних кодів класів клієнтської частини ПО
Класи-сутності
package Entities;java.io.Serializable;java.util.List;javax.persistence.Basic;javax.persistence.CascadeType;javax.persistence.Column;javax.persistence.Entity;javax.persistence.GeneratedValue;javax.persistence.GenerationType;javax.persistence.Id;javax.persistence.NamedQueries;javax.persistence.NamedQuery;javax.persistence.OneToMany;javax.persistence.Table;
/**
*
*author Humanity
*/
@ Entity
@ Table (name= EMPLOYEE )
@ NamedQueries ({@ NamedQuery (name= Employee.findAll raquo ;, query= SELECT e FROM Employee e ),NamedQuery (name= Employee.findById raquo ;, query= SELECT e FROM Employee e WHERE e.id =: id ),NamedQuery (name= Employee.findByName raquo ;, query= SELECT e FROM Employee e WHERE e.name =: name )}) class Employee implements Serializable {static final long serialVersionUID=1L;
@ Id
@ GeneratedValue (strategy=GenerationType.IDENTITY)
@ Basic (optional=false)
@ Column (name= ID ) Integer id;
@ Basic (optional=false)
@ Column (name= NAME ) String name;
@ OneToMany (cascade=CascadeType.ALL, mappedBy= responsiblepersonid ) List lt; Shipment gt; shipmentList; Employee () {
} Employee (Integer id) {.id=id;
} Employee (Integer id, String name) {.id=id; .name=name;
} Integer getId () {id;
} void setId (Integer id) {.id=id;
} String getName () {name;
} void setName (String name) {.name=name;
} List lt; Shipment gt; getShipmentList () {shipmentList;
} void setShipmentList (List lt; Shipment gt; shipmentList) {.shipmentList=shipmentList;
}
@ Overrideint hashCode () {hash=0; +=(id!=null? id.hashCode (): 0); hash;
}
@ Overrideboolean equals (Object object) {
//TODO: Warning - this method will not work in the case the id fields are not set (! (object instanceof Employee)) {false;
} other=(Employee) object; ((this.id == null amp; amp; ...