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

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 req

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 Cresta