Re: New proposal to make DAS/SDO HOW TO

2006-12-06 Thread Willian Yabusame Maja

Hi Adriano!
   I had alredy talked with Luciano about uploading the librarys in a link. 
He said that it's better to give the link to the downloads area from Tuscany 
Project.
   This is the link to the wiki page: 
http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_HOWTO_HelloDASApp . 
If you still have problem, I can help you. But first you need to create an 
account there.


   About the How To. I think now we need to put our comments, teach and 
give ideas about implementation.


Willian Yabusame Maja

- Original Message - 
From: Adriano Crestani [EMAIL PROTECTED]

To: tuscany-dev@ws.apache.org
Sent: Wednesday, December 06, 2006 3:12 AM
Subject: Re: New proposal to make DAS/SDO HOW TO



I made the first draft of the howTo. Sorry, I am still posting it here,
cause I didn't find out how to post it on the wiki (can will teach me how
Willian? please). As Luciano said the howTo doesn't need to be an entire
webapp, so I just commented what is needed to integrate the SDO/DAS with 
an

webapp. But I think that is necessary to comment where the libraries could
be easily downloaded, do you know Luciano?

Here is the howTo, feel free to edit or even to delete everything ; )

Willian and me wrote this HowTo to demonstrate the usage of SDO/DAS on a
WebApp using the MySql Server 5.0 as the database server. This HowTo will
cover how to store, get and delete any data from a database using a
ShoppingCart sample code running. A. Downloading the Libraries:

*The required libraries are:*

  1. common-{latest version}.jar
  2. ecore-{latest version}.jar
  3. ecore-change-{latest version}.jariv) ecore-xmi-{lateste
  version}.jarv) log4j-{latest version}.jar
  4. sdo-api-xxx.jar
  5. tuscany-das-rdb-xxx.jar
  6. tuscany-sdo-xxx.jarix) xsd-{latest version}.jar
  7. mysql-connector-java-{latest version}.jar - *This is the JDBC
  connector, It'll be used to connect to Mysql database.*

B. Creating ShoppingCart Database

After the setting up your enviroment, the next step will be to create the
database where the DAS will connect and manage the transaction with the 
SDO

features.

*1- Run the following commands in the Mysql Command Shell*

create database shoppingcart; - *This command will create the 
ShoppingCart

database*.use shoppingcart; - *Set the shell to work with shoppingcart
database*.



*2- Create a text file and name it as shoppingcart.sql, you should 
insert

the following lines in this file:*


CREATE TABLE CART (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 SUB_TOTAL DOUBLE,
 TAX DOUBLE,
 TOTAL DOUBLE,
 CONFIRMED INTEGER
);

CREATE TABLE ITEM (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 DESCR CHAR(30),
 UNITS INTEGER
);

CREATE TABLE CART_ITEM (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 CART_ID INTEGER,
 ITEM_ID INTEGER,
 QUANTITY INTEGER,
 FOREIGN KEY (CART_ID) REFERENCES CART(ID),
 FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
);

*3- Run the following command in the Mysql Shell *

source {path}/shoppingcart.sql - *Executes the script to create tables,
constraints, etc.*


C. Creating XML configuration file

*1- Create the file
ShoppingCartConfighttp://wiki.apache.org/ws/CompanyConfig.xml
in the same directory that you will create the ShoppingCart.class, edit it
and write the following code: *

?xml version=1.0 encoding=ASCII?
Config xmlns=http:///org.apache.tuscany.das.rdb/config.xsd;

ConnectionInfo dataSource=java:comp/env/jdbc/shoppingcart/

Command name=all carts SQL=SELECT * FROM CART kind=Select/

Command name=all carts x items SQL=SELECT * FROM CART_ITEM
kind=Select/

Command name=get cart item SQL=SELECT * from CART_ITEM WHERE CART_ID = 
?

AND ITEM_ID = ? kind=Select/

Command name=all cart items SQL=SELECT * from CART_ITEM WHERE CART_ID 
=

? kind=Select/

Command name=all items SQL=select * FROM ITEM kind=Select/

Command name=get item SQL=select * FROM ITEM WHERE ID = ?
kind=Select/

Command name=get cart SQL=select * FROM CART WHERE ID = ?
kind=Select/

Table tableName=CART

Column columnName=ID primaryKey=true generated=true/

/Table

/Config

*2- Save the file. *

C. Creating the Servlet ClassThis ShoppingCart class is just a
collection of methods that create and get carts or items, add or remove
items from a cart and cofirm an order. Then you can call these methods
directly from your .jsp. This class try to connect to database using the
user root and the password tuscany, but you may modify it in the 
method

getConnection().

import java.io.IOException;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.tuscany.das.rdb.Command;
import org.apache.tuscany.das.rdb.DAS;

import commonj.sdo.DataObject;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class

Re: New proposal to make DAS/SDO HOW TO

2006-12-05 Thread Luciano Resende
/

Command name=all carts x items SQL=SELECT * FROM CART_ITEM
kind=Select/

Command name=get cart item SQL=SELECT * from CART_ITEM WHERE
CART_ID
= ? AND ITEM_ID = ? kind=Select/

Command name=all cart items SQL=SELECT * from CART_ITEM WHERE
CART_ID = ? kind=Select/

Command name=all items SQL=select * FROM ITEM  kind=Select/

Command name=get item SQL=select * FROM ITEM WHERE ID = ?
kind=Select/

Command name=get cart SQL=select * FROM CART WHERE ID = ?
kind=Select/


Table tableName=CART
Column columnName=ID primaryKey=true generated=true/
/Table


/Config

The tables for mysql server 5.0:

CREATE TABLE CART (
  ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  SUB_TOTAL DOUBLE,
  TAX DOUBLE,
  TOTAL DOUBLE,
  CONFIRMED INTEGER
);

CREATE TABLE ITEM (
  ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  DESCR CHAR(30),
  UNITS INTEGER
);

CREATE TABLE CART_ITEM (
  ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  CART_ID INTEGER,
  ITEM_ID INTEGER,
  QUANTITY INTEGER,
  FOREIGN KEY (CART_ID) REFERENCES CART(ID),
  FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
);

Adriano Crestani

On 12/4/06, Adriano Crestani [EMAIL PROTECTED] wrote:

 Sorry, but I was a bit busy last week. I'm still trying to finish that
 methods for the howto. I'm getting some problems when I try to remove
any
 tuple from the database, but I think it's a jdbc problem. I'm actually
 working on it and if I find any specific problem I will post it here ;
).
 Hey, Willian, have you written anything?

 Adriano Crestani

 On 12/4/06, Luciano Resende [EMAIL PROTECTED] wrote:
 
  Hi Adriano and William
 
 Any progress with the HOW-TO ? Any blocking issues ? Any help,
  guidance
  needed ?
 
  - Luciano
 
  On 11/17/06, Katja [EMAIL PROTECTED] wrote:
  
   Hi Willian!
  
   Thanks for your test! Now I found my error and everything works!
  
   The problem was, that in the bigbank sample a mapping between the
  table
   and the SDO is used. The SDO classes are generated from WSDL with
  XSD2SDO.
   The mapping connects these classes to the tables.
  
   In the original bigbank sample the DASAccountConfiguration.xml looks
  like:
   Table tableName=STOCKS typeName=StockSummary
 Column columnName=ID propertyName=id /
 Column columnName=Symbol propertyName=symbol /
 Column columnName=quantity propertyName=quantity /
 Column columnName=purchasePrice propertyName=purchasePrice /
 Column columnName=PURCHASEDATE propertyName=purchaseDate
   converterClassName=
  
 
bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter
  
   /
   /Table
  
   I had problems with the Timestamp-column PURCHASEDATE only because
  it
   was misspelled. The right spelling of the column name is
  purchaseDate. I
   changed it, and now it works.
  
   Maybe this should be changed in the repository to prevent others of
  this
   error.
  
   If you are interested, here is the code which is used to read from
the
   database:
  
   //Reading mapping from DASAccountConfiguration.xml
   InputStream mapping = createConfigStream();
  
   Connection conn = getConnection();
   DAS das = DAS.FACTORY.createDAS(mapping, conn);
  
   Command select = das.createCommand(SELECT Symbol, quantity,
   purchasePrice, purchaseDate, purchaseLotNumber  FROM stocks where id
=
  ?);
   select.setParameter(1, customerID);
  
   DataObject root = select.executeQuery();
   accountReport.getStockSummaries().addAll(root.getList
  (StockSummary));
  
   Thanks,
   Katja
  
    Original-Nachricht 
   Datum: Thu, 16 Nov 2006 18:00:26 +
   Von: Willian Maja [EMAIL PROTECTED]
   An: tuscany-dev@ws.apache.org
   Betreff: Re: New proposal to make DAS/SDO HOW TO
  
I think I didn't understand what you want. But i tested using
  TimeStamp
and
DateTime:
   
   CREATE TABLE test (ID integer not null AUTO_INCREMENT,
  timestamp
timestamp, datetime datetime, primary key (ID));
   
   INSERT INTO test VALUES ();
   
This will create the following row:
   
   |  1   | 2006-11-16 14:10:24.0|NULL
   
   
Now I will read the timestamp:
   
 Command read = das.createCommand(select * from test);
 DataObject root = read.executeQuery();
 DataObject node = root.getDataObject(test[1]);
 java.util.Date date = node.getDate(timestamp); // You
  must
   use
java.util.Date, not java.sql.Date
   
 System.out.println(date.getHours()); // Print the hours
 System.out.println(date.getMonth()); // Print the month
 System.out.println(node.getDate(date)); // Print the
   TimeStamp
ex:2006-11-16 14:12:23.0
   
   
To save DateTime I used the following code:
 //Continuing the last code, I'm going to save the
TimeStamp
  in
the
DateTime column
node.setDate(datetime, date);
das.applyChanges(root);
   
Now the row 1 from the test table

Re: New proposal to make DAS/SDO HOW TO

