Build a Web Application (JSF) Using JPA (OTN's Tutorial)
Performing steps advised by :
JPA tutorial at OTN
I was experiencing the only one issue with command
$ ant -f build.xml generate-tables
and had to create schema through SQLPLUS
CREATE TABLE INVENTORY (COST NUMBER(19,4) NULL, PRICE NUMBER(19,4) NULL,
QUANTITY NUMBER(10) NULL, VERSION NUMBER(10) NULL,
ITEM_SKU NUMBER(19) NOT NULL, PRIMARY KEY (ITEM_SKU));
CREATE TABLE ORDER_TABLE (ORDERID NUMBER(19) NOT NULL,
CURRENTLOCATION VARCHAR2(255) NULL, QUANTITY NUMBER(10) NULL,
ARRIVALDATE DATE NULL, VERSION NUMBER(10) NULL,
ORDERINITIATED DATE NULL, ITEM_SKU NUMBER(19) NULL, PRIMARY KEY (ORDERID));
CREATE TABLE ITEM (SKU NUMBER(19) NOT NULL, NAME VARCHAR2(255) NULL,
CATEGORY VARCHAR2(255) NULL, VERSION NUMBER(10) NULL,
DESCRIPTION VARCHAR2(255) NULL, PRIMARY KEY (SKU));
ALTER TABLE INVENTORY ADD CONSTRAINT FK_INVENTORY_ITEM_SKU FOREIGN KEY (ITEM_SKU)
REFERENCES ITEM (SKU);
ALTER TABLE ORDER_TABLE ADD CONSTRAINT FK_ORDER_TABLE_ITEM_SKU FOREIGN KEY (ITEM_SKU)
REFERENCES ITEM (SKU);
CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR2(50) NOT NULL,
SEQ_COUNT NUMBER(38) NULL, PRIMARY KEY (SEQ_NAME));
INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0);
COMMIT;
CREATE TABLE INVENTORY (COST NUMBER(19,4) NULL, PRICE NUMBER(19,4) NULL,
QUANTITY NUMBER(10) NULL, VERSION NUMBER(10) NULL,
ITEM_SKU NUMBER(19) NOT NULL, PRIMARY KEY (ITEM_SKU));
CREATE TABLE ORDER_TABLE (ORDERID NUMBER(19) NOT NULL,
CURRENTLOCATION VARCHAR2(255) NULL, QUANTITY NUMBER(10) NULL,
ARRIVALDATE DATE NULL, VERSION NUMBER(10) NULL,
ORDERINITIATED DATE NULL, ITEM_SKU NUMBER(19) NULL, PRIMARY KEY (ORDERID));
CREATE TABLE ITEM (SKU NUMBER(19) NOT NULL, NAME VARCHAR2(255) NULL,
CATEGORY VARCHAR2(255) NULL, VERSION NUMBER(10) NULL,
DESCRIPTION VARCHAR2(255) NULL, PRIMARY KEY (SKU));
ALTER TABLE INVENTORY ADD CONSTRAINT FK_INVENTORY_ITEM_SKU FOREIGN KEY (ITEM_SKU)
REFERENCES ITEM (SKU);
ALTER TABLE ORDER_TABLE ADD CONSTRAINT FK_ORDER_TABLE_ITEM_SKU FOREIGN KEY (ITEM_SKU)
REFERENCES ITEM (SKU);
CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR2(50) NOT NULL,
SEQ_COUNT NUMBER(38) NULL, PRIMARY KEY (SEQ_NAME));
INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0);
COMMIT;
As was advised by Gordon Yorke at OTN Toplink Forum (05/25/06)
glassfish-persistence-installer-v2-b01.jar was replaced by glassfish-persistence-installer-v2-b03.jar
The replacement resolves the issue.
It also runs fine with the same oracle database credentials simply recreating the schema.
Actually , sequence of builds:-
ant -f build.xml generate-tables
ant -f build.xml populate-data
ant -f build.xml package.webapp