geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r958321 - in /geronimo/samples/branches/3.0-M1/samples/daytrader: assemblies/web/daytrader-web-jpa/ assemblies/web/daytrader-web-jpa/src/main/resources/ assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/ assemblies/web/daytrader-...
Date Sun, 27 Jun 2010 03:38:59 GMT
Author: xiaming
Date: Sun Jun 27 03:38:58 2010
New Revision: 958321

URL: http://svn.apache.org/viewvc?rev=958321&view=rev
Log:
GERONIMO-5399 enable daytrader web jpa assemblies on G 3.0-M1

Added:
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml   (with props)
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/db2/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/db2/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/derby/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/derby/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/informix/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/informix/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/mysql/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/mysql/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/oracle/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/oracle/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/other/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/other/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/postgre/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/postgre/Table.ddl
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/sqlserver/
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/sqlserver/Table.ddl
Modified:
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/pom.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/geronimo-web.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/web.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
    geronimo/samples/branches/3.0-M1/samples/daytrader/modules/entities/pom.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/pom.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/src/main/plan/plan.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/pom.xml
    geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/src/main/plan/plan.xml

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/pom.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/pom.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/pom.xml Sun Jun 27 03:38:58 2010
@@ -35,22 +35,22 @@
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.modules</groupId>
             <artifactId>daytrader-util</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.modules</groupId>
             <artifactId>daytrader-core</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.modules</groupId>
             <artifactId>daytrader-entities</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.modules</groupId>
             <artifactId>daytrader-web</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <!-- we need to include this in the image for logging to work -->
@@ -142,6 +142,14 @@
     </dependencies>
 
     <build>
+        <resources>
+            <!--Put db creation scripts into WEB-INF/classes in order to load it from DBInitializationGBean-->
+            <resource>
+                <filtering>true</filtering>
+                    <directory>${basedir}/src/main/resources</directory>
+                    <targetPath>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</targetPath>
+            </resource>                        
+        </resources>      
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml Sun Jun 27 03:38:58 2010
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+    <persistence-unit transaction-type="RESOURCE_LOCAL" name="daytrader">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <!--<jta-data-source>jdbc/TradeDataSource</jta-data-source>  
+        <non-jta-data-source>jdbc/NoTxTradeDataSource</non-jta-data-source>-->
+        
+        <class>org.apache.geronimo.samples.daytrader.beans.AccountDataBean</class>
+        <class>org.apache.geronimo.samples.daytrader.beans.AccountProfileDataBean</class>
+        <class>org.apache.geronimo.samples.daytrader.beans.HoldingDataBean</class>
+        <class>org.apache.geronimo.samples.daytrader.beans.OrderDataBean</class>
+        <class>org.apache.geronimo.samples.daytrader.beans.QuoteDataBean</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+        
+        <properties>
+            <property name="openjpa.DynamicEnhancementAgent" value="false"/>
+            <property name="openjpa.BrokerImpl" value="non-finalizing" />
+            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+            <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
+      <property name="openjpa.ConnectionFactoryName" value="java:comp/env/jdbc/TradeDataSource" />
+      <property name="openjpa.ConnectionFactory2Name" value="java:comp/env/jdbc/NoTxTradeDataSource" />
+
+            <!--
+            <property name="openjpa.jdbc.DBDictionary" value="derby" />
+            <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> 
+            <property name="openjpa.jdbc.UpdateManager" value="org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager(batchLimit=0)" />
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+            <property name="openjpa.ConnectionURL" value="jdbc:derby:tradedb;create=true"/>
+            <property name="openjpa.ConnectionProperties" value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:tradedb;create=true,MaxActive=50,MaxWait=10000,Username=,Password="/>
+            -->
+        </properties>
+    </persistence-unit>
+</persistence>