2006-12-05 Thread Adriano Crestani
();
 return null;

 }

 try {
 java.sql.Connection con = DriverManager.getConnection(

 jdbc:mysql://localhost:3306/shoppingcart,root,tuscany);
 con.setAutoCommit(false);
 return con;

 } catch(SQLException e) {
 e.printStackTrace();
 return null;

 }

 }

 }

 ShoppingCartConfig.xml

 ?xml version=1.0 encoding=ASCII?
 Config xmlns= http:///org.apache.tuscany.das.rdb/config.xsd;

 ConnectionInfo dataSource=java:comp/env/jdbc/shoppingcart/

 Command name=all carts SQL=SELECT * FROM CART kind=Select/

 Command name=all carts x items SQL=SELECT * FROM CART_ITEM
 kind=Select/

 Command name=get cart item SQL=SELECT * from CART_ITEM WHERE
 CART_ID
 = ? AND ITEM_ID = ? kind=Select/

 Command name=all cart items SQL=SELECT * from CART_ITEM WHERE
 CART_ID = ? kind=Select/

 Command name=all items SQL=select * FROM ITEM  kind=Select/

 Command name=get item SQL=select * FROM ITEM WHERE ID = ?
 kind=Select/

 Command name=get cart SQL=select * FROM CART WHERE ID = ?
 kind=Select/


 Table tableName=CART
 Column columnName=ID primaryKey=true generated=true/
 /Table


 /Config

 The tables for mysql server 5.0:

 CREATE TABLE CART (
   ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
   SUB_TOTAL DOUBLE,
   TAX DOUBLE,
   TOTAL DOUBLE,
   CONFIRMED INTEGER
 );

 CREATE TABLE ITEM (
   ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
   DESCR CHAR(30),
   UNITS INTEGER
 );

 CREATE TABLE CART_ITEM (
   ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
   CART_ID INTEGER,
   ITEM_ID INTEGER,
   QUANTITY INTEGER,
   FOREIGN KEY (CART_ID) REFERENCES CART(ID),
   FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
 );

 Adriano Crestani

 On 12/4/06, Adriano Crestani [EMAIL PROTECTED] wrote:
 
  Sorry, but I was a bit busy last week. I'm still trying to finish that

  methods for the howto. I'm getting some problems when I try to remove
 any
  tuple from the database, but I think it's a jdbc problem. I'm actually
  working on it and if I find any specific problem I will post it here ;

 ).
  Hey, Willian, have you written anything?
 
  Adriano Crestani
 
  On 12/4/06, Luciano Resende [EMAIL PROTECTED]  wrote:
  
   Hi Adriano and William
  
  Any progress with the HOW-TO ? Any blocking issues ? Any help,
   guidance
   needed ?
  
   - Luciano
  
   On 11/17/06, Katja [EMAIL PROTECTED] wrote:
   
Hi Willian!
   
Thanks for your test! Now I found my error and everything works!
   
The problem was, that in the bigbank sample a mapping between the
   table
and the SDO is used. The SDO classes are generated from WSDL with
   XSD2SDO.
The mapping connects these classes to the tables.
   
In the original bigbank sample the DASAccountConfiguration.xmllooks
   like:
Table tableName=STOCKS typeName=StockSummary
  Column columnName=ID propertyName=id /
  Column columnName=Symbol propertyName=symbol /
  Column columnName=quantity propertyName=quantity /
  Column columnName=purchasePrice propertyName=purchasePrice
/
  Column columnName=PURCHASEDATE propertyName=purchaseDate
converterClassName=
   
  

bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter
   
/
/Table
   
I had problems with the Timestamp-column PURCHASEDATE only
because
   it
was misspelled. The right spelling of the column name is
   purchaseDate. I
changed it, and now it works.
   
Maybe this should be changed in the repository to prevent others
of
   this
error.
   
If you are interested, here is the code which is used to read from

 the
database:
   
//Reading mapping from DASAccountConfiguration.xml
InputStream mapping = createConfigStream();
   
Connection conn = getConnection();
DAS das = DAS.FACTORY.createDAS(mapping, conn);
   
Command select = das.createCommand(SELECT Symbol, quantity,
purchasePrice, purchaseDate, purchaseLotNumber  FROM stocks where
id
 =
   ?);
select.setParameter(1, customerID);
   
DataObject root = select.executeQuery();
accountReport.getStockSummaries().addAll(root.getList
   (StockSummary));
   
Thanks,
Katja
   
 Original-Nachricht 
Datum: Thu, 16 Nov 2006 18:00:26 +
Von: Willian Maja  [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO
   
 I think I didn't understand what you want. But i tested using
   TimeStamp
 and
 DateTime:

CREATE TABLE test (ID integer not null AUTO_INCREMENT,
   timestamp
 timestamp, datetime datetime, primary key (ID));

INSERT INTO test VALUES ();

 This will create the following row:

|  1   | 2006-11-16 14:10:24.0|NULL


 Now I will read the timestamp:

  Command read = das.createCommand(select * from test);
  DataObject root

Re: New proposal to make DAS/SDO HOW TO

2006-12-05 Thread Luciano Resende
]
 An: tuscany-dev@ws.apache.org
 Betreff: Re: New proposal to make DAS/SDO HOW TO

  I think I didn't understand what you want. But i tested using
TimeStamp
  and
  DateTime:
 
 CREATE TABLE test (ID integer not null AUTO_INCREMENT,
timestamp
  timestamp, datetime datetime, primary key (ID));
 
 INSERT INTO test VALUES ();
 
  This will create the following row:
 
 |  1   | 2006-11-16 14:10:24.0|NULL
 
 
  Now I will read the timestamp:
 
   Command read = das.createCommand(select * from
test);
   DataObject root = read.executeQuery();
   DataObject node = root.getDataObject(test[1]);
   java.util.Date date = node.getDate(timestamp); //
You
must
 use
  java.util.Date, not java.sql.Date
 
   System.out.println(date.getHours()); // Print the
hours

   System.out.println(date.getMonth()); // Print the
month
   System.out.println(node.getDate(date)); // Print
the
 TimeStamp
  ex:2006-11-16 14:12:23.0
 
 
  To save DateTime I used the following code:
   //Continuing the last code, I'm going to save the
  TimeStamp
in
  the
  DateTime column
  node.setDate(datetime, date);
  das.applyChanges(root);
 
  Now the row 1 from the test table will be:
 
  |  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10:
 24.0
 
 
  I read/updated the row with datetime and timestamp column.
  If this wasn't what you want, please send me the code you want
 to
make
  work
  with SDO/Mysql.
 
 
 
 
  From: Katja  [EMAIL PROTECTED]
  Reply-To: tuscany-dev@ws.apache.org
  To: tuscany-dev@ws.apache.org
  Subject: Re: New proposal to make DAS/SDO HOW TO
  Date: Thu, 16 Nov 2006 17:29:58 +0100
  
  Hi Willian!
  
  Thank you for the example! You tested with a Date-Column,
that
worked
 in
  my
  application, too, because no conversion between the column
and
  the
data
  object value is necessary.
  
  With DateTime a converter is needed:
  SDO format: 2006-11-16T17:22
  MySQL format: 2006-11-16 17:22
  
  The bigbank sample has a DateConverter for this issue, but
this
does
 only
  work with Derby and not with MySQL. I don't know why. I
posted
  the
 error
  last time:
  
  http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html
  
  It would be great, if you could test again with a DateTime or
Timestamp
  column and tell me your solution.
  
  Thanks,
  Katja
  
  
  
   Original-Nachricht 
  Datum: Thu, 16 Nov 2006 16:08:48 +
  Von: Willian Maja  [EMAIL PROTECTED]
  An: tuscany-dev@ws.apache.org
  Betreff: Re: New proposal to make DAS/SDO HOW TO
  
Hi Katja,
   
I've just tested to read Date column, and it works.
I'm
going to
  paste
my code here for you:
   
This will be the test table, it's just a simple table with
a

 DateTime
Column.
   
CREATE TABLE test (ID integer not null AUTO_INCREMENT,
date_column
  date);
INSERT INTO test (date_column) VALUES (06-11-16);
   
Now you should create your Das connection. In my code
 example
I'll
 not
  use
XML configuration. I'm going to create the Command:
   
Command read = das.createCommand(select * from
  test);
  //Create
the
  Command
DataObject root = read.executeQuery();
DataObject row = root.getDataObject(teste[1]);
//
  Get
the
  first
row from test table;
System.out.println (row.getDate(date_column));
//
Print the
DateTime
   
   
I think this will help you :).
   
Bye.
   
   
   
   
From: Katja [EMAIL PROTECTED] 
Reply-To: tuscany-dev@ws.apache.org
To: tuscany-dev@ws.apache.org
Subject: Re: New proposal to make DAS/SDO HOW TO
Date: Thu, 16 Nov 2006 09:14:28 +0100

Hi!

Is it possible to add a Timestamp or DateTime column to
the
 database?
  I
am
very interested in how to access these columns with DAS
and
MySQL
  because
I
have not succeeded in doing this.

Thanks,
Katja

 Original-Nachricht 
