Implemented SWS-83: airline sample now uses HSQLDB in memory to test.
Also using Maven2 profiles for the various database settings.
This commit is contained in:
@@ -10,13 +10,10 @@
|
||||
<target name="init">
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
<!-- <artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository" -->
|
||||
<!-- layout="legacy"/> -->
|
||||
|
||||
<artifact:dependencies pathId="generate.classpath">
|
||||
<dependency groupId="axis" artifactId="axis-ant" version="1.4"/>
|
||||
<dependency groupId="axis" artifactId="axis" version="1.4"/>
|
||||
@@ -25,11 +22,7 @@
|
||||
<artifact:dependencies pathId="compile.classpath">
|
||||
<dependency groupId="axis" artifactId="axis" version="1.4"/>
|
||||
</artifact:dependencies>
|
||||
<!-- -->
|
||||
<!-- <artifact:dependencies pathId="runtime.classpath"> -->
|
||||
<!-- <remoteRepository refid="java.net" /> -->
|
||||
<!-- <dependency groupId="com.sun.xml.messaging.saaj" artifactId="saaj-impl" version="1.3"/> -->
|
||||
<!-- </artifact:dependencies> -->
|
||||
|
||||
</target>
|
||||
|
||||
<target name="generate" depends="init">
|
||||
|
||||
@@ -9,15 +9,11 @@
|
||||
<mkdir dir="${bin.dir}"/>
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
<artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository"
|
||||
layout="legacy" />
|
||||
|
||||
<artifact:dependencies pathId="generate.classpath">
|
||||
<remoteRepository refid="java.net"/>
|
||||
<dependency groupId="com.sun.xml.ws" artifactId="jaxws-tools" version="EA3"/>
|
||||
<dependency groupId="com.sun.xml.bind" artifactId="jaxb-xjc" version="2.1-EA2"/>
|
||||
<dependency groupId="com.sun.xml.stream.buffer" artifactId="streambuffer" version="0.3"/>
|
||||
@@ -27,12 +23,10 @@
|
||||
</artifact:dependencies>
|
||||
|
||||
<artifact:dependencies pathId="compile.classpath">
|
||||
<remoteRepository refid="java.net"/>
|
||||
<dependency groupId="javax.xml.ws" artifactId="jaxws-api" version="2.1-SNAPSHOT"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
<artifact:dependencies pathId="runtime.classpath">
|
||||
<remoteRepository refid="java.net"/>
|
||||
<dependency groupId="com.sun.xml.ws" artifactId="jaxws-rt" version="EA3"/>
|
||||
<dependency groupId="com.sun.xml.bind" artifactId="jaxb-impl" version="2.1-EA2"/>
|
||||
<dependency groupId="com.sun.xml.bind" artifactId="jaxb-xjc" version="2.1-EA2"/>
|
||||
|
||||
@@ -2,7 +2,7 @@ SPRING WEB SERVICES
|
||||
|
||||
Client table of contents
|
||||
---------------------------------------------------
|
||||
* axis - A client for the airline service written in Java using JAX-RPC (Axis 1).
|
||||
* axis1 - A client for the airline service written in Java using JAX-RPC (Axis 1).
|
||||
* cs - A client for the airline service written in C#.
|
||||
* jax-ws - A client for the airline service written in Java using JAX-WS.
|
||||
* saaj - Two clients that are written in Java and use SAAJ.
|
||||
|
||||
@@ -8,22 +8,17 @@
|
||||
<target name="init">
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
<artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository"
|
||||
layout="legacy"/>
|
||||
|
||||
<artifact:dependencies pathId="compile.classpath">
|
||||
<remoteRepository refid="java.net" />
|
||||
<dependency groupId="javax.xml.soap" artifactId="saaj-api" version="1.3"/>
|
||||
<dependency groupId="com.sun.xml.wss" artifactId="xws-security" version="2.0-ea2"/>
|
||||
<dependency groupId="com.sun.org.apache.xml.security" artifactId="xmlsec" version="2.0"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
<artifact:dependencies pathId="runtime.classpath">
|
||||
<remoteRepository refid="java.net" />
|
||||
<dependency groupId="com.sun.xml.messaging.saaj" artifactId="saaj-impl" version="1.3"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
|
||||
35
samples/airline/hsqldb/build.xml
Normal file
35
samples/airline/hsqldb/build.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="spring-ws-airline-sample-jax-ws-client" default="run-hsqldb" xmlns:artifact="urn:maven-artifact-ant">
|
||||
|
||||
<target name="init">
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
|
||||
<artifact:dependencies pathId="classpath">
|
||||
<dependency groupId="hsqldb" artifactId="hsqldb" version="1.8.0.7"/>
|
||||
</artifact:dependencies>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="${basedir}">
|
||||
<include name="airline.*"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="run-hsqldb" depends="init">
|
||||
<java classname="org.hsqldb.Server" fork="true" failonerror="true">
|
||||
<classpath refid="classpath"/>
|
||||
<arg line="-database.0 airline -dbname.0 airline"/>
|
||||
</java>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -9,7 +9,148 @@
|
||||
<artifactId>airline</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Spring WS Airline Sample</name>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>hsqldb</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.7</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<!-- Change these properties to reflect your HSQLDB connection settings -->
|
||||
<jdbc.driverClassName>org.hsqldb.jdbcDriver</jdbc.driverClassName>
|
||||
<jdbc.username>sa</jdbc.username>
|
||||
<jdbc.password></jdbc.password>
|
||||
<jdbc.url>jdbc:hsqldb:hsql://localhost/airline</jdbc.url>
|
||||
<hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>sql-maven-plugin</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<driver>${jdbc.driverClassName}</driver>
|
||||
<url>${jdbc.url}</url>
|
||||
<username>${jdbc.username}</username>
|
||||
<password>${jdbc.password}</password>
|
||||
<srcFiles>
|
||||
<srcFile>${basedir}/src/main/sql/hsqldb/airline-schema.sql</srcFile>
|
||||
<srcFile>${basedir}/src/main/sql/airline-dataload.sql</srcFile>
|
||||
</srcFiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>mysql</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.0.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<!-- Change these properties to reflect your MySQL connection settings -->
|
||||
<jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName>
|
||||
<jdbc.username>airline</jdbc.username>
|
||||
<jdbc.password>airline</jdbc.password>
|
||||
<jdbc.url>jdbc:mysql://localhost/airline</jdbc.url>
|
||||
<hibernate.dialect>org.hibernate.dialect.MySQLInnoDBDialect</hibernate.dialect>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>sql-maven-plugin</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.0.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<driver>${jdbc.driverClassName}</driver>
|
||||
<url>${jdbc.url}</url>
|
||||
<username>${jdbc.username}</username>
|
||||
<password>${jdbc.password}</password>
|
||||
<srcFiles>
|
||||
<srcFile>${basedir}/src/main/sql/mysql/airline-schema.sql</srcFile>
|
||||
<srcFile>${basedir}/src/main/sql/airline-dataload.sql</srcFile>
|
||||
</srcFiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>postgresql</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>8.1-407.jdbc3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<!-- Change these properties to reflect your PostgreSQL connection settings -->
|
||||
<jdbc.driverClassName>org.postgresql.Driver</jdbc.driverClassName>
|
||||
<jdbc.username>airline</jdbc.username>
|
||||
<jdbc.password>airline</jdbc.password>
|
||||
<jdbc.url>jdbc:postgresql://localhost/airline</jdbc.url>
|
||||
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>sql-maven-plugin</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>8.1-407.jdbc3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<driver>${jdbc.driverClassName}</driver>
|
||||
<url>${jdbc.url}</url>
|
||||
<username>${jdbc.username}</username>
|
||||
<password>${jdbc.password}</password>
|
||||
<srcFiles>
|
||||
<srcFile>${basedir}/src/main/sql/postgresql/airline-schema.sql</srcFile>
|
||||
<srcFile>${basedir}/src/main/sql/airline-dataload.sql</srcFile>
|
||||
</srcFiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -155,9 +296,10 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.0.4</version>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Various dependencies -->
|
||||
<dependency>
|
||||
|
||||
@@ -8,29 +8,34 @@ Features a web service on top of an airline reservation system, backed by a data
|
||||
Marshalling techniques (JAXB 1), and JDOM in combination with XPath queries to pull information from a message. All
|
||||
messages follow the airline.xsd schema in src/main/webapp.
|
||||
|
||||
Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, JMS and more.
|
||||
Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, and more.
|
||||
|
||||
2. INSTALLATION
|
||||
|
||||
The Airline sample is a normal web application that connects to a database of your choice.
|
||||
The Airline sample is a normal web application that connects to a database of your choice. By using Maven2 profiles, it
|
||||
supports three databases: HSQLDB (the easiest to setup), MySQL, or PostgreSQL.
|
||||
|
||||
1. Create a database using one of the scripts in src/etc/db. First, initialize the database using either the MySQL or
|
||||
PostgreSQL initDB.sql script, and after that run src/etc/db/populateDb.sql.
|
||||
2. Adjust the jdbc.properties in src/main/resources/org/springframework/ws/samples/airline/dao
|
||||
to reflect your database connection settings. By default MySQL is used.
|
||||
3. Adjust the hibernate.properties in src/main/resources/org/springframework/ws/samples/airline/dao/hibernate. By
|
||||
default MySQL is used.
|
||||
4. (Optional) Adjust the applicationContext-ws-jms.xml in src/main/resources/org/springframework/ws/samples/airline/ws/
|
||||
to reflect your JMS connections settings. By default ActiveMQ 2.1 is used. Make sure to start ActiveMQ before
|
||||
4. run "mvn package" and deploy the war file generated in target; or run "mvn jetty:run" to run the sample
|
||||
using the Jetty Web container built into Maven 2.
|
||||
5.
|
||||
To execute the sample with the supplied HSQLDB:
|
||||
|
||||
Note that both MySQL drivers are linked in using Maven so you don't have include these in your server if you're using
|
||||
this database.
|
||||
1. Start a command shell in the subdirectory hsqldb, and run "ant". This starts a HSQLDB server with a database named
|
||||
airline.
|
||||
2. Run "mvn sql:execute" to create the schema and insert data into the database.
|
||||
3. Run "mvn jetty:run" to run the sample in the Jetty6 Web container.
|
||||
|
||||
To execute the sample with MySQL or PostgreSQL:
|
||||
|
||||
1. Change the properties in the pom.xml file to reflect your database connection settings. There are three profiles
|
||||
(one for each supported database), so make sure to edit the right section. The areas to change are indicated with
|
||||
comments.
|
||||
2. Run "mvn -P <database> sql:execute", where <database> is "mysql" or "postgresql", to create the schema and insert
|
||||
data into the database.
|
||||
3. Run "mvn -P <database> jetty:run", where <database> is "mysql" or "postgresql", to run the sample in the Jetty6
|
||||
Web container.
|
||||
|
||||
To create a war file instead of running in Jetty, follow the steps above, but replace the "jetty:run" with "package" in
|
||||
the last step.
|
||||
|
||||
3. THE CLIENTS
|
||||
|
||||
The client directory contains a number of sample clients. More instructions are provided in the readme files in the
|
||||
directories.
|
||||
|
||||
directories.
|
||||
@@ -1 +0,0 @@
|
||||
DROP DATABASE IF EXISTS airline;
|
||||
@@ -1,6 +0,0 @@
|
||||
DROP TABLE FREQUENT_FLYER;
|
||||
DROP TABLE PASSENGER_TICKET;
|
||||
DROP TABLE PASSENGER;
|
||||
DROP TABLE TICKET;
|
||||
DROP TABLE FLIGHT;
|
||||
DROP TABLE AIRPORT;
|
||||
@@ -1,8 +1,6 @@
|
||||
# Properties file with hibernate-related settings.
|
||||
|
||||
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
||||
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
|
||||
#hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||
hibernate.dialect=${hibernate.dialect}
|
||||
hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
|
||||
#hibernate.hbm2ddl.auto=create-drop
|
||||
#hibernate.show_sql=true
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
#jdbc.driverClassName=org.hsqldb.jdbcDriver
|
||||
#jdbc.username=sa
|
||||
#jdbc.password=
|
||||
#jdbc.url=jdbc:hsqldb:mem:airline
|
||||
|
||||
jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||
jdbc.username=airline
|
||||
jdbc.password=airline
|
||||
jdbc.url=jdbc:mysql://localhost/airline
|
||||
|
||||
#jdbc.driverClassName=org.postgresql.Driver
|
||||
#jdbc.username=airline
|
||||
#jdbc.password=airline
|
||||
#jdbc.url=jdbc:postgresql://localhost/airline
|
||||
jdbc.driverClassName=${jdbc.driverClassName}
|
||||
jdbc.username=${jdbc.username}
|
||||
jdbc.password=${jdbc.password}
|
||||
jdbc.url=${jdbc.url}
|
||||
61
samples/airline/src/main/sql/hsqldb/airline-schema.sql
Normal file
61
samples/airline/src/main/sql/hsqldb/airline-schema.sql
Normal file
@@ -0,0 +1,61 @@
|
||||
DROP TABLE FREQUENT_FLYER IF EXISTS;
|
||||
DROP TABLE PASSENGER_TICKET IF EXISTS;
|
||||
DROP TABLE PASSENGER IF EXISTS;
|
||||
DROP TABLE TICKET IF EXISTS;
|
||||
DROP TABLE FLIGHT IF EXISTS;
|
||||
DROP TABLE AIRPORT IF EXISTS;
|
||||
|
||||
CREATE TABLE AIRPORT (
|
||||
CODE char(3) NOT NULL,
|
||||
NAME varchar(20) NOT NULL,
|
||||
CITY varchar(255) NOT NULL,
|
||||
PRIMARY KEY (CODE)
|
||||
);
|
||||
|
||||
CREATE TABLE FLIGHT (
|
||||
ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
|
||||
NUMBER VARCHAR(20) NOT NULL,
|
||||
DEPARTURE_TIME TIMESTAMP NOT NULL,
|
||||
FROM_AIRPORT_CODE CHAR(3) NOT NULL,
|
||||
ARRIVAL_TIME TIMESTAMP NOT NULL,
|
||||
TO_AIRPORT_CODE CHAR(3) NOT NULL,
|
||||
SEATS_AVAILABLE INT NOT NULL,
|
||||
SERVICE_CLASS VARCHAR(10) NOT NULL,
|
||||
MILES INT NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
UNIQUE (NUMBER, DEPARTURE_TIME),
|
||||
CONSTRAINT FK_FLIGHT_AIRPORT_FROM FOREIGN KEY (FROM_AIRPORT_CODE) REFERENCES AIRPORT,
|
||||
CONSTRAINT FK_FLIGHT_AIRPORT_TO FOREIGN KEY (TO_AIRPORT_CODE) REFERENCES AIRPORT
|
||||
);
|
||||
|
||||
CREATE TABLE TICKET (
|
||||
ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
|
||||
ISSUE_DATE DATE NOT NULL,
|
||||
FLIGHT_ID BIGINT NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT FK_TICKET_FLIGHT FOREIGN KEY (FLIGHT_ID) REFERENCES FLIGHT
|
||||
);
|
||||
|
||||
CREATE TABLE PASSENGER (
|
||||
ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
|
||||
FIRST_NAME VARCHAR(30),
|
||||
LAST_NAME VARCHAR(30),
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE PASSENGER_TICKET (
|
||||
TICKET_ID BIGINT NOT NULL,
|
||||
PASSENGER_ID BIGINT NOT NULL,
|
||||
PRIMARY KEY (TICKET_ID, PASSENGER_ID),
|
||||
CONSTRAINT PASSENGER_TICKET_TICKET FOREIGN KEY (TICKET_ID) REFERENCES TICKET,
|
||||
CONSTRAINT PASSENGER_TICKET_PASSENGER FOREIGN KEY (PASSENGER_ID) REFERENCES PASSENGER
|
||||
);
|
||||
|
||||
CREATE TABLE FREQUENT_FLYER (
|
||||
PASSENGER_ID BIGINT NOT NULL,
|
||||
MILES INTEGER,
|
||||
PASSWORD VARCHAR(255),
|
||||
USERNAME VARCHAR(255),
|
||||
PRIMARY KEY (PASSENGER_ID),
|
||||
CONSTRAINT FREQUENT_FLYER_PASSENGER FOREIGN KEY (PASSENGER_ID) REFERENCES PASSENGER
|
||||
)
|
||||
@@ -1,14 +1,17 @@
|
||||
CREATE DATABASE IF NOT EXISTS airline;
|
||||
USE AIRLINE;
|
||||
|
||||
GRANT ALL ON airline.* TO airline@localhost IDENTIFIED BY 'airline';
|
||||
|
||||
USE airline;
|
||||
DROP TABLE IF EXISTS FREQUENT_FLYER;
|
||||
DROP TABLE IF EXISTS PASSENGER_TICKET;
|
||||
DROP TABLE IF EXISTS PASSENGER;
|
||||
DROP TABLE IF EXISTS TICKET;
|
||||
DROP TABLE IF EXISTS FLIGHT;
|
||||
DROP TABLE IF EXISTS AIRPORT;
|
||||
|
||||
CREATE TABLE AIRPORT (
|
||||
CODE CHAR(3) NOT NULL PRIMARY KEY,
|
||||
NAME VARCHAR(20) NOT NULL,
|
||||
CITY VARCHAR(20) NOT NULL
|
||||
);
|
||||
) TYPE=INNODB;
|
||||
|
||||
CREATE TABLE FLIGHT (
|
||||
ID INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -21,24 +24,24 @@ CREATE TABLE FLIGHT (
|
||||
SEATS_AVAILABLE INT(4) UNSIGNED NOT NULL,
|
||||
MILES INT(4) UNSIGNED NOT NULL,
|
||||
UNIQUE KEY IDX_NUMBER_DEPARTURE_TIME (NUMBER, DEPARTURE_TIME)
|
||||
);
|
||||
) TYPE=INNODB;
|
||||
|
||||
CREATE TABLE TICKET (
|
||||
ID INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
ISSUE_DATE DATE NOT NULL,
|
||||
FLIGHT_ID INT(4) UNSIGNED NOT NULL REFERENCES FLIGHT(ID)
|
||||
);
|
||||
) TYPE=INNODB;
|
||||
|
||||
CREATE TABLE PASSENGER (
|
||||
ID INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
FIRST_NAME VARCHAR(30),
|
||||
LAST_NAME VARCHAR(30)
|
||||
);
|
||||
) TYPE=INNODB;
|
||||
|
||||
CREATE TABLE PASSENGER_TICKET (
|
||||
PASSENGER_ID INT(4) UNSIGNED NOT NULL REFERENCES PASSENGER(ID),
|
||||
TICKET_ID INT(4) UNSIGNED NOT NULL REFERENCES TICKET(ID)
|
||||
);
|
||||
) TYPE=INNODB;
|
||||
|
||||
CREATE TABLE FREQUENT_FLYER (
|
||||
PASSENGER_ID INT(4) UNSIGNED NOT NULL PRIMARY KEY REFERENCES PASSENGER(ID),
|
||||
@@ -46,7 +49,7 @@ CREATE TABLE FREQUENT_FLYER (
|
||||
PASSWORD VARCHAR(10) NOT NULL,
|
||||
MILES INT(4) UNSIGNED NOT NULL,
|
||||
UNIQUE KEY IDX_USERNAME (USERNAME)
|
||||
);
|
||||
) TYPE=INNODB;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
CREATE DATABASE airline;
|
||||
GRANT ALL ON DATABASE airline to airline;
|
||||
DROP TABLE FREQUENT_FLYER;
|
||||
DROP TABLE PASSENGER_TICKET;
|
||||
DROP TABLE PASSENGER;
|
||||
DROP TABLE TICKET;
|
||||
DROP TABLE FLIGHT;
|
||||
DROP TABLE AIRPORT;
|
||||
|
||||
CREATE TABLE AIRPORT (
|
||||
CODE CHAR(3) NOT NULL PRIMARY KEY,
|
||||
@@ -0,0 +1,6 @@
|
||||
# Test-specific settings for the DAO layer
|
||||
# Uses an in-memory HSQL database
|
||||
|
||||
hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
||||
hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
|
||||
hibernate.hbm2ddl.auto=create-drop
|
||||
@@ -0,0 +1,7 @@
|
||||
# Test-specific settings for the DAO layer
|
||||
# Uses an in-memory HSQL database
|
||||
|
||||
jdbc.driverClassName=org.hsqldb.jdbcDriver
|
||||
jdbc.username=sa
|
||||
jdbc.password=
|
||||
jdbc.url=jdbc:hsqldb:mem:airline
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@
|
||||
<target name="init">
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<target name="init">
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user