Propchange: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/db2/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/db2/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/db2/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/db2/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,107 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (--) are considered as comments
+-- DROP TABLE HOLDINGEJB;
+-- DROP TABLE ACCOUNTPROFILEEJB;
+-- DROP TABLE QUOTEEJB;
+-- DROP TABLE KEYGENEJB;
+-- DROP TABLE ACCOUNTEJB;
+-- DROP TABLE ORDEREJB;
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250));
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(250),
+   PASSWD VARCHAR(250),
+   USERID VARCHAR(250) NOT NULL,
+   EMAIL VARCHAR(250),
+   CREDITCARD VARCHAR(250),
+   FULLNAME VARCHAR(250));
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(250),
+   SYMBOL VARCHAR(250) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(250));
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(250),
+   ORDERSTATUS VARCHAR(250),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+ALTER TABLE HOLDINGEJB VOLATILE;
+ALTER TABLE ACCOUNTPROFILEEJB VOLATILE;
+ALTER TABLE QUOTEEJB VOLATILE;
+ALTER TABLE KEYGENEJB VOLATILE;
+ALTER TABLE ACCOUNTEJB VOLATILE;
+ALTER TABLE ORDEREJB VOLATILE;
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/derby/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/derby/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/derby/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/derby/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,106 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (--) are considered as comments
+-- DROP TABLE HOLDINGEJB;
+-- DROP TABLE ACCOUNTPROFILEEJB;
+-- DROP TABLE QUOTEEJB;
+-- DROP TABLE KEYGENEJB;
+-- DROP TABLE ACCOUNTEJB;
+-- DROP TABLE ORDEREJB;
+-- DROP TABLE OPENJPASEQ;
+
+create table OPENJPASEQ
+(ID SMALLINT NOT NULL PRIMARY KEY,
+SEQUENCE_VALUE BIGINT);
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250));
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(250),
+   PASSWD VARCHAR(250),
+   USERID VARCHAR(250) NOT NULL,
+   EMAIL VARCHAR(250),
+   CREDITCARD VARCHAR(250),
+   FULLNAME VARCHAR(250));
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(250),
+   SYMBOL VARCHAR(250) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(250));
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(250),
+   ORDERSTATUS VARCHAR(250),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);
+

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/informix/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/informix/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/informix/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/informix/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,88 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (--) are considered as comments
+-- DROP TABLE HOLDINGEJB;
+-- DROP TABLE ACCOUNTPROFILEEJB;
+-- DROP TABLE QUOTEEJB;
+-- DROP TABLE KEYGENEJB;
+-- DROP TABLE ACCOUNTEJB;
+-- DROP TABLE ORDEREJB;
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL PRIMARY KEY CONSTRAINT HOLDINGID,
+   QUANTITY FLOAT NOT NULL,
+   PURCHASEDATE DATETIME YEAR TO SECOND,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(255));
+
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(255),
+   PASSWD VARCHAR(255),
+   USERID VARCHAR(255) NOT NULL PRIMARY KEY CONSTRAINT USERID,
+   EMAIL VARCHAR(255),
+   CREDITCARD VARCHAR(255),
+   FULLNAME VARCHAR(255));
+
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME FLOAT NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(255),
+   SYMBOL VARCHAR(255) NOT NULL PRIMARY KEY CONSTRAINT SYMBOL,
+   CHANGE1 FLOAT NOT NULL);
+
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(255) NOT NULL PRIMARY KEY CONSTRAINT KEYNAME);
+
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE DATETIME YEAR TO SECOND,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL PRIMARY KEY CONSTRAINT ACCOUNTID,
+   LASTLOGIN DATETIME YEAR TO SECOND,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(255));
+
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE DATETIME YEAR TO SECOND,
+   ORDERTYPE VARCHAR(255),
+   ORDERSTATUS VARCHAR(255),
+   PRICE DECIMAL(14, 2),
+   QUANTITY FLOAT NOT NULL,
+   OPENDATE DATETIME YEAR TO SECOND,
+   ORDERID INTEGER NOT NULL PRIMARY KEY CONSTRAINT ORDERID,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(255),
+   HOLDING_HOLDINGID INTEGER);
+
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/mysql/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/mysql/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/mysql/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/mysql/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,107 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (--) are considered as comments
+-- DROP TABLE holdingejb;
+-- DROP TABLE accountprofileejb;
+-- DROP TABLE quoteejb;
+-- DROP TABLE keygenejb;
+-- DROP TABLE accountejb;
+-- DROP TABLE orderejb;
+
+CREATE TABLE holdingejb
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE DATETIME,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(255));
+
+ALTER TABLE holdingejb 
+    ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE accountprofileejb
+  (ADDRESS VARCHAR(255),
+   PASSWD VARCHAR(255),
+   USERID VARCHAR(255) NOT NULL,
+   EMAIL VARCHAR(255),
+   CREDITCARD VARCHAR(255),
+   FULLNAME VARCHAR(255));
+
+ALTER TABLE accountprofileejb 
+    ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE quoteejb
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(255),
+   SYMBOL VARCHAR(255) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE quoteejb 
+    ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE keygenejb
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(255) NOT NULL);
+
+ALTER TABLE keygenejb 
+    ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE accountejb
+  (CREATIONDATE DATETIME,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN DATETIME,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(255));
+
+ALTER TABLE accountejb 
+    ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE orderejb
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE DATETIME,
+   ORDERTYPE VARCHAR(255),
+   ORDERSTATUS VARCHAR(255),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE DATETIME,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(255),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE orderejb 
+    ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+-- ALTER TABLE HOLDINGEJB VOLATILE;
+-- ALTER TABLE ACCOUNTPROFILEEJB VOLATILE;
+-- ALTER TABLE QUOTEEJB VOLATILE;
+-- ALTER TABLE KEYGENEJB VOLATILE;
+-- ALTER TABLE ACCOUNTEJB VOLATILE;
+-- ALTER TABLE ORDEREJB VOLATILE;
+
+CREATE INDEX ACCOUNT_USERID ON accountejb(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON holdingejb(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON orderejb(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON orderejb(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON orderejb(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/oracle/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/oracle/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/oracle/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/oracle/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,100 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (--) are considered as comments
+-- DROP TABLE HOLDINGEJB cascade constraints;
+-- DROP TABLE ACCOUNTPROFILEEJB cascade constraints;
+-- DROP TABLE QUOTEEJB cascade constraints;
+-- DROP TABLE KEYGENEJB cascade constraints;
+-- DROP TABLE ACCOUNTEJB cascade constraints;
+-- DROP TABLE ORDEREJB cascade constraints;
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2) NULL,
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY NUMBER NOT NULL,
+   PURCHASEDATE DATE NULL,
+   ACCOUNT_ACCOUNTID INTEGER NULL,
+   QUOTE_SYMBOL VARCHAR2(250) NULL);
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR2(250) NULL,
+   PASSWD VARCHAR2(250) NULL,
+   USERID VARCHAR2(250) NOT NULL,
+   EMAIL VARCHAR2(250) NULL,
+   CREDITCARD VARCHAR2(250) NULL,
+   FULLNAME VARCHAR2(250) NULL);
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILEEJB PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2) NULL,
+   OPEN1 DECIMAL(14, 2) NULL,
+   VOLUME NUMBER NOT NULL,
+   PRICE DECIMAL(14, 2) NULL,
+   HIGH DECIMAL(14, 2) NULL,
+   COMPANYNAME VARCHAR2(250) NULL,
+   SYMBOL VARCHAR2(250) NOT NULL,
+   CHANGE1 NUMBER NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR2(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE DATE NULL,
+   OPENBALANCE DECIMAL(14, 2) NULL,
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2) NULL,
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN DATE NULL,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR2(250) NULL);
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2) NULL,
+   COMPLETIONDATE DATE NULL,
+   ORDERTYPE VARCHAR2(250) NULL,
+   ORDERSTATUS VARCHAR2(250) NULL,
+   PRICE DECIMAL(14, 2) NULL,
+   QUANTITY NUMBER NOT NULL,
+   OPENDATE DATE NULL,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER NULL,
+   QUOTE_SYMBOL VARCHAR2(250) NULL,
+   HOLDING_HOLDINGID INTEGER NULL);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/other/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/other/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/other/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/other/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,107 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (#) are considered as comments
+-- DROP TABLE HOLDINGEJB;
+-- DROP TABLE ACCOUNTPROFILEEJB;
+-- DROP TABLE QUOTEEJB;
+-- DROP TABLE KEYGENEJB;
+-- DROP TABLE ACCOUNTEJB;
+-- DROP TABLE ORDEREJB;
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250));
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(250),
+   PASSWD VARCHAR(250),
+   USERID VARCHAR(250) NOT NULL,
+   EMAIL VARCHAR(250),
+   CREDITCARD VARCHAR(250),
+   FULLNAME VARCHAR(250));
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(250),
+   SYMBOL VARCHAR(250) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(250));
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(250),
+   ORDERSTATUS VARCHAR(250),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+ALTER TABLE HOLDINGEJB VOLATILE;
+ALTER TABLE ACCOUNTPROFILEEJB VOLATILE;
+ALTER TABLE QUOTEEJB VOLATILE;
+ALTER TABLE KEYGENEJB VOLATILE;
+ALTER TABLE ACCOUNTEJB VOLATILE;
+ALTER TABLE ORDEREJB VOLATILE;
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/postgre/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/postgre/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/postgre/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/postgre/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,102 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (#) are considered as comments
+
+-- If you first time initialize postgre db, the drop statements should be commented out as following.
+-- DROP TABLE holdingejb;
+-- DROP TABLE accountprofileejb;
+-- DROP TABLE quoteejb;
+-- DROP TABLE keygenejb;
+-- DROP TABLE accountejb;
+-- DROP TABLE orderejb;
+
+CREATE TABLE holdingejb
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE PRECISION NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(255));
+
+ALTER TABLE holdingejb 
+    ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE accountprofileejb
+  (ADDRESS VARCHAR(255),
+   PASSWD VARCHAR(255),
+   USERID VARCHAR(255) NOT NULL,
+   EMAIL VARCHAR(255),
+   CREDITCARD VARCHAR(255),
+   FULLNAME VARCHAR(255));
+
+ALTER TABLE accountprofileejb 
+    ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE quoteejb
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE PRECISION NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(255),
+   SYMBOL VARCHAR(255) NOT NULL,
+   CHANGE1 DOUBLE PRECISION NOT NULL);
+
+ALTER TABLE quoteejb 
+    ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE keygenejb
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(255) NOT NULL);
+
+ALTER TABLE keygenejb 
+    ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE accountejb
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(255));
+
+ALTER TABLE accountejb 
+    ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE orderejb
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(255),
+   ORDERSTATUS VARCHAR(255),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE PRECISION NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(255),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE orderejb 
+    ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+CREATE INDEX ACCOUNT_USERID ON accountejb(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON holdingejb(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON orderejb(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON orderejb(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON orderejb(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Added: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/sqlserver/Table.ddl
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/sqlserver/Table.ddl?rev=958321&view=auto
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/sqlserver/Table.ddl (added)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/resources/dbscripts/sqlserver/Table.ddl Sun Jun 27 03:38:58 2010
@@ -0,0 +1,87 @@
+--    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.
+
+-- Each SQL statement in this file should terminate with a semicolon (;)
+-- Lines starting with the pound character (#) are considered as comments
+-- DROP TABLE HOLDINGEJB;
+-- DROP TABLE ACCOUNTPROFILEEJB;
+-- DROP TABLE QUOTEEJB;
+-- DROP TABLE KEYGENEJB;
+-- DROP TABLE ACCOUNTEJB;
+-- DROP TABLE ORDEREJB;
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INT NOT NULL PRIMARY KEY,
+   QUANTITY FLOAT NOT NULL,
+   PURCHASEDATE DATETIME,
+   ACCOUNT_ACCOUNTID INT,
+   QUOTE_SYMBOL VARCHAR(255));
+
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(255),
+   PASSWD VARCHAR(255),
+   USERID VARCHAR(255) NOT NULL PRIMARY KEY,
+   EMAIL VARCHAR(255),
+   CREDITCARD VARCHAR(255),
+   FULLNAME VARCHAR(255));
+
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME FLOAT NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(255),
+   SYMBOL VARCHAR(255) NOT NULL PRIMARY KEY,
+   CHANGE1 FLOAT NOT NULL);
+
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INT NOT NULL,
+   KEYNAME VARCHAR(255) NOT NULL PRIMARY KEY);
+
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE DATETIME,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INT NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INT NOT NULL PRIMARY KEY,
+   LASTLOGIN DATETIME,
+   LOGINCOUNT INT NOT NULL,
+   PROFILE_USERID VARCHAR(255));
+
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE DATETIME,
+   ORDERTYPE VARCHAR(255),
+   ORDERSTATUS VARCHAR(255),
+   PRICE DECIMAL(14, 2),
+   QUANTITY FLOAT NOT NULL,
+   OPENDATE DATETIME,
+   ORDERID INT NOT NULL PRIMARY KEY,
+   ACCOUNT_ACCOUNTID INT,
+   QUOTE_SYMBOL VARCHAR(255),
+   HOLDING_HOLDINGID INT);
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/geronimo-web.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/geronimo-web.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/geronimo-web.xml Sun Jun 27 03:38:58 2010
@@ -23,27 +23,125 @@
         
         <sys:environment>
             <sys:moduleId>