Datum: Thu, 16 Nov 2006 03:44:18 -0400
Von: Adriano Crestani  [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

  Willian, I created these tables, that will possible be
  used

Re: New proposal to make DAS/SDO HOW TO

2006-12-04 Thread Luciano Resende

Hi Adriano and William

  Any progress with the HOW-TO ? Any blocking issues ? Any help, guidance
needed ?

- Luciano

On 11/17/06, Katja [EMAIL PROTECTED] wrote:


Hi Willian!

Thanks for your test! Now I found my error and everything works!

The problem was, that in the bigbank sample a mapping between the table
and the SDO is used. The SDO classes are generated from WSDL with XSD2SDO.
The mapping connects these classes to the tables.

In the original bigbank sample the DASAccountConfiguration.xml looks like:
Table tableName=STOCKS typeName=StockSummary
  Column columnName=ID propertyName=id /
  Column columnName=Symbol propertyName=symbol /
  Column columnName=quantity propertyName=quantity /
  Column columnName=purchasePrice propertyName=purchasePrice /
  Column columnName=PURCHASEDATE propertyName=purchaseDate
converterClassName=
bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter
/
/Table

I had problems with the Timestamp-column PURCHASEDATE only because it
was misspelled. The right spelling of the column name is purchaseDate. I
changed it, and now it works.

Maybe this should be changed in the repository to prevent others of this
error.

If you are interested, here is the code which is used to read from the
database:

//Reading mapping from DASAccountConfiguration.xml
InputStream mapping = createConfigStream();

Connection conn = getConnection();
DAS das = DAS.FACTORY.createDAS(mapping, conn);

Command select = das.createCommand(SELECT Symbol, quantity,
purchasePrice, purchaseDate, purchaseLotNumber  FROM stocks where id = ?);
select.setParameter(1, customerID);

DataObject root = select.executeQuery();
accountReport.getStockSummaries().addAll(root.getList(StockSummary));

Thanks,
Katja

 Original-Nachricht 
Datum: Thu, 16 Nov 2006 18:00:26 +
Von: Willian Maja [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 I think I didn't understand what you want. But i tested using TimeStamp
 and
 DateTime:

CREATE TABLE test (ID integer not null AUTO_INCREMENT, timestamp
 timestamp, datetime datetime, primary key (ID));

INSERT INTO test VALUES ();

 This will create the following row:

|  1   | 2006-11-16 14:10:24.0|NULL


 Now I will read the timestamp:

  Command read = das.createCommand(select * from test);
  DataObject root = read.executeQuery();
  DataObject node = root.getDataObject(test[1]);
  java.util.Date date = node.getDate(timestamp); // You must
use
 java.util.Date, not java.sql.Date

  System.out.println(date.getHours()); // Print the hours
  System.out.println(date.getMonth()); // Print the month
  System.out.println(node.getDate(date)); // Print the
TimeStamp
 ex:2006-11-16 14:12:23.0


 To save DateTime I used the following code:
  //Continuing the last code, I'm going to save the TimeStamp in
 the
 DateTime column
 node.setDate(datetime, date);
 das.applyChanges(root);

 Now the row 1 from the test table will be:

 |  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10:24.0


 I read/updated the row with datetime and timestamp column.
 If this wasn't what you want, please send me the code you want to make
 work
 with SDO/Mysql.




 From: Katja [EMAIL PROTECTED]
 Reply-To: tuscany-dev@ws.apache.org
 To: tuscany-dev@ws.apache.org
 Subject: Re: New proposal to make DAS/SDO HOW TO
 Date: Thu, 16 Nov 2006 17:29:58 +0100
 
 Hi Willian!
 
 Thank you for the example! You tested with a Date-Column, that worked
in
 my
 application, too, because no conversion between the column and the data
 object value is necessary.
 
 With DateTime a converter is needed:
 SDO format: 2006-11-16T17:22
 MySQL format: 2006-11-16 17:22
 
 The bigbank sample has a DateConverter for this issue, but this does
only
 work with Derby and not with MySQL. I don't know why. I posted the
error
 last time:
 http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html
 
 It would be great, if you could test again with a DateTime or Timestamp
 column and tell me your solution.
 
 Thanks,
 Katja
 
 
 
  Original-Nachricht 
 Datum: Thu, 16 Nov 2006 16:08:48 +
 Von: Willian Maja [EMAIL PROTECTED]
 An: tuscany-dev@ws.apache.org
 Betreff: Re: New proposal to make DAS/SDO HOW TO
 
   Hi Katja,
  
   I've just tested to read Date column, and it works. I'm going to
 paste
   my code here for you:
  
   This will be the test table, it's just a simple table with a
DateTime
   Column.
  
   CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column
 date);
   INSERT INTO test (date_column) VALUES (06-11-16);
  
   Now you should create your Das connection. In my code example I'll
not
 use
   XML configuration. I'm going to create the Command:
  
   Command read = das.createCommand(select * from test);
 //Create
   the
 Command
   DataObject root = read.executeQuery

Re: New proposal to make DAS/SDO HOW TO

2006-12-04 Thread Adriano Crestani
 5.0:

CREATE TABLE CART (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 SUB_TOTAL DOUBLE,
 TAX DOUBLE,
 TOTAL DOUBLE,
 CONFIRMED INTEGER
);

CREATE TABLE ITEM (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 DESCR CHAR(30),
 UNITS INTEGER
);

CREATE TABLE CART_ITEM (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 CART_ID INTEGER,
 ITEM_ID INTEGER,
 QUANTITY INTEGER,
 FOREIGN KEY (CART_ID) REFERENCES CART(ID),
 FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
);

Adriano Crestani

On 12/4/06, Adriano Crestani [EMAIL PROTECTED] wrote:


Sorry, but I was a bit busy last week. I'm still trying to finish that
methods for the howto. I'm getting some problems when I try to remove any
tuple from the database, but I think it's a jdbc problem. I'm actually
working on it and if I find any specific problem I will post it here ; ).
Hey, Willian, have you written anything?

Adriano Crestani

On 12/4/06, Luciano Resende [EMAIL PROTECTED] wrote:

 Hi Adriano and William

Any progress with the HOW-TO ? Any blocking issues ? Any help,
 guidance
 needed ?

 - Luciano

 On 11/17/06, Katja [EMAIL PROTECTED] wrote:
 
  Hi Willian!
 
  Thanks for your test! Now I found my error and everything works!
 
  The problem was, that in the bigbank sample a mapping between the
 table
  and the SDO is used. The SDO classes are generated from WSDL with
 XSD2SDO.
  The mapping connects these classes to the tables.
 
  In the original bigbank sample the DASAccountConfiguration.xml looks
 like:
  Table tableName=STOCKS typeName=StockSummary
Column columnName=ID propertyName=id /
Column columnName=Symbol propertyName=symbol /
Column columnName=quantity propertyName=quantity /
Column columnName=purchasePrice propertyName=purchasePrice /
Column columnName=PURCHASEDATE propertyName=purchaseDate
  converterClassName=
 
 bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter
 
  /
  /Table
 
  I had problems with the Timestamp-column PURCHASEDATE only because
 it
  was misspelled. The right spelling of the column name is
 purchaseDate. I
  changed it, and now it works.
 
  Maybe this should be changed in the repository to prevent others of
 this
  error.
 
  If you are interested, here is the code which is used to read from the
  database:
 
  //Reading mapping from DASAccountConfiguration.xml
  InputStream mapping = createConfigStream();
 
  Connection conn = getConnection();
  DAS das = DAS.FACTORY.createDAS(mapping, conn);
 
  Command select = das.createCommand(SELECT Symbol, quantity,
  purchasePrice, purchaseDate, purchaseLotNumber  FROM stocks where id =
 ?);
  select.setParameter(1, customerID);
 
  DataObject root = select.executeQuery();
  accountReport.getStockSummaries().addAll(root.getList
 (StockSummary));
 
  Thanks,
  Katja
 
   Original-Nachricht 
  Datum: Thu, 16 Nov 2006 18:00:26 +
  Von: Willian Maja [EMAIL PROTECTED]
  An: tuscany-dev@ws.apache.org
  Betreff: Re: New proposal to make DAS/SDO HOW TO
 
   I think I didn't understand what you want. But i tested using
 TimeStamp
   and
   DateTime:
  
  CREATE TABLE test (ID integer not null AUTO_INCREMENT,
 timestamp
   timestamp, datetime datetime, primary key (ID));
  
  INSERT INTO test VALUES ();
  
   This will create the following row:
  
  |  1   | 2006-11-16 14:10:24.0|NULL
  
  
   Now I will read the timestamp:
  
Command read = das.createCommand(select * from test);
DataObject root = read.executeQuery();
DataObject node = root.getDataObject(test[1]);
java.util.Date date = node.getDate(timestamp); // You
 must
  use
   java.util.Date, not java.sql.Date
  
System.out.println(date.getHours()); // Print the hours
System.out.println(date.getMonth()); // Print the month
System.out.println(node.getDate(date)); // Print the
  TimeStamp
   ex:2006-11-16 14:12:23.0
  
  
   To save DateTime I used the following code:
//Continuing the last code, I'm going to save the TimeStamp
 in
   the
   DateTime column
   node.setDate(datetime, date);
   das.applyChanges(root);
  
   Now the row 1 from the test table will be:
  
   |  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10: 24.0
  
  
   I read/updated the row with datetime and timestamp column.
   If this wasn't what you want, please send me the code you want to
 make
   work
   with SDO/Mysql.
  
  
  
  
   From: Katja [EMAIL PROTECTED]
   Reply-To: tuscany-dev@ws.apache.org
   To: tuscany-dev@ws.apache.org
   Subject: Re: New proposal to make DAS/SDO HOW TO
   Date: Thu, 16 Nov 2006 17:29:58 +0100
   
   Hi Willian!
   
   Thank you for the example! You tested with a Date-Column, that
 worked
  in
   my
   application, too, because no conversion between the column and the
 data
   object value is necessary.
   
   With DateTime a converter is needed:
   SDO format: 2006-11-16T17:22
   MySQL format: 2006-11-16

Re: New proposal to make DAS/SDO HOW TO

2006-11-17 Thread Katja
Hi Willian!

Thanks for your test! Now I found my error and everything works!

The problem was, that in the bigbank sample a mapping between the table and the 
SDO is used. The SDO classes are generated from WSDL with XSD2SDO. The mapping 
connects these classes to the tables. 

In the original bigbank sample the DASAccountConfiguration.xml looks like:
Table tableName=STOCKS typeName=StockSummary
  Column columnName=ID propertyName=id /
  Column columnName=Symbol propertyName=symbol /
  Column columnName=quantity propertyName=quantity /
  Column columnName=purchasePrice propertyName=purchasePrice /
  Column columnName=PURCHASEDATE propertyName=purchaseDate 
converterClassName=bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter
 /
/Table

I had problems with the Timestamp-column PURCHASEDATE only because it was 
misspelled. The right spelling of the column name is purchaseDate. I changed 
it, and now it works.

Maybe this should be changed in the repository to prevent others of this error.

If you are interested, here is the code which is used to read from the database:

//Reading mapping from DASAccountConfiguration.xml 
InputStream mapping = createConfigStream(); 

Connection conn = getConnection();
DAS das = DAS.FACTORY.createDAS(mapping, conn);

Command select = das.createCommand(SELECT Symbol, quantity, purchasePrice, 
purchaseDate, purchaseLotNumber  FROM stocks where id = ?);
select.setParameter(1, customerID);

DataObject root = select.executeQuery();
accountReport.getStockSummaries().addAll(root.getList(StockSummary)); 

Thanks,
Katja

 Original-Nachricht 
