--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements.  See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License.  You may obtain a copy of the License at
--
--    http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- $Rev$ $Date$
--

CREATE TABLE J3_PERSON_NAME (
    ID BIGINT NOT NULL,
    LANG_CODE VARCHAR(5),
    NAME VARCHAR(255) NOT NULL,
    CONTACT_ID BIGINT NOT NULL
  );

CREATE TABLE J3_TRANSFER_TOKEN (
    TRANSFER_TOKEN VARCHAR(51) NOT NULL,
    EXPIRATION_DATE TIMESTAMP NOT NULL
  );

CREATE TABLE J3_ADDRESS_LINE (
    ID BIGINT NOT NULL,
    KEY_NAME VARCHAR(255),
    KEY_VALUE VARCHAR(255),
    LINE VARCHAR(80) NOT NULL,
    ADDRESS_ID BIGINT NOT NULL
  );

CREATE TABLE J3_INSTANCE_DETAILS_DOC_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    TMODEL_INSTANCE_INFO_ID BIGINT NOT NULL
  );

CREATE TABLE J3_OVERVIEW_DOC_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    OVERVIEW_DOC_ID BIGINT
  );

CREATE TABLE J3_PUBLISHER (
    AUTHORIZED_NAME VARCHAR(255) NOT NULL,
    EMAIL_ADDRESS VARCHAR(255),
    IS_ADMIN VARCHAR(5),
    IS_ENABLED VARCHAR(5),
    MAX_BINDINGS_PER_SERVICE INTEGER,
    MAX_BUSINESSES INTEGER,
    MAX_SERVICES_PER_BUSINESS INTEGER,
    MAX_TMODELS INTEGER,
    PUBLISHER_NAME VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_PUBLISHER_ASSERTION (
    FROM_KEY VARCHAR(255) NOT NULL,
    TO_KEY VARCHAR(255) NOT NULL,
    FROM_CHECK VARCHAR(5) NOT NULL,
    KEY_NAME VARCHAR(255) NOT NULL,
    KEY_VALUE VARCHAR(255) NOT NULL,
    TMODEL_KEY VARCHAR(255) NOT NULL,
    TO_CHECK VARCHAR(5) NOT NULL
  );

CREATE TABLE J3_ADDRESS (
    ID BIGINT NOT NULL,
    SORT_CODE VARCHAR(10),
    TMODEL_KEY VARCHAR(255),
    USE_TYPE VARCHAR(255),
    ADDRESS_ID BIGINT NOT NULL
  );

CREATE TABLE J3_UDDI_ENTITY (
    ENTITY_KEY VARCHAR(255) NOT NULL,
    AUTHORIZED_NAME VARCHAR(255) NOT NULL,
    CREATED TIMESTAMP,
    MODIFIED TIMESTAMP NOT NULL,
    MODIFIED_INCLUDING_CHILDREN TIMESTAMP,
    NODE_ID VARCHAR(255)
  );

CREATE TABLE J3_SUBSCRIPTION (
    SUBSCRIPTION_KEY VARCHAR(255) NOT NULL,
    AUTHORIZED_NAME VARCHAR(255) NOT NULL,
    BINDING_KEY VARCHAR(255),
    BRIEF SMALLINT,
    CREATE_DATE TIMESTAMP NOT NULL,
    EXPIRES_AFTER TIMESTAMP,
    LAST_NOTIFIED TIMESTAMP,
    MAX_ENTITIES INTEGER,
    NOTIFICATION_INTERVAL VARCHAR(255),
    SUBSCRIPTION_FILTER CLOB(2147483647) NOT NULL
  );

CREATE TABLE J3_BUSINESS_SERVICE (
    ENTITY_KEY VARCHAR(255) NOT NULL,
    BUSINESS_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BUSINESS_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BUSINESS_CATEGORY_BAG (
    ID BIGINT NOT NULL,
    ENTITY_KEY VARCHAR(255)
  );

CREATE TABLE J3_CLIENT_SUBSCRIPTIONINFO (
    SUBSCRIPTION_KEY VARCHAR(255) NOT NULL,
    LAST_NOTIFIED TIMESTAMP,
    FROMCLERK_CLERK_NAME VARCHAR(255),
    TOCLERK_CLERK_NAME VARCHAR(255)
  );

CREATE TABLE J3_KEYED_REFERENCE_GROUP (
    ID BIGINT NOT NULL,
    TMODEL_KEY VARCHAR(255),
    CATEGORY_BAG_ID BIGINT NOT NULL
  );

CREATE TABLE J3_CONTACT (
    ID BIGINT NOT NULL,
    USE_TYPE VARCHAR(255),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_TMODEL (
    ENTITY_KEY VARCHAR(255) NOT NULL,
    DELETED SMALLINT,
    LANG_CODE VARCHAR(5),
    NAME VARCHAR(255) NOT NULL
  );

CREATE TABLE OPENJPA_SEQUENCE_TABLE (
    ID SMALLINT NOT NULL,
    SEQUENCE_VALUE BIGINT
  );

CREATE TABLE J3_OVERVIEW_DOC (
    ID BIGINT NOT NULL,
    OVERVIEW_URL VARCHAR(255),
    OVERVIEW_URL_USE_TYPE VARCHAR(255),
    ENTITY_KEY VARCHAR(255),
    TOMODEL_INSTANCE_INFO_ID BIGINT
  );

CREATE TABLE J3_TMODEL_INSTANCE_INFO (
    ID BIGINT NOT NULL,
    INSTANCE_PARMS VARCHAR(512),
    TMODEL_KEY VARCHAR(255) NOT NULL,
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_INSTANCE_DETAILS_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    TMODEL_INSTANCE_INFO_ID BIGINT NOT NULL
  );

CREATE TABLE J3_TMODEL_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_SUBSCRIPTION_MATCH (
    ID BIGINT NOT NULL,
    ENTITY_KEY VARCHAR(255) NOT NULL,
    SUBSCRIPTION_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BINDING_CATEGORY_BAG (
    ID BIGINT NOT NULL,
    ENTITY_KEY VARCHAR(255)
  );

CREATE TABLE J3_EMAIL (
    ID BIGINT NOT NULL,
    EMAIL_ADDRESS VARCHAR(255) NOT NULL,
    USE_TYPE VARCHAR(255),
    CONTACT_ID BIGINT NOT NULL
  );

CREATE TABLE J3_SERVICE_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_PHONE (
    ID BIGINT NOT NULL,
    PHONE_NUMBER VARCHAR(50) NOT NULL,
    USE_TYPE VARCHAR(255),
    CONTACT_ID BIGINT NOT NULL
  );

CREATE TABLE J3_TMODEL_INSTANCE_INFO_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    TMODEL_INSTANCE_INFO_ID BIGINT NOT NULL
  );

CREATE TABLE J3_CLERK (
    CLERK_NAME VARCHAR(255) NOT NULL,
    CRED VARCHAR(255),
    PUBLISHER_ID VARCHAR(255) NOT NULL,
    NODE_NAME VARCHAR(255)
  );

CREATE TABLE J3_TMODEL_CATEGORY_BAG (
    ID BIGINT NOT NULL,
    ENTITY_KEY VARCHAR(255)
  );

CREATE TABLE J3_BINDING_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_TRANSFER_TOKEN_KEYS (
    ID BIGINT NOT NULL,
    ENTITY_KEY VARCHAR(255),
    TRANSFER_TOKEN VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_DISCOVERY_URL (
    ID BIGINT NOT NULL,
    URL VARCHAR(255) NOT NULL,
    USE_TYPE VARCHAR(255) NOT NULL,
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_TMODEL_IDENTIFIER (
    ID BIGINT NOT NULL,
    KEY_NAME VARCHAR(255),
    KEY_VALUE VARCHAR(255) NOT NULL,
    TMODEL_KEY_REF VARCHAR(255),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_CONTACT_DESCR (
    ID BIGINT NOT NULL,
    DESCR VARCHAR(1024) NOT NULL,
    LANG_CODE VARCHAR(5),
    CONTACT_ID BIGINT NOT NULL
  );

CREATE TABLE J3_CATEGORY_BAG (
    ID BIGINT NOT NULL
  );

CREATE TABLE J3_SERVICE_PROJECTION (
    BUSINESS_KEY VARCHAR(255) NOT NULL,
    SERVICE_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BUSINESS_NAME (
    ID BIGINT NOT NULL,
    LANG_CODE VARCHAR(5),
    NAME VARCHAR(255) NOT NULL,
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_SERVICE_CATEGORY_BAG (
    ID BIGINT NOT NULL,
    ENTITY_KEY VARCHAR(255)
  );

CREATE TABLE J3_NODE (
    NAME VARCHAR(255) NOT NULL,
    CUSTODY_TRANSFER_URL VARCHAR(255) NOT NULL,
    FACTORY_INITIAL VARCHAR(255),
    FACTORY_NAMING_PROVIDER VARCHAR(255),
    FACTORY_URL_PKGS VARCHAR(255),
    INQUIRY_URL VARCHAR(255) NOT NULL,
    JUDDI_API_URL VARCHAR(255),
    MANAGER_NAME VARCHAR(255) NOT NULL,
    PROXY_TRANSPORT VARCHAR(255) NOT NULL,
    PUBLISH_URL VARCHAR(255) NOT NULL,
    SECURITY_URL VARCHAR(255) NOT NULL,
    SUBSCRIPTION_URL VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BINDING_TEMPLATE (
    ENTITY_KEY VARCHAR(255) NOT NULL,
    ACCESS_POINT_TYPE VARCHAR(255),
    ACCESS_POINT_URL VARCHAR(4000),
    HOSTING_REDIRECTOR VARCHAR(255),
    SERVICE_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_KEYED_REFERENCE (
    ID BIGINT NOT NULL,
    KEY_NAME VARCHAR(255),
    KEY_VALUE VARCHAR(255) NOT NULL,
    TMODEL_KEY_REF VARCHAR(255),
    CATEGORY_BAG_ID BIGINT,
    KEYED_REFERENCE_GROUP_ID BIGINT
  );

CREATE TABLE J3_AUTH_TOKEN (
    AUTH_TOKEN VARCHAR(51) NOT NULL,
    AUTHORIZED_NAME VARCHAR(255) NOT NULL,
    CREATED TIMESTAMP NOT NULL,
    LAST_USED TIMESTAMP NOT NULL,
    NUMBER_OF_USES INTEGER NOT NULL,
    TOKEN_STATE INTEGER NOT NULL
  );

CREATE TABLE J3_SUBSCRIPTION_CHUNK_TOKEN (
    CHUNK_TOKEN VARCHAR(255) NOT NULL,
    DATA INTEGER NOT NULL,
    END_POINT TIMESTAMP,
    EXPIRES_AFTER TIMESTAMP NOT NULL,
    START_POINT TIMESTAMP,
    SUBSCRIPTION_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_SERVICE_NAME (
    ID BIGINT NOT NULL,
    LANG_CODE VARCHAR(5),
    NAME VARCHAR(255) NOT NULL,
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BUSINESS_IDENTIFIER (
    ID BIGINT NOT NULL,
    KEY_NAME VARCHAR(255),
    KEY_VALUE VARCHAR(255) NOT NULL,
    TMODEL_KEY_REF VARCHAR(255),
    ENTITY_KEY VARCHAR(255) NOT NULL
  );

CREATE TABLE J3_BUSINESS_ENTITY (
    ENTITY_KEY VARCHAR(255) NOT NULL
  );


INSERT INTO J3_TMODEL ("ENTITY_KEY", "DELETED", "LANG_CODE", "NAME") 
VALUES ('uddi:juddi.apache.org:keygenerator1', 0, null, 'uddi-org:keyGenerator1');

INSERT INTO J3_UDDI_ENTITY ("ENTITY_KEY", "AUTHORIZED_NAME", "CREATED", "MODIFIED", "MODIFIED_INCLUDING_CHILDREN", "NODE_ID") 
values('uddi:juddi.apache.org:keygenerator1', 'root', CURRENT TIMESTAMP, CURRENT TIMESTAMP, CURRENT TIMESTAMP, 'uddi:juddi.apache.org:businesses-asf');


CREATE INDEX I_J3_TSCR_TMODEL ON J3_TMODEL_DESCR (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160128000 ON J3_TMODEL (ENTITY_KEY ASC);

CREATE INDEX I_J3_PHON_CONTACT ON J3_PHONE (CONTACT_ID ASC);

CREATE INDEX I_J3_BRVC_BUSINESSENTITY ON J3_BUSINESS_SERVICE (BUSINESS_KEY ASC);

CREATE INDEX I_J3_S_NM_BUSINESSSERVICE ON J3_SERVICE_NAME (ENTITY_KEY ASC);

CREATE INDEX I_J3_CNNF_TOCLERK ON J3_CLIENT_SUBSCRIPTIONINFO (TOCLERK_CLERK_NAME ASC);

CREATE UNIQUE INDEX SQL101221160121420 ON J3_CLIENT_SUBSCRIPTIONINFO (SUBSCRIPTION_KEY ASC);

CREATE INDEX I_J3_BSCR_BINDINGTEMPLATE ON J3_BINDING_DESCR (ENTITY_KEY ASC);

CREATE INDEX I_J3_DRSS_CONTACT ON J3_ADDRESS (ADDRESS_ID ASC);

CREATE UNIQUE INDEX SQL101221160120410 ON J3_BUSINESS_NAME (ID ASC);

CREATE UNIQUE INDEX SQL101221160126530 ON J3_SERVICE_PROJECTION (BUSINESS_KEY ASC, SERVICE_KEY ASC);

CREATE INDEX I_J3_P_NM_CONTACT ON J3_PERSON_NAME (CONTACT_ID ASC);

CREATE UNIQUE INDEX SQL101221160129560 ON J3_TRANSFER_TOKEN (TRANSFER_TOKEN ASC);

CREATE UNIQUE INDEX SQL101221160123590 ON J3_KEYED_REFERENCE_GROUP (ID ASC);

CREATE INDEX I_J3_VSCR_OVERVIEWDOC ON J3_OVERVIEW_DOC_DESCR (OVERVIEW_DOC_ID ASC);

CREATE UNIQUE INDEX SQL101221160129830 ON J3_TRANSFER_TOKEN_KEYS (ID ASC);

CREATE UNIQUE INDEX SQL101221160126780 ON J3_SUBSCRIPTION (SUBSCRIPTION_KEY ASC);

CREATE UNIQUE INDEX SQL101221160118890 ON J3_BINDING_DESCR (ID ASC);

CREATE INDEX I_J3_CTCT_BUSINESSENTITY ON J3_CONTACT (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160123870 ON J3_NODE (NAME ASC);

CREATE UNIQUE INDEX SQL101221160128670 ON J3_TMODEL_IDENTIFIER (ID ASC);

CREATE UNIQUE INDEX SQL101221160122440 ON J3_EMAIL (ID ASC);

CREATE UNIQUE INDEX SQL101221160124160 ON J3_OVERVIEW_DOC (ID ASC);

CREATE INDEX I_J3_TSCR_TMODELINSTANCEINFO ON J3_TMODEL_INSTANCE_INFO_DESCR (TMODEL_INSTANCE_INFO_ID ASC);

CREATE UNIQUE INDEX SQL101221160130130 ON J3_UDDI_ENTITY (ENTITY_KEY ASC);

CREATE INDEX I_J3_NSCR_TMODELINSTANCEINFO ON J3_INSTANCE_DETAILS_DESCR (TMODEL_INSTANCE_INFO_ID ASC);

CREATE UNIQUE INDEX SQL101221160125640 ON J3_PUBLISHER_ASSERTION (FROM_KEY ASC, TO_KEY ASC);

CREATE UNIQUE INDEX SQL101221160119730 ON J3_BUSINESS_DESCR (ID ASC);

CREATE UNIQUE INDEX SQL101221160119500 ON J3_BUSINESS_CATEGORY_BAG (ID ASC);

CREATE UNIQUE INDEX SQL101221160127550 ON J3_SUBSCRIPTION_CHUNK_TOKEN (CHUNK_TOKEN ASC);

CREATE UNIQUE INDEX SQL101221160126090 ON J3_SERVICE_DESCR (ID ASC);

CREATE INDEX I_J3_BTFR_BUSINESSENTITY ON J3_BUSINESS_IDENTIFIER (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160120180 ON J3_BUSINESS_IDENTIFIER (ID ASC);

CREATE UNIQUE INDEX SQL101221160128210 ON J3_TMODEL_CATEGORY_BAG (ID ASC);

CREATE INDEX I_J3_BSCR_BUSINESSENTITY ON J3_BUSINESS_DESCR (ENTITY_KEY ASC);

CREATE INDEX I_J3_BPLT_BUSINESSSERVICE ON J3_BINDING_TEMPLATE (SERVICE_KEY ASC);

CREATE INDEX I_J3_T_NF_BINDINGTEMPLATE ON J3_TMODEL_INSTANCE_INFO (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160118450 ON J3_AUTH_TOKEN (AUTH_TOKEN ASC);

CREATE INDEX I_J3_B_BG_BINDINGTEMPLATE ON J3_BINDING_CATEGORY_BAG (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160120860 ON J3_CATEGORY_BAG (ID ASC);

CREATE INDEX I_J3_V_DC_TMODEL ON J3_OVERVIEW_DOC (ENTITY_KEY ASC);

CREATE INDEX I_J3_S_BG_BUSINESSSERVICE ON J3_SERVICE_CATEGORY_BAG (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160123320 ON J3_KEYED_REFERENCE (ID ASC);

CREATE UNIQUE INDEX SQL101221160121930 ON J3_CONTACT_DESCR (ID ASC);

CREATE UNIQUE INDEX SQL101221160121170 ON J3_CLERK (CLERK_NAME ASC);

CREATE UNIQUE INDEX SQL101221160127780 ON J3_SUBSCRIPTION_MATCH (ID ASC);

CREATE UNIQUE INDEX SQL101221160120640 ON J3_BUSINESS_SERVICE (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160128950 ON J3_TMODEL_INSTANCE_INFO (ID ASC);

CREATE INDEX I_J3_CLRK_NODE ON J3_CLERK (NODE_NAME ASC);

CREATE INDEX I_J3_STCH_SUBSCRIPTION ON J3_SUBSCRIPTION_MATCH (SUBSCRIPTION_KEY ASC);

CREATE UNIQUE INDEX SQL101221160119940 ON J3_BUSINESS_ENTITY (ENTITY_KEY ASC);

CREATE INDEX I_J3_EMIL_CONTACT ON J3_EMAIL (CONTACT_ID ASC);

CREATE UNIQUE INDEX SQL101221160118210 ON J3_ADDRESS_LINE (ID ASC);

CREATE UNIQUE INDEX SQL101221160128420 ON J3_TMODEL_DESCR (ID ASC);

CREATE INDEX I_J3_T_BG_TMODEL ON J3_TMODEL_CATEGORY_BAG (ENTITY_KEY ASC);

CREATE INDEX I_J3_KRNC_CATEGORYBAG ON J3_KEYED_REFERENCE (CATEGORY_BAG_ID ASC);

CREATE UNIQUE INDEX SQL101221160126300 ON J3_SERVICE_NAME (ID ASC);

CREATE UNIQUE INDEX SQL101221160125370 ON J3_PUBLISHER (AUTHORIZED_NAME ASC);

CREATE INDEX I_J3_SSCR_BUSINESSSERVICE ON J3_SERVICE_DESCR (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160122740 ON J3_INSTANCE_DETAILS_DESCR (ID ASC);

CREATE UNIQUE INDEX SQL101221160129300 ON J3_TMODEL_INSTANCE_INFO_DESCR (ID ASC);

CREATE INDEX I_J3_KRNC_KEYEDREFERENCEGROUP ON J3_KEYED_REFERENCE (KEYED_REFERENCE_GROUP_ID ASC);

CREATE INDEX I_J3_B_NM_BUSINESSENTITY ON J3_BUSINESS_NAME (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160125870 ON J3_SERVICE_CATEGORY_BAG (ID ASC);

CREATE INDEX I_J3_D_LN_ADDRESS ON J3_ADDRESS_LINE (ADDRESS_ID ASC);

CREATE INDEX I_J3_TTFR_TMODEL ON J3_TMODEL_IDENTIFIER (ENTITY_KEY ASC);

CREATE INDEX I_J3_NSCR_TMODELINSTANCEINFO1 ON J3_INSTANCE_DETAILS_DOC_DESCR (TMODEL_INSTANCE_INFO_ID ASC);

CREATE UNIQUE INDEX SQL101221160124440 ON J3_OVERVIEW_DOC_DESCR (ID ASC);

CREATE UNIQUE INDEX SQL101221160124690 ON J3_PERSON_NAME (ID ASC);

CREATE INDEX I_J3_CNNF_FROMCLERK ON J3_CLIENT_SUBSCRIPTIONINFO (FROMCLERK_CLERK_NAME ASC);

CREATE UNIQUE INDEX SQL101221160119280 ON J3_BINDING_TEMPLATE (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160117940 ON J3_ADDRESS (ID ASC);

CREATE INDEX I_J3_KGRP_CATEGORYBAG ON J3_KEYED_REFERENCE_GROUP (CATEGORY_BAG_ID ASC);

CREATE UNIQUE INDEX SQL101221160124970 ON J3_PHONE (ID ASC);

CREATE UNIQUE INDEX SQL101221160130460 ON OPENJPA_SEQUENCE_TABLE (ID ASC);

CREATE UNIQUE INDEX SQL101221160123010 ON J3_INSTANCE_DETAILS_DOC_DESCR (ID ASC);

CREATE INDEX I_J3_CSCR_CONTACT ON J3_CONTACT_DESCR (CONTACT_ID ASC);

CREATE UNIQUE INDEX SQL101221160121690 ON J3_CONTACT (ID ASC);

CREATE INDEX I_J3_TKYS_TRANSFERTOKEN ON J3_TRANSFER_TOKEN_KEYS (TRANSFER_TOKEN ASC);

CREATE INDEX I_J3_V_DC_TMODELINSTANCEINFO ON J3_OVERVIEW_DOC (TOMODEL_INSTANCE_INFO_ID ASC);

CREATE UNIQUE INDEX SQL101221160122200 ON J3_DISCOVERY_URL (ID ASC);

CREATE INDEX I_J3_B_BG_BUSINESSENTITY ON J3_BUSINESS_CATEGORY_BAG (ENTITY_KEY ASC);

CREATE UNIQUE INDEX SQL101221160118680 ON J3_BINDING_CATEGORY_BAG (ID ASC);

CREATE INDEX I_J3_D_RL_BUSINESSENTITY ON J3_DISCOVERY_URL (ENTITY_KEY ASC);

ALTER TABLE J3_SUBSCRIPTION_MATCH ADD CONSTRAINT SQL101221160127780 PRIMARY KEY (ID);

ALTER TABLE J3_SERVICE_DESCR ADD CONSTRAINT SQL101221160126090 PRIMARY KEY (ID);

ALTER TABLE J3_AUTH_TOKEN ADD CONSTRAINT SQL101221160118450 PRIMARY KEY (AUTH_TOKEN);

ALTER TABLE J3_TMODEL_INSTANCE_INFO_DESCR ADD CONSTRAINT SQL101221160129300 PRIMARY KEY (ID);

ALTER TABLE J3_TMODEL_DESCR ADD CONSTRAINT SQL101221160128420 PRIMARY KEY (ID);

ALTER TABLE J3_BUSINESS_CATEGORY_BAG ADD CONSTRAINT SQL101221160119500 PRIMARY KEY (ID);

ALTER TABLE J3_INSTANCE_DETAILS_DESCR ADD CONSTRAINT SQL101221160122740 PRIMARY KEY (ID);

ALTER TABLE J3_TMODEL_IDENTIFIER ADD CONSTRAINT SQL101221160128670 PRIMARY KEY (ID);

ALTER TABLE J3_TRANSFER_TOKEN ADD CONSTRAINT SQL101221160129560 PRIMARY KEY (TRANSFER_TOKEN);

ALTER TABLE J3_TMODEL ADD CONSTRAINT SQL101221160128000 PRIMARY KEY (ENTITY_KEY);

ALTER TABLE J3_TMODEL_INSTANCE_INFO ADD CONSTRAINT SQL101221160128950 PRIMARY KEY (ID);

ALTER TABLE J3_CLERK ADD CONSTRAINT SQL101221160121170 PRIMARY KEY (CLERK_NAME);

ALTER TABLE J3_OVERVIEW_DOC ADD CONSTRAINT SQL101221160124160 PRIMARY KEY (ID);

ALTER TABLE J3_INSTANCE_DETAILS_DOC_DESCR ADD CONSTRAINT SQL101221160123010 PRIMARY KEY (ID);

ALTER TABLE J3_ADDRESS_LINE ADD CONSTRAINT SQL101221160118210 PRIMARY KEY (ID);

ALTER TABLE J3_OVERVIEW_DOC_DESCR ADD CONSTRAINT SQL101221160124440 PRIMARY KEY (ID);

ALTER TABLE J3_NODE ADD CONSTRAINT SQL101221160123870 PRIMARY KEY (NAME);

ALTER TABLE J3_BUSINESS_ENTITY ADD CONSTRAINT SQL101221160119940 PRIMARY KEY (ENTITY_KEY);

ALTER TABLE J3_KEYED_REFERENCE_GROUP ADD CONSTRAINT SQL101221160123590 PRIMARY KEY (ID);

ALTER TABLE J3_SUBSCRIPTION ADD CONSTRAINT SQL101221160126780 PRIMARY KEY (SUBSCRIPTION_KEY);

ALTER TABLE OPENJPA_SEQUENCE_TABLE ADD CONSTRAINT SQL101221160130460 PRIMARY KEY (ID);

ALTER TABLE J3_BUSINESS_IDENTIFIER ADD CONSTRAINT SQL101221160120180 PRIMARY KEY (ID);

ALTER TABLE J3_EMAIL ADD CONSTRAINT SQL101221160122440 PRIMARY KEY (ID);

ALTER TABLE J3_KEYED_REFERENCE ADD CONSTRAINT SQL101221160123320 PRIMARY KEY (ID);

ALTER TABLE J3_CONTACT_DESCR ADD CONSTRAINT SQL101221160121930 PRIMARY KEY (ID);

ALTER TABLE J3_PHONE ADD CONSTRAINT SQL101221160124970 PRIMARY KEY (ID);

ALTER TABLE J3_CONTACT ADD CONSTRAINT SQL101221160121690 PRIMARY KEY (ID);

ALTER TABLE J3_BINDING_DESCR ADD CONSTRAINT SQL101221160118890 PRIMARY KEY (ID);

ALTER TABLE J3_PUBLISHER ADD CONSTRAINT SQL101221160125370 PRIMARY KEY (AUTHORIZED_NAME);

ALTER TABLE J3_UDDI_ENTITY ADD CONSTRAINT SQL101221160130130 PRIMARY KEY (ENTITY_KEY);

ALTER TABLE J3_CATEGORY_BAG ADD CONSTRAINT SQL101221160120860 PRIMARY KEY (ID);

ALTER TABLE J3_BUSINESS_DESCR ADD CONSTRAINT SQL101221160119730 PRIMARY KEY (ID);

ALTER TABLE J3_DISCOVERY_URL ADD CONSTRAINT SQL101221160122200 PRIMARY KEY (ID);

ALTER TABLE J3_BUSINESS_SERVICE ADD CONSTRAINT SQL101221160120640 PRIMARY KEY (ENTITY_KEY);

ALTER TABLE J3_TRANSFER_TOKEN_KEYS ADD CONSTRAINT SQL101221160129830 PRIMARY KEY (ID);

ALTER TABLE J3_CLIENT_SUBSCRIPTIONINFO ADD CONSTRAINT SQL101221160121420 PRIMARY KEY (SUBSCRIPTION_KEY);

ALTER TABLE J3_SUBSCRIPTION_CHUNK_TOKEN ADD CONSTRAINT SQL101221160127550 PRIMARY KEY (CHUNK_TOKEN);

ALTER TABLE J3_SERVICE_CATEGORY_BAG ADD CONSTRAINT SQL101221160125870 PRIMARY KEY (ID);

ALTER TABLE J3_PERSON_NAME ADD CONSTRAINT SQL101221160124690 PRIMARY KEY (ID);

ALTER TABLE J3_ADDRESS ADD CONSTRAINT SQL101221160117940 PRIMARY KEY (ID);

ALTER TABLE J3_PUBLISHER_ASSERTION ADD CONSTRAINT SQL101221160125640 PRIMARY KEY (FROM_KEY, TO_KEY);

ALTER TABLE J3_TMODEL_CATEGORY_BAG ADD CONSTRAINT SQL101221160128210 PRIMARY KEY (ID);

ALTER TABLE J3_SERVICE_PROJECTION ADD CONSTRAINT SQL101221160126530 PRIMARY KEY (BUSINESS_KEY, SERVICE_KEY);

ALTER TABLE J3_SERVICE_NAME ADD CONSTRAINT SQL101221160126300 PRIMARY KEY (ID);

ALTER TABLE J3_BINDING_CATEGORY_BAG ADD CONSTRAINT SQL101221160118680 PRIMARY KEY (ID);

ALTER TABLE J3_BUSINESS_NAME ADD CONSTRAINT SQL101221160120410 PRIMARY KEY (ID);

ALTER TABLE J3_BINDING_TEMPLATE ADD CONSTRAINT SQL101221160119280 PRIMARY KEY (ENTITY_KEY);