-                <sys:groupId>org.apache.geronimo.daytrader.assemblies.web</sys:groupId>
-                <sys:artifactId>daytrader-web-jdbc</sys:artifactId>
-                <sys:version>2.2</sys:version>
-                <sys:type>war</sys:type>
+                <sys:groupId>${project.groupId}</sys:groupId>
+                <sys:artifactId>${project.artifactId}</sys:artifactId>
+                <sys:version>${project.version}</sys:version>
+                <sys:type>car</sys:type>
             </sys:moduleId>
         
             <sys:dependencies>
                 <sys:dependency>
-                    <sys:groupId>org.apache.geronimo.daytrader.plugins</sys:groupId>
+                    <sys:groupId>org.apache.geronimo.samples.daytrader.plugins</sys:groupId>
                     <sys:artifactId>daytrader-derby-datasource</sys:artifactId>
+                    <sys:version>${project.version}</sys:version>
+                    <sys:type>car</sys:type>
                 </sys:dependency>
             </sys:dependencies>
         </sys:environment>
     
-    <context-root>/daytrader</context-root>
+    <context-root>/${project.artifactId}</context-root>
 
-     <naming:resource-ref>
+    <naming:resource-ref>
         <naming:ref-name>jdbc/TradeDataSource</naming:ref-name>
         <naming:resource-link>jdbc/TradeDataSource</naming:resource-link>
     </naming:resource-ref>
 