Datum: Thu, 16 Nov 2006 18:00:26 +
Von: Willian Maja [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 I think I didn't understand what you want. But i tested using TimeStamp
 and 
 DateTime:
 
CREATE TABLE test (ID integer not null AUTO_INCREMENT, timestamp 
 timestamp, datetime datetime, primary key (ID));
 
INSERT INTO test VALUES ();
 
 This will create the following row:
 
|  1   | 2006-11-16 14:10:24.0|NULL
 
 
 Now I will read the timestamp:
 
  Command read = das.createCommand(select * from test);
  DataObject root = read.executeQuery();
  DataObject node = root.getDataObject(test[1]);
  java.util.Date date = node.getDate(timestamp); // You must use 
 java.util.Date, not java.sql.Date
 
  System.out.println(date.getHours()); // Print the hours
  System.out.println(date.getMonth()); // Print the month
  System.out.println(node.getDate(date)); // Print the TimeStamp 
 ex:2006-11-16 14:12:23.0
 
 
 To save DateTime I used the following code:
  //Continuing the last code, I'm going to save the TimeStamp in
 the 
 DateTime column
 node.setDate(datetime, date);
 das.applyChanges(root);
 
 Now the row 1 from the test table will be:
 
 |  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10:24.0
 
 
 I read/updated the row with datetime and timestamp column.
 If this wasn't what you want, please send me the code you want to make
 work 
 with SDO/Mysql.
 
 
 
 
 From: Katja [EMAIL PROTECTED]
 Reply-To: tuscany-dev@ws.apache.org
 To: tuscany-dev@ws.apache.org
 Subject: Re: New proposal to make DAS/SDO HOW TO
 Date: Thu, 16 Nov 2006 17:29:58 +0100
 
 Hi Willian!
 
 Thank you for the example! You tested with a Date-Column, that worked in
 my 
 application, too, because no conversion between the column and the data 
 object value is necessary.
 
 With DateTime a converter is needed:
 SDO format: 2006-11-16T17:22
 MySQL format: 2006-11-16 17:22
 
 The bigbank sample has a DateConverter for this issue, but this does only
 work with Derby and not with MySQL. I don't know why. I posted the error 
 last time: 
 http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html
 
 It would be great, if you could test again with a DateTime or Timestamp 
 column and tell me your solution.
 
 Thanks,
 Katja
 
 
 
  Original-Nachricht 
 Datum: Thu, 16 Nov 2006 16:08:48 +
 Von: Willian Maja [EMAIL PROTECTED]
 An: tuscany-dev@ws.apache.org
 Betreff: Re: New proposal to make DAS/SDO HOW TO
 
   Hi Katja,
  
   I've just tested to read Date column, and it works. I'm going to 
 paste
   my code here for you:
  
   This will be the test table, it's just a simple table with a DateTime
   Column.
  
   CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column 
 date);
   INSERT INTO test (date_column) VALUES (06-11-16);
  
   Now you should create your Das connection. In my code example I'll not
 use
   XML configuration. I'm going to create the Command:
  
   Command read = das.createCommand(select * from test);
 //Create
   the
 Command
   DataObject root = read.executeQuery();
   DataObject row = root.getDataObject(teste[1]); // Get the 
 first
   row from test table

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Katja
Hi!

Is it possible to add a Timestamp or DateTime column to the database? I am very 
interested in how to access these columns with DAS and MySQL because I have not 
succeeded in doing this.

Thanks,
Katja

 Original-Nachricht 
Datum: Thu, 16 Nov 2006 03:44:18 -0400
Von: Adriano Crestani [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 Willian, I created these tables, that will possible be used in the
 shopping
 cart app. It's simple, but I think a howto sample must be simple. And if
 you
 want to add anything, feel free ; )
 
 CREATE TABLE CART (
 ID INTEGER,
 PRIMARY KEY (ID)
 );
 
 CREATE TABLE ITEM (
 ID INTEGER,
 ITEM VARCHAR(30),
 UNITS INTEGER,
 CART_ID INTEGER,
 PRIMARY KEY (ID),
 FOREIGN KEY (CART_ID) REFERENCES CART(ID)
 );
 
 
 
 On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:
 
  Hey Guys
 
 Very good to see some progress and some contents being generated. I
  agree
  with you guys when you say this is becoming more like a user guide,
  instead
  of a How To, and building it describing a new scenario would probably
 make
  things more clear, altough let's try to keep it simple on the beginning,
  otherwise we are going to get a White paper :)
 
 I think we should describe actions that you would take when trying to
  create an application and describe how you would do it (e.g Now we need
 to
  execute a query to read the list of products, and this is how you would
 do
  using DAS), and point the user to further documentation in case it
  needs/want to know more about the specific feature (e.g if they want to
  learn the whole syntax/xsd of the das config file).
 
 I think couple things should not be covered on the How to :
- How to build a war file
- How to create a database (altough you might provide the SQL
  statements to create the tables you would use or at least describe the
 DB
  schema)
 
 Now, talking about what should be in this how-to
- We could start very simple... 1 product table, and one simple
 jsp
  that gives you a list of the products available
- Using MySQL is good, altough this how to should not really be
  database dependent, right ? we could point it to any database, and you
  guys
  could maybe elaborate on what change would be necessary to do this :)
 
 Also, I think this how to does not necessarily need to produce a
  working
  application, as it's intended to show how people would use DAS. If we
 want
  to spend time creating an application, I'd suggest doing this as another
  task, and finish the one I have started as part of
  http://issues.apache.org/jira/browse/TUSCANY-800
 
  Let me know if you have any further questions... let's continue to
  updating
  the wiki, and please let me know when you guys want me to take a look
 and
  provide a feedback on the contents...
 
  BTW, others are welcome to voice their opinion on what direction we
 should
  take here...
 
 
  - Luciano Resende
  Apache Tuscany
 
 
  On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:
  
   I've decribed the XML configuration file, but it's still looking like
 a
   user
   guide than a howto. I think the CompanyWeb sample is to simple and
  doesn't
   cover well all the DAS features. So lets make this Shopping Cart
   application
   trying to use all the DAS features. Then we will be able to do a very
   useful
   howto.
  
 My propose is that this app must have at least:
  
- 1 functionality that requires a SQL command with arguments.
 Then
  we
   cover how to deal with arguments in SQL commands.
  
   - 1 table that has one autoincrement key column to cover the
   genarated
   attribute on the howto.
  
   - 1 table that requires a concurrency control to cover the
   concurrency
   attribute on the howto.
  
  - 1 table containing a foreign key to cover how to explicit in the
  XML
   configuration file the link between two tables. There will probabily
 be
  a
   foreign key in its database anyway. ; )
  
   I think also a good idea to use the MySql as the database server, once
   it's
   the most used server on webapps ; )
  
   We must discuss how will be the Shopping Cart GUI, it must be simple
  once
   it's not the focus of our howto. I think a simple html genarated by a
  jsp
   is
   enough. ; )
  
   Adriano Crestani
  
   On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:
   
Hello Tuscany Community!
   
Adriano Crestani and I are working together on a HelloWorld DAS
  How
To. I have uploaded what we have done so far to
   
  
 
 http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_HOWTO_HelloDASApp
   
We were using the CompanyWeb sample application to make this
step-by-step how-to and teach how to use the DAS/SDO Features. We
 are
   not
liking what this is becoming, as it's looking more like a
   user-gide/readme
then really a how

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Luciano Resende

Won't the Cart x Item relationship be a many to many relationship ?
Currently, one item can only be in one cart, right ?
You probably looking for something like this

CREATE TABLE CART (
  ID INTEGER PRIMARY KEY,
  SUB_TOTAL DOUBLE,
  TAX DOUBLE,
  TOTAL DOUBLE
);

CREATE TABLE ITEM (
  ID INTEGER,
  DESC VARCHAR(30),
  UNITS INTEGER,
  PRICE DOUBLE
);

CREATE TABLE CART_ITEM(
  CART_ID INTEGER,
  ITEM_ID INTEGER,
  QUANTITY INTEGER,
  FOREIGN KEY (CART_ID) REFERENCES CART(ID),
  FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
)



--
Luciano Resende
http://people.apache.org/~lresende http://people.apache.org/%7Elresende

On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:


Willian, I created these tables, that will possible be used in the
shopping
cart app. It's simple, but I think a howto sample must be simple. And if
you
want to add anything, feel free ; )

CREATE TABLE CART (
ID INTEGER,
PRIMARY KEY (ID)
);

CREATE TABLE ITEM (
ID INTEGER,
ITEM VARCHAR(30),
UNITS INTEGER,
CART_ID INTEGER,
PRIMARY KEY (ID),
FOREIGN KEY (CART_ID) REFERENCES CART(ID)
);



On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:

 Hey Guys

Very good to see some progress and some contents being generated. I
 agree
 with you guys when you say this is becoming more like a user guide,
 instead
 of a How To, and building it describing a new scenario would probably
make
 things more clear, altough let's try to keep it simple on the beginning,

 otherwise we are going to get a White paper :)

I think we should describe actions that you would take when trying to
 create an application and describe how you would do it (e.g Now we need
to
 execute a query to read the list of products, and this is how you would
do
 using DAS), and point the user to further documentation in case it
 needs/want to know more about the specific feature (e.g if they want to
 learn the whole syntax/xsd of the das config file).

I think couple things should not be covered on the How to :
   - How to build a war file
   - How to create a database (altough you might provide the SQL
 statements to create the tables you would use or at least describe the
DB
 schema)

Now, talking about what should be in this how-to
   - We could start very simple... 1 product table, and one simple
jsp
 that gives you a list of the products available
   - Using MySQL is good, altough this how to should not really be
 database dependent, right ? we could point it to any database, and you
 guys
 could maybe elaborate on what change would be necessary to do this :)

Also, I think this how to does not necessarily need to produce a
 working
 application, as it's intended to show how people would use DAS. If we
want
 to spend time creating an application, I'd suggest doing this as another
 task, and finish the one I have started as part of
 http://issues.apache.org/jira/browse/TUSCANY-800

 Let me know if you have any further questions... let's continue to
 updating
 the wiki, and please let me know when you guys want me to take a look
and
 provide a feedback on the contents...

 BTW, others are welcome to voice their opinion on what direction we
should
 take here...


 - Luciano Resende
 Apache Tuscany


 On 11/15/06, Adriano Crestani  [EMAIL PROTECTED] wrote:
 
  I've decribed the XML configuration file, but it's still looking like
a
  user
  guide than a howto. I think the CompanyWeb sample is to simple and
 doesn't
  cover well all the DAS features. So lets make this Shopping Cart
  application
  trying to use all the DAS features. Then we will be able to do a very
  useful
  howto.
 
My propose is that this app must have at least:
 
   - 1 functionality that requires a SQL command with arguments.
Then
 we
  cover how to deal with arguments in SQL commands.
 
  - 1 table that has one autoincrement key column to cover the
  genarated
  attribute on the howto.
 
  - 1 table that requires a concurrency control to cover the
  concurrency
  attribute on the howto.
 
 - 1 table containing a foreign key to cover how to explicit in the
 XML
  configuration file the link between two tables. There will probabily
be
 a
  foreign key in its database anyway. ; )
 
  I think also a good idea to use the MySql as the database server, once
  it's
  the most used server on webapps ; )
 
  We must discuss how will be the Shopping Cart GUI, it must be simple
 once
  it's not the focus of our howto. I think a simple html genarated by a
 jsp
  is
  enough. ; )
 
  Adriano Crestani
 
  On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:
  
   Hello Tuscany Community!
  
   Adriano Crestani and I are working together on a HelloWorld DAS
 How
   To. I have uploaded what we have done so far to
  
 
 