+    <naming:resource-ref>
+        <naming:ref-name>jdbc/NoTxTradeDataSource</naming:ref-name>
+        <naming:resource-link>jdbc/NoTxTradeDataSource</naming:resource-link>
+    </naming:resource-ref>
+
+    <gbean name="DBInitialization" class="org.apache.geronimo.connector.wrapper.DatabaseInitializationGBean">
+        <!--sql override path
+        <attribute name="sql">
+create table OPENJPASEQ
+(ID SMALLINT NOT NULL PRIMARY KEY,
+SEQUENCE_VALUE BIGINT);
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250));
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(250),
+   PASSWD VARCHAR(250),
+   USERID VARCHAR(250) NOT NULL,
+   EMAIL VARCHAR(250),
+   CREDITCARD VARCHAR(250),
+   FULLNAME VARCHAR(250));
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(250),
+   SYMBOL VARCHAR(250) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(250));
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(250),
+   ORDERSTATUS VARCHAR(250),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);
+        </attribute>-->
+        <!-- According to your database vendor, you can put these values: db2, oracle, informix, mysql, sqlserver, postgre, other(means any other vendor)-->
+        <attribute name="path">/dbscripts/derby/Table.ddl</attribute>
+        <reference name="DataSource">
+            <name>jdbc/NoTxTradeDataSource</name>
+        </reference>
+    </gbean>
+
 </web-app>
 
 

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/web.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/web.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/assemblies/web/daytrader-web-jpa/src/main/webapp/WEB-INF/web.xml Sun Jun 27 03:38:58 2010
@@ -427,6 +427,12 @@
         <res-auth>Container</res-auth>
         <res-sharing-scope>Shareable</res-sharing-scope>
     </resource-ref>
+    <resource-ref>
+        <res-ref-name>jdbc/NoTxTradeDataSource</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
 <!-- JavaEE only
     <resource-ref>
         <res-ref-name>jms/QueueConnectionFactory</res-ref-name>

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java Sun Jun 27 03:38:58 2010
@@ -64,6 +64,9 @@ public class TradeJPADirect implements T
     private static BigDecimal ZERO = new BigDecimal(0.0);
 
     private static boolean initialized = false;
+    
+    private Integer soldholdingID = null;
+    private Object soldholdingIDlock = new Object();
 
     /**
      * Zero arg constructor for TradeJPADirect
@@ -92,7 +95,7 @@ public class TradeJPADirect implements T
         if (initialized)
             return;
         if (Log.doTrace())
-            Log.trace("TradeJPADirect:init -- *** initializing");
+            Log.trace("TradeJPADirect:init -- *** initializing");  
 
         TradeConfig.setPublishQuotePriceChange(false);
 
@@ -295,9 +298,12 @@ public class TradeJPADirect implements T
             // commit the transaction before calling completeOrder
             entityManager.getTransaction().commit();
 
-            if (orderProcessingMode == TradeConfig.SYNCH)
-                completeOrder(order.getOrderID(), false);
-            else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
+            if (orderProcessingMode == TradeConfig.SYNCH) {            	
+            	synchronized(soldholdingIDlock) {
+            		this.soldholdingID = holding.getHoldingID();
+            		completeOrder(order.getOrderID(), false);
+            	}            	
+            } else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
                 queueOrder(order.getOrderID(), true);
 
         }
@@ -353,11 +359,14 @@ public class TradeJPADirect implements T
 
         AccountDataBean account = order.getAccount();
         QuoteDataBean quote = order.getQuote();
-        HoldingDataBean holding = order.getHolding();
+        HoldingDataBean holding = null;
+        if(order.isSell() && this.soldholdingID != null){
+        	holding = entityManager.find(HoldingDataBean.class, this.soldholdingID);
+        }        
         BigDecimal price = order.getPrice();
         double quantity = order.getQuantity();
 
-        String userID = account.getProfile().getUserID();
+        //String userID = account.getProfile().getUserID();
 
         if (Log.doTrace())
             Log.trace("TradeJPADirect:completeOrder--> Completing Order "
@@ -365,23 +374,25 @@ public class TradeJPADirect implements T
                       + "\n\t Account info: " + account + "\n\t Quote info: "
                       + quote + "\n\t Holding info: " + holding);
 
-        HoldingDataBean newHolding = null;
+        HoldingDataBean newHolding = null;        
+        
         if (order.isBuy()) {
             /*
              * Complete a Buy operation - create a new Holding for the Account -
              * deduct the Order cost from the Account balance
              */