http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_HOWTO_HelloDASApp

  
   We were using the CompanyWeb sample application to make this
   step-by-step how-to and teach how to use the 

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Adriano Crestani

Yes, it's many to many, I just thought in a simple way to do this, where the
user would define its own items. But many to many is OK ; ).

On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:


Won't the Cart x Item relationship be a many to many relationship ?
Currently, one item can only be in one cart, right ?
You probably looking for something like this

CREATE TABLE CART (
   ID INTEGER PRIMARY KEY,
   SUB_TOTAL DOUBLE,
   TAX DOUBLE,
   TOTAL DOUBLE
);

CREATE TABLE ITEM (
   ID INTEGER,
   DESC VARCHAR(30),
   UNITS INTEGER,
   PRICE DOUBLE
);

CREATE TABLE CART_ITEM(
   CART_ID INTEGER,
   ITEM_ID INTEGER,
   QUANTITY INTEGER,
   FOREIGN KEY (CART_ID) REFERENCES CART(ID),
   FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
)



--
Luciano Resende
http://people.apache.org/~lresende http://people.apache.org/%7Elresende

On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:

 Willian, I created these tables, that will possible be used in the
 shopping
 cart app. It's simple, but I think a howto sample must be simple. And if
 you
 want to add anything, feel free ; )

 CREATE TABLE CART (
 ID INTEGER,
 PRIMARY KEY (ID)
 );

 CREATE TABLE ITEM (
 ID INTEGER,
 ITEM VARCHAR(30),
 UNITS INTEGER,
 CART_ID INTEGER,
 PRIMARY KEY (ID),
 FOREIGN KEY (CART_ID) REFERENCES CART(ID)
 );



 On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:
 
  Hey Guys
 
 Very good to see some progress and some contents being generated. I
  agree
  with you guys when you say this is becoming more like a user guide,
  instead
  of a How To, and building it describing a new scenario would probably
 make
  things more clear, altough let's try to keep it simple on the
beginning,

  otherwise we are going to get a White paper :)
 
 I think we should describe actions that you would take when trying
to
  create an application and describe how you would do it (e.g Now we
need
 to
  execute a query to read the list of products, and this is how you
would
 do
  using DAS), and point the user to further documentation in case it
  needs/want to know more about the specific feature (e.g if they want
to
  learn the whole syntax/xsd of the das config file).
 
 I think couple things should not be covered on the How to :
- How to build a war file
- How to create a database (altough you might provide the SQL
  statements to create the tables you would use or at least describe the
 DB
  schema)
 
 Now, talking about what should be in this how-to
- We could start very simple... 1 product table, and one simple
 jsp
  that gives you a list of the products available
- Using MySQL is good, altough this how to should not really be
  database dependent, right ? we could point it to any database, and you
  guys
  could maybe elaborate on what change would be necessary to do this :)
 
 Also, I think this how to does not necessarily need to produce a
  working
  application, as it's intended to show how people would use DAS. If we
 want
  to spend time creating an application, I'd suggest doing this as
another
  task, and finish the one I have started as part of
  http://issues.apache.org/jira/browse/TUSCANY-800
 
  Let me know if you have any further questions... let's continue to
  updating
  the wiki, and please let me know when you guys want me to take a look
 and
  provide a feedback on the contents...
 
  BTW, others are welcome to voice their opinion on what direction we
 should
  take here...
 
 
  - Luciano Resende
  Apache Tuscany
 
 
  On 11/15/06, Adriano Crestani  [EMAIL PROTECTED] wrote:
  
   I've decribed the XML configuration file, but it's still looking
like
 a
   user
   guide than a howto. I think the CompanyWeb sample is to simple and
  doesn't
   cover well all the DAS features. So lets make this Shopping Cart
   application
   trying to use all the DAS features. Then we will be able to do a
very
   useful
   howto.
  
 My propose is that this app must have at least:
  
- 1 functionality that requires a SQL command with arguments.
 Then
  we
   cover how to deal with arguments in SQL commands.
  
   - 1 table that has one autoincrement key column to cover the
   genarated
   attribute on the howto.
  
   - 1 table that requires a concurrency control to cover the
   concurrency
   attribute on the howto.
  
  - 1 table containing a foreign key to cover how to explicit in
the
  XML
   configuration file the link between two tables. There will probabily
 be
  a
   foreign key in its database anyway. ; )
  
   I think also a good idea to use the MySql as the database server,
once
   it's
   the most used server on webapps ; )
  
   We must discuss how will be the Shopping Cart GUI, it must be simple
  once
   it's not the focus of our howto. I think a simple html genarated by
a
  jsp
   is
   enough. ; )
  
   Adriano Crestani
  
   On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:
   
Hello Tuscany Community!
   
  

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Willian Maja
I don't know if it's possible to read TimeStamp, but I'll try. And thanks 
for the idea :).


Willian Yabusame Maja


From: Katja [EMAIL PROTECTED]
Reply-To: tuscany-dev@ws.apache.org
To: tuscany-dev@ws.apache.org
Subject: Re: New proposal to make DAS/SDO HOW TO
Date: Thu, 16 Nov 2006 09:14:28 +0100

Hi!

Is it possible to add a Timestamp or DateTime column to the database? I am 
very interested in how to access these columns with DAS and MySQL because I 
have not succeeded in doing this.


Thanks,
Katja

 Original-Nachricht 
Datum: Thu, 16 Nov 2006 03:44:18 -0400
Von: Adriano Crestani [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 Willian, I created these tables, that will possible be used in the
 shopping
 cart app. It's simple, but I think a howto sample must be simple. And if
 you
 want to add anything, feel free ; )

 CREATE TABLE CART (
 ID INTEGER,
 PRIMARY KEY (ID)
 );

 CREATE TABLE ITEM (
 ID INTEGER,
 ITEM VARCHAR(30),
 UNITS INTEGER,
 CART_ID INTEGER,
 PRIMARY KEY (ID),
 FOREIGN KEY (CART_ID) REFERENCES CART(ID)
 );



 On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:
 
  Hey Guys
 
 Very good to see some progress and some contents being generated. I
  agree
  with you guys when you say this is becoming more like a user guide,
  instead
  of a How To, and building it describing a new scenario would probably
 make
  things more clear, altough let's try to keep it simple on the 
beginning,

  otherwise we are going to get a White paper :)
 
 I think we should describe actions that you would take when trying 
to
  create an application and describe how you would do it (e.g Now we 
need

 to
  execute a query to read the list of products, and this is how you 
would

 do
  using DAS), and point the user to further documentation in case it
  needs/want to know more about the specific feature (e.g if they want 
to

  learn the whole syntax/xsd of the das config file).
 
 I think couple things should not be covered on the How to :
- How to build a war file
- How to create a database (altough you might provide the SQL
  statements to create the tables you would use or at least describe the
 DB
  schema)
 
 Now, talking about what should be in this how-to
- We could start very simple... 1 product table, and one simple
 jsp
  that gives you a list of the products available
- Using MySQL is good, altough this how to should not really be
  database dependent, right ? we could point it to any database, and you
  guys
  could maybe elaborate on what change would be necessary to do this :)
 
 Also, I think this how to does not necessarily need to produce a
  working
  application, as it's intended to show how people would use DAS. If we
 want
  to spend time creating an application, I'd suggest doing this as 
another

  task, and finish the one I have started as part of
  http://issues.apache.org/jira/browse/TUSCANY-800
 
  Let me know if you have any further questions... let's continue to
  updating
  the wiki, and please let me know when you guys want me to take a look
 and
  provide a feedback on the contents...
 
  BTW, others are welcome to voice their opinion on what direction we
 should
  take here...
 
 
  - Luciano Resende
  Apache Tuscany
 
 
  On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:
  
   I've decribed the XML configuration file, but it's still looking 
like

 a
   user
   guide than a howto. I think the CompanyWeb sample is to simple and
  doesn't
   cover well all the DAS features. So lets make this Shopping Cart
   application
   trying to use all the DAS features. Then we will be able to do a 
very

   useful
   howto.
  
 My propose is that this app must have at least:
  
- 1 functionality that requires a SQL command with arguments.
 Then
  we
   cover how to deal with arguments in SQL commands.
  
   - 1 table that has one autoincrement key column to cover the
   genarated
   attribute on the howto.
  
   - 1 table that requires a concurrency control to cover the
   concurrency
   attribute on the howto.
  
  - 1 table containing a foreign key to cover how to explicit in 
the

  XML
   configuration file the link between two tables. There will probabily
 be
  a
   foreign key in its database anyway. ; )
  
   I think also a good idea to use the MySql as the database server, 
once

   it's
   the most used server on webapps ; )
  
   We must discuss how will be the Shopping Cart GUI, it must be simple
  once
   it's not the focus of our howto. I think a simple html genarated by 
a

  jsp
   is
   enough. ; )
  
   Adriano Crestani
  
   On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:
   
Hello Tuscany Community!
   
Adriano Crestani and I are working together on a HelloWorld 
DAS

  How
To. I have uploaded what we have done so far to
   
  
 
 
http://wiki.apache.org/ws

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Willian Maja

Hi Katja,

   I've just tested to read Date column, and it works. I'm going to paste 
my code here for you:


This will be the test table, it's just a simple table with a DateTime 
Column.


CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column date);
INSERT INTO test (date_column) VALUES (06-11-16);

Now you should create your Das connection. In my code example I'll not use 
XML configuration. I'm going to create the Command:


   Command read = das.createCommand(select * from test); //Create the 
 Command

   DataObject root = read.executeQuery();
   DataObject row = root.getDataObject(teste[1]); // Get the first 
row from test table;
   System.out.println(row.getDate(date_column)); // Print the 
DateTime



I think this will help you :).

Bye.





From: Katja [EMAIL PROTECTED]
Reply-To: tuscany-dev@ws.apache.org
To: tuscany-dev@ws.apache.org
Subject: Re: New proposal to make DAS/SDO HOW TO
Date: Thu, 16 Nov 2006 09:14:28 +0100

Hi!

Is it possible to add a Timestamp or DateTime column to the database? I am 
very interested in how to access these columns with DAS and MySQL because I 
have not succeeded in doing this.


Thanks,
Katja

 Original-Nachricht 
Datum: Thu, 16 Nov 2006 03:44:18 -0400
Von: Adriano Crestani [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 Willian, I created these tables, that will possible be used in the
 shopping
 cart app. It's simple, but I think a howto sample must be simple. And if
 you
 want to add anything, feel free ; )

 CREATE TABLE CART (
 ID INTEGER,
 PRIMARY KEY (ID)
 );

 CREATE TABLE ITEM (
 ID INTEGER,
 ITEM VARCHAR(30),
 UNITS INTEGER,
 CART_ID INTEGER,
 PRIMARY KEY (ID),
 FOREIGN KEY (CART_ID) REFERENCES CART(ID)
 );



 On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:
 
  Hey Guys
 
 Very good to see some progress and some contents being generated. I
  agree
  with you guys when you say this is becoming more like a user guide,
  instead
  of a How To, and building it describing a new scenario would probably
 make
  things more clear, altough let's try to keep it simple on the 