-
-            newHolding = createHolding(account, quote, quantity, price, entityManager);
-        }
-
-        try {
-            entityManager.getTransaction().begin();
-
+        	//newHolding = createHolding(account, quote, quantity, price, entityManager);
+        	entityManager.getTransaction().begin();
+        	newHolding = new HoldingDataBean(quantity, price, new Timestamp(System.currentTimeMillis()), account, quote);
+        	entityManager.persist(newHolding);            
+            
             if (newHolding != null) {
                 order.setHolding(newHolding);
             }
+            entityManager.getTransaction().commit();
+        }
 
+        try {
             if (order.isSell()) {
                 /*
                  * Complete a Sell operation - remove the Holding from the Account -
@@ -389,13 +400,15 @@ public class TradeJPADirect implements T
                  */
                 if (holding == null) {
                     Log.error("TradeJPADirect:completeOrder -- Unable to sell order " + order.getOrderID() + " holding already sold");
-                    order.cancel();
-                    entityManager.getTransaction().commit();
+                    order.cancel();                    
                     return order;
                 }
                 else {
-                    entityManager.remove(holding);
+                	entityManager.getTransaction().begin();
+                    entityManager.remove(holding);                    
                     order.setHolding(null);
+                    this.soldholdingID = null;
+                    entityManager.getTransaction().commit();
                 }
             }
 
@@ -409,7 +422,6 @@ public class TradeJPADirect implements T
                           + "\n\t Account info: " + account + "\n\t Quote info: "
                           + quote + "\n\t Holding info: " + holding);
 
-            entityManager.getTransaction().commit();
         }
         catch (Exception e) {
             e.printStackTrace();
@@ -477,12 +489,12 @@ public class TradeJPADirect implements T
             /*
              * managed transaction
              */
-            entityManager.getTransaction().begin();
+            //entityManager.getTransaction().begin();
             Query query = entityManager
                           .createNamedQuery("orderejb.closedOrders");
             query.setParameter("userID", userID);
 
-            entityManager.getTransaction().commit();
+            //entityManager.getTransaction().commit();
             Collection results = query.getResultList();
             Iterator itr = results.iterator();
             // entityManager.joinTransaction();
@@ -512,6 +524,7 @@ public class TradeJPADirect implements T
                 }
             }
             else if (TradeConfig.jpaLayer == TradeConfig.HIBERNATE) {
+            	try {
                 /*
                  * Add logic to do update orders operation, because JBoss5'
                  * Hibernate 3.3.1GA DB2Dialect and MySQL5Dialect do not work
@@ -537,8 +550,16 @@ public class TradeJPADirect implements T
                 Query updateStatus = entityManager.createNativeQuery("UPDATE orderejb o SET o.orderStatus = 'completed' WHERE "
                                                                      + "o.orderStatus = 'closed' AND o.ACCOUNT_ACCOUNTID  = ?");
                 updateStatus.setParameter(1, accountid.intValue());
+                entityManager.getTransaction().begin();
                 updateStatus.executeUpdate();
+                entityManager.getTransaction().commit();
+            	} catch (Exception e){
+            		entityManager.getTransaction().rollback();
+                    entityManager.close();
+                    entityManager = null;
+            	}
             }
+            
             if (entityManager != null) {
                 entityManager.close();
                 entityManager = null;
@@ -949,34 +970,28 @@ public class TradeJPADirect implements T
                 entityManager.persist(order);
         }
         catch (Exception e) {
+        	entityManager.getTransaction().rollback();
             Log.error("TradeJPADirect:createOrder -- failed to create Order", e);
             throw new RuntimeException("TradeJPADirect:createOrder -- failed to create Order", e);
         }
         return order;
     }
 
-    private HoldingDataBean createHolding(AccountDataBean account,
+    /*private HoldingDataBean createHolding(AccountDataBean account,
                                           QuoteDataBean quote, double quantity, BigDecimal purchasePrice,
                                           EntityManager entityManager) throws Exception {
         HoldingDataBean newHolding = new HoldingDataBean(quantity,
                                                          purchasePrice, new Timestamp(System.currentTimeMillis()),
                                                          account, quote);
-        try {
-            /*
-             * manage transactions
-             */
-            entityManager.getTransaction().begin();
-            entityManager.persist(newHolding);
-            entityManager.getTransaction().commit();
+        try {            
+            entityManager.persist(newHolding);            
         }
         catch (Exception e) {
             entityManager.getTransaction().rollback();
-        } finally {
-            entityManager.close();
-        }
-
+        } 
+        
         return newHolding;
-    }
+    }*/
 
     public double investmentReturn(double investment, double NetValue)
     throws Exception {

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/modules/entities/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/modules/entities/pom.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/modules/entities/pom.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/modules/entities/pom.xml Sun Jun 27 03:38:58 2010
@@ -40,7 +40,7 @@
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.modules</groupId>
             <artifactId>daytrader-util</artifactId>
-            <version>${pom.version}</version>
+            <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/pom.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/pom.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/pom.xml Sun Jun 27 03:38:58 2010
@@ -36,7 +36,7 @@
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.assemblies.web</groupId>
             <artifactId>daytrader-web-jpa</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
             <type>war</type>
             <scope>provided</scope>
         </dependency>
@@ -96,6 +96,7 @@
                     <module>
                         <groupId>org.apache.geronimo.samples.daytrader.assemblies.web</groupId>
                         <artifactId>daytrader-web-jpa</artifactId>
+                        <version>${project.version}</version>
                         <type>war</type>
                     </module>
                     <instance>

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/src/main/plan/plan.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/src/main/plan/plan.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-jetty/src/main/plan/plan.xml Sun Jun 27 03:38:58 2010
@@ -19,14 +19,120 @@
 <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
              xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
              xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
-    
-     <context-root>${project.artifactId}</context-root>
+    <sys:environment>        
+            <sys:dependencies>
+                <sys:dependency>
+                    <sys:groupId>org.apache.geronimo.samples.daytrader.plugins</sys:groupId>
+                    <sys:artifactId>daytrader-derby-datasource</sys:artifactId>
+                    <sys:version>${project.version}</sys:version>
+                    <sys:type>car</sys:type>
+                </sys:dependency>
+            </sys:dependencies>
+    </sys:environment>
 
-     <naming:resource-ref>
+    <context-root>${project.artifactId}</context-root>
+
+    <naming:resource-ref>
         <naming:ref-name>jdbc/TradeDataSource</naming:ref-name>
         <naming:resource-link>jdbc/TradeDataSource</naming:resource-link>
     </naming:resource-ref>
 
+    <naming:resource-ref>
+        <naming:ref-name>jdbc/NoTxTradeDataSource</naming:ref-name>
+        <naming:resource-link>jdbc/NoTxTradeDataSource</naming:resource-link>
+    </naming:resource-ref>
+
+    <gbean name="DBInitialization" class="org.apache.geronimo.connector.wrapper.DatabaseInitializationGBean">
+        <!--sql override path
+        <attribute name="sql">
+create table OPENJPASEQ
+(ID SMALLINT NOT NULL PRIMARY KEY,
+SEQUENCE_VALUE BIGINT);
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250));
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(250),
+   PASSWD VARCHAR(250),
+   USERID VARCHAR(250) NOT NULL,
+   EMAIL VARCHAR(250),
+   CREDITCARD VARCHAR(250),
+   FULLNAME VARCHAR(250));
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(250),
+   SYMBOL VARCHAR(250) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(250));
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(250),
+   ORDERSTATUS VARCHAR(250),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);
+        </attribute>-->
+        <!-- According to your database vendor, you can put these values: db2, oracle, informix, mysql, sqlserver, postgre, other(means any other vendor)-->
+        <attribute name="path">/dbscripts/derby/Table.ddl</attribute>
+        <reference name="DataSource">
+            <name>jdbc/NoTxTradeDataSource</name>
+        </reference>
+    </gbean>
+
 </web-app>
 
 

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/pom.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/pom.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/pom.xml Sun Jun 27 03:38:58 2010
@@ -42,7 +42,7 @@
         <dependency>
             <groupId>org.apache.geronimo.samples.daytrader.plugins</groupId>
             <artifactId>daytrader-derby-datasource</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
             <type>car</type>
         </dependency>
         
@@ -93,6 +93,7 @@
                     <module>
                         <groupId>org.apache.geronimo.samples.daytrader.assemblies.web</groupId>
                         <artifactId>daytrader-web-jpa</artifactId>
+                        <version>${project.version}</version>
                         <type>war</type>
                     </module>
                     <instance>

Modified: geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/src/main/plan/plan.xml?rev=958321&r1=958320&r2=958321&view=diff
==============================================================================
--- geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/src/main/plan/plan.xml (original)
+++ geronimo/samples/branches/3.0-M1/samples/daytrader/plugins/daytrader-web-jpa-tomcat/src/main/plan/plan.xml Sun Jun 27 03:38:58 2010
@@ -19,14 +19,120 @@
 <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
              xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
              xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