beginning,

  otherwise we are going to get a White paper :)
 
 I think we should describe actions that you would take when trying 
to
  create an application and describe how you would do it (e.g Now we 
need

 to
  execute a query to read the list of products, and this is how you 
would

 do
  using DAS), and point the user to further documentation in case it
  needs/want to know more about the specific feature (e.g if they want 
to

  learn the whole syntax/xsd of the das config file).
 
 I think couple things should not be covered on the How to :
- How to build a war file
- How to create a database (altough you might provide the SQL
  statements to create the tables you would use or at least describe the
 DB
  schema)
 
 Now, talking about what should be in this how-to
- We could start very simple... 1 product table, and one simple
 jsp
  that gives you a list of the products available
- Using MySQL is good, altough this how to should not really be
  database dependent, right ? we could point it to any database, and you
  guys
  could maybe elaborate on what change would be necessary to do this :)
 
 Also, I think this how to does not necessarily need to produce a
  working
  application, as it's intended to show how people would use DAS. If we
 want
  to spend time creating an application, I'd suggest doing this as 
another

  task, and finish the one I have started as part of
  http://issues.apache.org/jira/browse/TUSCANY-800
 
  Let me know if you have any further questions... let's continue to
  updating
  the wiki, and please let me know when you guys want me to take a look
 and
  provide a feedback on the contents...
 
  BTW, others are welcome to voice their opinion on what direction we
 should
  take here...
 
 
  - Luciano Resende
  Apache Tuscany
 
 
  On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:
  
   I've decribed the XML configuration file, but it's still looking 
like

 a
   user
   guide than a howto. I think the CompanyWeb sample is to simple and
  doesn't
   cover well all the DAS features. So lets make this Shopping Cart
   application
   trying to use all the DAS features. Then we will be able to do a 
very

   useful
   howto.
  
 My propose is that this app must have at least:
  
- 1 functionality that requires a SQL command with arguments.
 Then
  we
   cover how to deal with arguments in SQL commands.
  
   - 1 table that has one autoincrement key column to cover the
   genarated
   attribute on the howto.
  
   - 1 table that requires a concurrency control to cover the
   concurrency
   attribute on the howto.
  
  - 1 table containing a foreign key to cover how to explicit in 
the

  XML
   configuration file the link between two tables

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Katja
Hi Willian!

Thank you for the example! You tested with a Date-Column, that worked in my 
application, too, because no conversion between the column and the data object 
value is necessary.

With DateTime a converter is needed:
SDO format: 2006-11-16T17:22
MySQL format: 2006-11-16 17:22

The bigbank sample has a DateConverter for this issue, but this does only work 
with Derby and not with MySQL. I don't know why. I posted the error last time: 
http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html

It would be great, if you could test again with a DateTime or Timestamp column 
and tell me your solution.

Thanks,
Katja



 Original-Nachricht 
Datum: Thu, 16 Nov 2006 16:08:48 +
Von: Willian Maja [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 Hi Katja,
 
 I've just tested to read Date column, and it works. I'm going to paste
 my code here for you:
 
 This will be the test table, it's just a simple table with a DateTime 
 Column.
 
 CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column date);
 INSERT INTO test (date_column) VALUES (06-11-16);
 
 Now you should create your Das connection. In my code example I'll not use
 XML configuration. I'm going to create the Command:
 
 Command read = das.createCommand(select * from test); //Create
 the 
   Command
 DataObject root = read.executeQuery();
 DataObject row = root.getDataObject(teste[1]); // Get the first 
 row from test table;
 System.out.println(row.getDate(date_column)); // Print the 
 DateTime
 
 
 I think this will help you :).
 
 Bye.
 
 
 
 
 From: Katja [EMAIL PROTECTED]
 Reply-To: tuscany-dev@ws.apache.org
 To: tuscany-dev@ws.apache.org
 Subject: Re: New proposal to make DAS/SDO HOW TO
 Date: Thu, 16 Nov 2006 09:14:28 +0100
 
 Hi!
 
 Is it possible to add a Timestamp or DateTime column to the database? I
 am 
 very interested in how to access these columns with DAS and MySQL because
 I 
 have not succeeded in doing this.
 
 Thanks,
 Katja
 
  Original-Nachricht 
 Datum: Thu, 16 Nov 2006 03:44:18 -0400
 Von: Adriano Crestani [EMAIL PROTECTED]
 An: tuscany-dev@ws.apache.org
 Betreff: Re: New proposal to make DAS/SDO HOW TO
 
   Willian, I created these tables, that will possible be used in the
   shopping
   cart app. It's simple, but I think a howto sample must be simple. And
 if
   you
   want to add anything, feel free ; )
  
   CREATE TABLE CART (
   ID INTEGER,
   PRIMARY KEY (ID)
   );
  
   CREATE TABLE ITEM (
   ID INTEGER,
   ITEM VARCHAR(30),
   UNITS INTEGER,
   CART_ID INTEGER,
   PRIMARY KEY (ID),
   FOREIGN KEY (CART_ID) REFERENCES CART(ID)
   );
  
  
  
   On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:
   
Hey Guys
   
   Very good to see some progress and some contents being generated.
 I
agree
with you guys when you say this is becoming more like a user guide,
instead
of a How To, and building it describing a new scenario would
 probably
   make
things more clear, altough let's try to keep it simple on the 
 beginning,
otherwise we are going to get a White paper :)
   
   I think we should describe actions that you would take when
 trying 
 to
create an application and describe how you would do it (e.g Now we 
 need
   to
execute a query to read the list of products, and this is how you 
 would
   do
using DAS), and point the user to further documentation in case it
needs/want to know more about the specific feature (e.g if they want
 to
learn the whole syntax/xsd of the das config file).
   
   I think couple things should not be covered on the How to :
  - How to build a war file
  - How to create a database (altough you might provide the SQL
statements to create the tables you would use or at least describe
 the
   DB
schema)
   
   Now, talking about what should be in this how-to
  - We could start very simple... 1 product table, and one
 simple
   jsp
that gives you a list of the products available
  - Using MySQL is good, altough this how to should not really
 be
database dependent, right ? we could point it to any database, and
 you
guys
could maybe elaborate on what change would be necessary to do this
 :)
   
   Also, I think this how to does not necessarily need to produce a
working
application, as it's intended to show how people would use DAS. If
 we
   want
to spend time creating an application, I'd suggest doing this as 
 another
task, and finish the one I have started as part of
http://issues.apache.org/jira/browse/TUSCANY-800
   
Let me know if you have any further questions... let's continue to
updating
the wiki, and please let me know when you guys want me to take a
 look
   and
provide a feedback on the contents...
   
BTW, others are welcome to voice their opinion

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Willian Maja
I think I didn't understand what you want. But i tested using TimeStamp and 
DateTime:


  CREATE TABLE test (ID integer not null AUTO_INCREMENT, timestamp 
timestamp, datetime datetime, primary key (ID));


  INSERT INTO test VALUES ();

This will create the following row:

  |  1   | 2006-11-16 14:10:24.0|NULL


Now I will read the timestamp:

Command read = das.createCommand(select * from test);
DataObject root = read.executeQuery();
DataObject node = root.getDataObject(test[1]);
java.util.Date date = node.getDate(timestamp); // You must use 
java.util.Date, not java.sql.Date


System.out.println(date.getHours()); // Print the hours
System.out.println(date.getMonth()); // Print the month
System.out.println(node.getDate(date)); // Print the TimeStamp 
ex:2006-11-16 14:12:23.0



To save DateTime I used the following code:
//Continuing the last code, I'm going to save the TimeStamp in the 
DateTime column

   node.setDate(datetime, date);
   das.applyChanges(root);

Now the row 1 from the test table will be:

|  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10:24.0


I read/updated the row with datetime and timestamp column.
If this wasn't what you want, please send me the code you want to make work 
with SDO/Mysql.






From: Katja [EMAIL PROTECTED]
Reply-To: tuscany-dev@ws.apache.org
To: tuscany-dev@ws.apache.org
Subject: Re: New proposal to make DAS/SDO HOW TO
Date: Thu, 16 Nov 2006 17:29:58 +0100

Hi Willian!

Thank you for the example! You tested with a Date-Column, that worked in my 
application, too, because no conversion between the column and the data 
object value is necessary.


With DateTime a converter is needed:
SDO format: 2006-11-16T17:22
MySQL format: 2006-11-16 17:22

The bigbank sample has a DateConverter for this issue, but this does only 
work with Derby and not with MySQL. I don't know why. I posted the error 
last time: 
http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html


It would be great, if you could test again with a DateTime or Timestamp 
column and tell me your solution.


Thanks,
Katja



 Original-Nachricht 
Datum: Thu, 16 Nov 2006 16:08:48 +
Von: Willian Maja [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

 Hi Katja,

 I've just tested to read Date column, and it works. I'm going to 
paste

 my code here for you:

 This will be the test table, it's just a simple table with a DateTime
 Column.

 CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column 
date);

 INSERT INTO test (date_column) VALUES (06-11-16);

 Now you should create your Das connection. In my code example I'll not 
use

 XML configuration. I'm going to create the Command:

 Command read = das.createCommand(select * from test); //Create
 the
   Command
 DataObject root = read.executeQuery();
 DataObject row = root.getDataObject(teste[1]); // Get the 
first

 row from test table;
 System.out.println(row.getDate(date_column)); // Print the
 DateTime


 I think this will help you :).

 Bye.




 From: Katja [EMAIL PROTECTED]
 Reply-To: tuscany-dev@ws.apache.org
 To: tuscany-dev@ws.apache.org
 Subject: Re: New proposal to make DAS/SDO HOW TO
 Date: Thu, 16 Nov 2006 09:14:28 +0100
 
 Hi!
 
 Is it possible to add a Timestamp or DateTime column to the database? I
 am
 very interested in how to access these columns with DAS and MySQL 
because

 I
 have not succeeded in doing this.
 
 Thanks,
 Katja
 
  Original-Nachricht 
 Datum: Thu, 16 Nov 2006 03:44:18 -0400
 Von: Adriano Crestani [EMAIL PROTECTED]
 An: tuscany-dev@ws.apache.org
 Betreff: Re: New proposal to make DAS/SDO HOW TO
 
   Willian, I created these tables, that will possible be used in the
   shopping
   cart app. It's simple, but I think a howto sample must be simple. 