-    
+    <sys:environment>        
+            <sys:dependencies>
+                <sys:dependency>
+                    <sys:groupId>org.apache.geronimo.samples.daytrader.plugins</sys:groupId>
+                    <sys:artifactId>daytrader-derby-datasource</sys:artifactId>
+                    <sys:version>${project.version}</sys:version>
+                    <sys:type>car</sys:type>
+                </sys:dependency>
+            </sys:dependencies>
+    </sys:environment>
+
     <context-root>${project.artifactId}</context-root>
 
-     <naming:resource-ref>
+    <naming:resource-ref>
         <naming:ref-name>jdbc/TradeDataSource</naming:ref-name>
         <naming:resource-link>jdbc/TradeDataSource</naming:resource-link>
     </naming:resource-ref>
 
+    <naming:resource-ref>
+        <naming:ref-name>jdbc/NoTxTradeDataSource</naming:ref-name>
+        <naming:resource-link>jdbc/NoTxTradeDataSource</naming:resource-link>
+    </naming:resource-ref>
+
+    <gbean name="DBInitialization" class="org.apache.geronimo.connector.wrapper.DatabaseInitializationGBean">
+        <!--sql override path
+        <attribute name="sql">
+create table OPENJPASEQ
+(ID SMALLINT NOT NULL PRIMARY KEY,
+SEQUENCE_VALUE BIGINT);
+
+CREATE TABLE HOLDINGEJB
+  (PURCHASEPRICE DECIMAL(14, 2),
+   HOLDINGID INTEGER NOT NULL,
+   QUANTITY DOUBLE NOT NULL,
+   PURCHASEDATE TIMESTAMP,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250));
+
+ALTER TABLE HOLDINGEJB
+  ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
+
+CREATE TABLE ACCOUNTPROFILEEJB
+  (ADDRESS VARCHAR(250),
+   PASSWD VARCHAR(250),
+   USERID VARCHAR(250) NOT NULL,
+   EMAIL VARCHAR(250),
+   CREDITCARD VARCHAR(250),
+   FULLNAME VARCHAR(250));
+
+ALTER TABLE ACCOUNTPROFILEEJB
+  ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID);
+
+CREATE TABLE QUOTEEJB
+  (LOW DECIMAL(14, 2),
+   OPEN1 DECIMAL(14, 2),
+   VOLUME DOUBLE NOT NULL,
+   PRICE DECIMAL(14, 2),
+   HIGH DECIMAL(14, 2),
+   COMPANYNAME VARCHAR(250),
+   SYMBOL VARCHAR(250) NOT NULL,
+   CHANGE1 DOUBLE NOT NULL);
+
+ALTER TABLE QUOTEEJB
+  ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL);
+
+CREATE TABLE KEYGENEJB
+  (KEYVAL INTEGER NOT NULL,
+   KEYNAME VARCHAR(250) NOT NULL);
+
+ALTER TABLE KEYGENEJB
+  ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
+
+CREATE TABLE ACCOUNTEJB
+  (CREATIONDATE TIMESTAMP,
+   OPENBALANCE DECIMAL(14, 2),
+   LOGOUTCOUNT INTEGER NOT NULL,
+   BALANCE DECIMAL(14, 2),
+   ACCOUNTID INTEGER NOT NULL,
+   LASTLOGIN TIMESTAMP,
+   LOGINCOUNT INTEGER NOT NULL,
+   PROFILE_USERID VARCHAR(250));
+
+ALTER TABLE ACCOUNTEJB
+  ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
+
+CREATE TABLE ORDEREJB
+  (ORDERFEE DECIMAL(14, 2),
+   COMPLETIONDATE TIMESTAMP,
+   ORDERTYPE VARCHAR(250),
+   ORDERSTATUS VARCHAR(250),
+   PRICE DECIMAL(14, 2),
+   QUANTITY DOUBLE NOT NULL,
+   OPENDATE TIMESTAMP,
+   ORDERID INTEGER NOT NULL,
+   ACCOUNT_ACCOUNTID INTEGER,
+   QUOTE_SYMBOL VARCHAR(250),
+   HOLDING_HOLDINGID INTEGER);
+
+ALTER TABLE ORDEREJB
+  ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
+
+CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
+CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
+CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
+CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS);
+        </attribute>-->
+        <!-- According to your database vendor, you can put these values: db2, oracle, informix, mysql, sqlserver, postgre, other(means any other vendor)-->
+        <attribute name="path">/dbscripts/derby/Table.ddl</attribute>
+        <reference name="DataSource">
+            <name>jdbc/NoTxTradeDataSource</name>
+        </reference>
+    </gbean>
+
 </web-app>
 
 



Mime
View raw message