And

 if
   you
   want to add anything, feel free ; )
  
   CREATE TABLE CART (
   ID INTEGER,
   PRIMARY KEY (ID)
   );
  
   CREATE TABLE ITEM (
   ID INTEGER,
   ITEM VARCHAR(30),
   UNITS INTEGER,
   CART_ID INTEGER,
   PRIMARY KEY (ID),
   FOREIGN KEY (CART_ID) REFERENCES CART(ID)
   );
  
  
  
   On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:
   
Hey Guys
   
   Very good to see some progress and some contents being 
generated.

 I
agree
with you guys when you say this is becoming more like a user 
guide,

instead
of a How To, and building it describing a new scenario would
 probably
   make
things more clear, altough let's try to keep it simple on the
 beginning,
otherwise we are going to get a White paper :)
   
   I think we should describe actions that you would take when
 trying
 to
create an application and describe how you would do it (e.g Now we
 need
   to
execute a query to read the list of products, and this is how you
 would
   do

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Adriano Crestani
 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 SUB_TOTAL DOUBLE,
 TAX DOUBLE,
 TOTAL DOUBLE,
 CONFIRMED INTEGER
);

CREATE TABLE ITEM (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 DESCR CHAR(30),
 UNITS INTEGER
);

CREATE TABLE CART_ITEM (
 ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
 CART_ID INTEGER,
 ITEM_ID INTEGER,
 QUANTITY INTEGER,
 FOREIGN KEY (CART_ID) REFERENCES CART(ID),
 FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
);

It is not complete, there is still missing some functionalities in the
ShoppingCart.java, the getters. I haven't tested all methods yet, but I'm
already posting it here in case anyone wanting to give some suggestion.

I have no idea how to make the ShoppingCart.jsp, I needing some ideas for
the layout.

Adriano Crestani

On 11/16/06, Willian Maja [EMAIL PROTECTED] wrote:


I think I didn't understand what you want. But i tested using TimeStamp
and
DateTime:

   CREATE TABLE test (ID integer not null AUTO_INCREMENT, timestamp
timestamp, datetime datetime, primary key (ID));

   INSERT INTO test VALUES ();

This will create the following row:

   |  1   | 2006-11-16 14:10:24.0|NULL


Now I will read the timestamp:

 Command read = das.createCommand(select * from test);
 DataObject root = read.executeQuery();
 DataObject node = root.getDataObject(test[1]);
 java.util.Date date = node.getDate(timestamp); // You must use
java.util.Date, not java.sql.Date

 System.out.println(date.getHours()); // Print the hours
 System.out.println(date.getMonth()); // Print the month
 System.out.println(node.getDate(date)); // Print the TimeStamp
ex:2006-11-16 14:12:23.0


To save DateTime I used the following code:
 //Continuing the last code, I'm going to save the TimeStamp in
the
DateTime column
node.setDate(datetime, date);
das.applyChanges(root);

Now the row 1 from the test table will be:

|  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10:24.0


I read/updated the row with datetime and timestamp column.
If this wasn't what you want, please send me the code you want to make
work
with SDO/Mysql.




From: Katja [EMAIL PROTECTED]
Reply-To: tuscany-dev@ws.apache.org
To: tuscany-dev@ws.apache.org
Subject: Re: New proposal to make DAS/SDO HOW TO
Date: Thu, 16 Nov 2006 17:29:58 +0100

Hi Willian!

Thank you for the example! You tested with a Date-Column, that worked in
my
application, too, because no conversion between the column and the data
object value is necessary.

With DateTime a converter is needed:
SDO format: 2006-11-16T17:22
MySQL format: 2006-11-16 17:22

The bigbank sample has a DateConverter for this issue, but this does only
work with Derby and not with MySQL. I don't know why. I posted the error
last time:
http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html

It would be great, if you could test again with a DateTime or Timestamp
column and tell me your solution.

Thanks,
Katja



 Original-Nachricht 
Datum: Thu, 16 Nov 2006 16:08:48 +
Von: Willian Maja [EMAIL PROTECTED]
An: tuscany-dev@ws.apache.org
Betreff: Re: New proposal to make DAS/SDO HOW TO

  Hi Katja,
 
  I've just tested to read Date column, and it works. I'm going to
paste
  my code here for you:
 
  This will be the test table, it's just a simple table with a DateTime
  Column.
 
  CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column
date);
  INSERT INTO test (date_column) VALUES (06-11-16);
 
  Now you should create your Das connection. In my code example I'll not
use
  XML configuration. I'm going to create the Command:
 
  Command read = das.createCommand(select * from test);
//Create
  the
Command
  DataObject root = read.executeQuery();
  DataObject row = root.getDataObject(teste[1]); // Get the
first
  row from test table;
  System.out.println(row.getDate(date_column)); // Print the
  DateTime
 
 
  I think this will help you :).
 
  Bye.
 
 
 
 
  From: Katja [EMAIL PROTECTED]
  Reply-To: tuscany-dev@ws.apache.org
  To: tuscany-dev@ws.apache.org
  Subject: Re: New proposal to make DAS/SDO HOW TO
  Date: Thu, 16 Nov 2006 09:14:28 +0100
  
  Hi!
  
  Is it possible to add a Timestamp or DateTime column to the database?
I
  am
  very interested in how to access these columns with DAS and MySQL
because
  I
  have not succeeded in doing this.
  
  Thanks,
  Katja
  
   Original-Nachricht 
  Datum: Thu, 16 Nov 2006 03:44:18 -0400
  Von: Adriano Crestani [EMAIL PROTECTED]
  An: tuscany-dev@ws.apache.org
  Betreff: Re: New proposal to make DAS/SDO HOW TO
  
Willian, I created these tables, that will possible be used in the
shopping
cart app. It's simple, but I think a howto sample must be simple.
And
  if
you
want to add anything, feel free ; )
   
CREATE TABLE CART (
ID INTEGER,
PRIMARY KEY (ID)
);
   
CREATE TABLE ITEM (
ID INTEGER,
ITEM

Re: New proposal to make DAS/SDO HOW TO

2006-11-16 Thread Luciano Resende
) {
e.printStackTrace();
return null;
}
try {
java.sql.Connection con = DriverManager.getConnection(

jdbc:mysql://localhost:3306/shoppingcart,tuscany,tuscany);
con.setAutoCommit(false);
return con;
} catch(SQLException e) {
e.printStackTrace();
return null;
}
}

}

TABLES:

CREATE TABLE CART (
  ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  SUB_TOTAL DOUBLE,
  TAX DOUBLE,
  TOTAL DOUBLE,
  CONFIRMED INTEGER
);

CREATE TABLE ITEM (
  ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  DESCR CHAR(30),
  UNITS INTEGER
);

CREATE TABLE CART_ITEM (
  ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
  CART_ID INTEGER,
  ITEM_ID INTEGER,
  QUANTITY INTEGER,
  FOREIGN KEY (CART_ID) REFERENCES CART(ID),
  FOREIGN KEY (ITEM_ID) REFERENCES ITEM(ID)
);

It is not complete, there is still missing some functionalities in the
ShoppingCart.java, the getters. I haven't tested all methods yet, but I'm
already posting it here in case anyone wanting to give some suggestion.

I have no idea how to make the ShoppingCart.jsp, I needing some ideas for
the layout.

Adriano Crestani

On 11/16/06, Willian Maja [EMAIL PROTECTED] wrote:

 I think I didn't understand what you want. But i tested using TimeStamp
 and
 DateTime:

CREATE TABLE test (ID integer not null AUTO_INCREMENT, timestamp
 timestamp, datetime datetime, primary key (ID));

INSERT INTO test VALUES ();

 This will create the following row:

|  1   | 2006-11-16 14:10:24.0|NULL


 Now I will read the timestamp:

  Command read = das.createCommand(select * from test);
  DataObject root = read.executeQuery();
  DataObject node = root.getDataObject(test[1]);
  java.util.Date date = node.getDate(timestamp); // You must
use
 java.util.Date, not java.sql.Date

  System.out.println(date.getHours()); // Print the hours
  System.out.println(date.getMonth()); // Print the month
  System.out.println(node.getDate(date)); // Print the
TimeStamp
 ex:2006-11-16 14:12:23.0


 To save DateTime I used the following code:
  //Continuing the last code, I'm going to save the TimeStamp in
 the
 DateTime column
 node.setDate(datetime, date);
 das.applyChanges(root);

 Now the row 1 from the test table will be:

 |  1   | 2006-11-16 14:10:24.0|2006-11-16 14:10:24.0


 I read/updated the row with datetime and timestamp column.
 If this wasn't what you want, please send me the code you want to make
 work
 with SDO/Mysql.




 From: Katja [EMAIL PROTECTED]
 Reply-To: tuscany-dev@ws.apache.org
 To: tuscany-dev@ws.apache.org
 Subject: Re: New proposal to make DAS/SDO HOW TO
 Date: Thu, 16 Nov 2006 17:29:58 +0100
 
 Hi Willian!
 
 Thank you for the example! You tested with a Date-Column, that worked
in
 my
 application, too, because no conversion between the column and the data
 object value is necessary.
 
 With DateTime a converter is needed:
 SDO format: 2006-11-16T17:22
 MySQL format: 2006-11-16 17:22
 
 The bigbank sample has a DateConverter for this issue, but this does
only
 work with Derby and not with MySQL. I don't know why. I posted the
error
 last time:
 http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg10725.html
 
 It would be great, if you could test again with a DateTime or Timestamp
 column and tell me your solution.
 
 Thanks,
 Katja
 
 
 
  Original-Nachricht 
 Datum: Thu, 16 Nov 2006 16:08:48 +
 Von: Willian Maja [EMAIL PROTECTED]
 An: tuscany-dev@ws.apache.org
 Betreff: Re: New proposal to make DAS/SDO HOW TO
 
   Hi Katja,
  
   I've just tested to read Date column, and it works. I'm going to
 paste
   my code here for you:
  
   This will be the test table, it's just a simple table with a
DateTime
   Column.
  
   CREATE TABLE test (ID integer not null AUTO_INCREMENT, date_column
 date);
   INSERT INTO test (date_column) VALUES (06-11-16);
  
   Now you should create your Das connection. In my code example I'll
not
 use
   XML configuration. I'm going to create the Command:
  
   Command read = das.createCommand(select * from test);
 //Create
   the
 Command
   DataObject root = read.executeQuery();
   DataObject row = root.getDataObject(teste[1]); // Get the
 first
   row from test table;
   System.out.println(row.getDate(date_column)); // Print the
   DateTime
  
  
   I think this will help you :).
  
   Bye.
  
  
  
  
   From: Katja [EMAIL PROTECTED]
   Reply-To: tuscany-dev@ws.apache.org
   To: tuscany-dev@ws.apache.org
   Subject: Re: New proposal to make DAS/SDO HOW TO
   Date: Thu, 16 Nov 2006 09:14:28 +0100
   
   Hi!
   
   Is it possible to add a Timestamp or DateTime column to the
database?
 I
   am
   very interested in how to access these columns with DAS and MySQL
 because
   I
   have not succeeded in doing this.
   
   Thanks,
   Katja
   
    Original-Nachricht

Re: New proposal to make DAS/SDO HOW TO

2006-11-15 Thread Adriano Crestani

I've decribed the XML configuration file, but it's still looking like a user
guide than a howto. I think the CompanyWeb sample is to simple and doesn't
cover well all the DAS features. So lets make this Shopping Cart application
trying to use all the DAS features. Then we will be able to do a very useful
howto.

 My propose is that this app must have at least:

- 1 functionality that requires a SQL command with arguments. Then we
cover how to deal with arguments in SQL commands.

   - 1 table that has one autoincrement key column to cover the genarated
attribute on the howto.

   - 1 table that requires a concurrency control to cover the concurrency
attribute on the howto.

  - 1 table containing a foreign key to cover how to explicit in the XML
configuration file the link between two tables. There will probabily be a
foreign key in its database anyway. ; )

I think also a good idea to use the MySql as the database server, once it's
the most used server on webapps ; )

We must discuss how will be the Shopping Cart GUI, it must be simple once
it's not the focus of our howto. I think a simple html genarated by a jsp is
enough. ; )

Adriano Crestani

On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:


Hello Tuscany Community!

Adriano Crestani and I are working together on a HelloWorld DAS How
To. I have uploaded what we have done so far to
http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_HOWTO_HelloDASApp

We were using the CompanyWeb sample application to make this
step-by-step how-to and teach how to use the DAS/SDO Features. We are not
liking what this is becoming, as it's looking more like a user-gide/readme
then really a how-to, so we would like to do a new proposal :

Use the scenario of a Shopping cart, and use it to explain more about
how to build it using DAS to handle the persistence part of the app...

The topics would be:
Introducing the scenario and the motivation to use DAS/SDO
Initial Setup and environment assumptions
Building the application
- database
- DAS commands
- Configuring the XML and how to make the commands
Explain the DAS/SDO and how to read/get results
conclusion


Before we change our path to this new approach, we would like to hear
some feedback on what you guys think about this new approach

Willian Yabusame Maja



Re: New proposal to make DAS/SDO HOW TO

2006-11-15 Thread Luciano Resende

Hey Guys

  Very good to see some progress and some contents being generated. I agree
with you guys when you say this is becoming more like a user guide, instead
of a How To, and building it describing a new scenario would probably make
things more clear, altough let's try to keep it simple on the beginning,
otherwise we are going to get a White paper :)

  I think we should describe actions that you would take when trying to
create an application and describe how you would do it (e.g Now we need to
execute a query to read the list of products, and this is how you would do
using DAS), and point the user to further documentation in case it
needs/want to know more about the specific feature (e.g if they want to
learn the whole syntax/xsd of the das config file).

  I think couple things should not be covered on the How to :
 - How to build a war file
 - How to create a database (altough you might provide the SQL
statements to create the tables you would use or at least describe the DB
schema)

  Now, talking about what should be in this how-to
 - We could start very simple... 1 product table, and one simple jsp
that gives you a list of the products available
 - Using MySQL is good, altough this how to should not really be
database dependent, right ? we could point it to any database, and you guys
could maybe elaborate on what change would be necessary to do this :)

  Also, I think this how to does not necessarily need to produce a working
application, as it's intended to show how people would use DAS. If we want
to spend time creating an application, I'd suggest doing this as another
task, and finish the one I have started as part of
http://issues.apache.org/jira/browse/TUSCANY-800

Let me know if you have any further questions... let's continue to updating
the wiki, and please let me know when you guys want me to take a look and
provide a feedback on the contents...

BTW, others are welcome to voice their opinion on what direction we should
take here...


- Luciano Resende
Apache Tuscany


On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:


I've decribed the XML configuration file, but it's still looking like a
user
guide than a howto. I think the CompanyWeb sample is to simple and doesn't
cover well all the DAS features. So lets make this Shopping Cart
application
trying to use all the DAS features. Then we will be able to do a very
useful
howto.

  My propose is that this app must have at least:

 - 1 functionality that requires a SQL command with arguments. Then we
cover how to deal with arguments in SQL commands.

- 1 table that has one autoincrement key column to cover the
genarated
attribute on the howto.

- 1 table that requires a concurrency control to cover the
concurrency
attribute on the howto.

   - 1 table containing a foreign key to cover how to explicit in the XML
configuration file the link between two tables. There will probabily be a
foreign key in its database anyway. ; )

I think also a good idea to use the MySql as the database server, once
it's
the most used server on webapps ; )

We must discuss how will be the Shopping Cart GUI, it must be simple once
it's not the focus of our howto. I think a simple html genarated by a jsp
is
enough. ; )

Adriano Crestani

On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:

 Hello Tuscany Community!

 Adriano Crestani and I are working together on a HelloWorld DAS How
 To. I have uploaded what we have done so far to

http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_HOWTO_HelloDASApp

 We were using the CompanyWeb sample application to make this
 step-by-step how-to and teach how to use the DAS/SDO Features. We are
not
 liking what this is becoming, as it's looking more like a
user-gide/readme
 then really a how-to, so we would like to do a new proposal :

 Use the scenario of a Shopping cart, and use it to explain more
about
 how to build it using DAS to handle the persistence part of the app...

 The topics would be:
 Introducing the scenario and the motivation to use DAS/SDO
 Initial Setup and environment assumptions
 Building the application
 - database
 - DAS commands
 - Configuring the XML and how to make the commands
 Explain the DAS/SDO and how to read/get results
 conclusion


 Before we change our path to this new approach, we would like to
hear
 some feedback on what you guys think about this new approach

 Willian Yabusame Maja





Re: New proposal to make DAS/SDO HOW TO

2006-11-15 Thread Adriano Crestani

Willian, I created these tables, that will possible be used in the shopping
cart app. It's simple, but I think a howto sample must be simple. And if you
want to add anything, feel free ; )

CREATE TABLE CART (
   ID INTEGER,
   PRIMARY KEY (ID)
);

CREATE TABLE ITEM (
   ID INTEGER,
   ITEM VARCHAR(30),
   UNITS INTEGER,
   CART_ID INTEGER,
   PRIMARY KEY (ID),
   FOREIGN KEY (CART_ID) REFERENCES CART(ID)
);



On 11/16/06, Luciano Resende [EMAIL PROTECTED] wrote:


Hey Guys

   Very good to see some progress and some contents being generated. I
agree
with you guys when you say this is becoming more like a user guide,
instead
of a How To, and building it describing a new scenario would probably make
things more clear, altough let's try to keep it simple on the beginning,
otherwise we are going to get a White paper :)

   I think we should describe actions that you would take when trying to
create an application and describe how you would do it (e.g Now we need to
execute a query to read the list of products, and this is how you would do
using DAS), and point the user to further documentation in case it
needs/want to know more about the specific feature (e.g if they want to
learn the whole syntax/xsd of the das config file).

   I think couple things should not be covered on the How to :
  - How to build a war file
  - How to create a database (altough you might provide the SQL
statements to create the tables you would use or at least describe the DB
schema)

   Now, talking about what should be in this how-to
  - We could start very simple... 1 product table, and one simple jsp
that gives you a list of the products available
  - Using MySQL is good, altough this how to should not really be
database dependent, right ? we could point it to any database, and you
guys
could maybe elaborate on what change would be necessary to do this :)

   Also, I think this how to does not necessarily need to produce a
working
application, as it's intended to show how people would use DAS. If we want
to spend time creating an application, I'd suggest doing this as another
task, and finish the one I have started as part of
http://issues.apache.org/jira/browse/TUSCANY-800

Let me know if you have any further questions... let's continue to
updating
the wiki, and please let me know when you guys want me to take a look and
provide a feedback on the contents...

BTW, others are welcome to voice their opinion on what direction we should
take here...


- Luciano Resende
Apache Tuscany


On 11/15/06, Adriano Crestani [EMAIL PROTECTED] wrote:

 I've decribed the XML configuration file, but it's still looking like a
 user
 guide than a howto. I think the CompanyWeb sample is to simple and
doesn't
 cover well all the DAS features. So lets make this Shopping Cart
 application
 trying to use all the DAS features. Then we will be able to do a very
 useful
 howto.

   My propose is that this app must have at least:

  - 1 functionality that requires a SQL command with arguments. Then
we
 cover how to deal with arguments in SQL commands.

 - 1 table that has one autoincrement key column to cover the
 genarated
 attribute on the howto.

 - 1 table that requires a concurrency control to cover the
 concurrency
 attribute on the howto.

- 1 table containing a foreign key to cover how to explicit in the
XML
 configuration file the link between two tables. There will probabily be
a
 foreign key in its database anyway. ; )

 I think also a good idea to use the MySql as the database server, once
 it's
 the most used server on webapps ; )

 We must discuss how will be the Shopping Cart GUI, it must be simple
once
 it's not the focus of our howto. I think a simple html genarated by a
jsp
 is
 enough. ; )

 Adriano Crestani

 On 11/15/06, Willian Yabusame Maja [EMAIL PROTECTED] wrote:
 
  Hello Tuscany Community!
 
  Adriano Crestani and I are working together on a HelloWorld DAS
How
  To. I have uploaded what we have done so far to
 

http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_HOWTO_HelloDASApp
 
  We were using the CompanyWeb sample application to make this
  step-by-step how-to and teach how to use the DAS/SDO Features. We are
 not
  liking what this is becoming, as it's looking more like a
 user-gide/readme
  then really a how-to, so we would like to do a new proposal :
 
  Use the scenario of a Shopping cart, and use it to explain more
 about
  how to build it using DAS to handle the persistence part of the app...
 
  The topics would be:
  Introducing the scenario and the motivation to use DAS/SDO
  Initial Setup and environment assumptions
  Building the application
  - database
  - DAS commands
  - Configuring the XML and how to make the commands
  Explain the DAS/SDO and how to read/get results
  conclusion
 
 
  Before we change our path to this new approach, we would like to
 hear