You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Adriano Crestani <ad...@gmail.com> on 2006/11/20 08:15:02 UTC

DAS applyChanges never return

I'm trying to run a test code, but I got a problem in the method void
newItem(String description, int units) using the mysql 5.1:

ShoppingCart.java

public class ShoppingCart {

 public void newItem(String description, int units) {
        DAS das = DAS.FACTORY.createDAS
(getClass().getClassLoader().getResourceAsStream("ShoppingCartConfig.xml"),
getConnection());
        Command command = das.getCommand("all items");
        DataObject allItems = command.executeQuery();

        DataObject newItem = allItems.createDataObject("ITEM");
        newItem.setString("DESCR", description);
        newItem.setInt("UNITS", units);

        allItems.getList("ITEM").add(newItem);
        das.applyChanges(allItems);

    }

 }

ShoppingCartConfig.xml

<?xml version="1.0" encoding="ASCII"?>
<Config xsi:noNamespaceSchemaLocation="
http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">

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

</Config>

Table

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

I used a debugger and found out that the das.applyChanges(allItems) - last
line of method void newItem(String description, int units) -  is never
returning, may it be a DAS internal error?

Re: DAS applyChanges never return

Posted by Luciano Resende <lu...@gmail.com>.
Hi Adriano

   I just tried your application code with a tomcat application connecting
to MySQL and didn't have any problems... I was using latest DAS from
trunk... and after applyChanges i can see the new row on the MySQL table...


   Also, DAS builds runs some junit testcases around applyChanges and you
might take a look if it's building ok in your environment...

   Let me know if you find anything else, or have more info so I can
help....


Thanks

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

On 11/19/06, Adriano Crestani <ad...@gmail.com> wrote:
>
> I'm trying to run a test code, but I got a problem in the method void
> newItem(String description, int units) using the mysql 5.1:
>
> ShoppingCart.java
>
> public class ShoppingCart {
>
> public void newItem(String description, int units) {
>         DAS das = DAS.FACTORY.createDAS
> (getClass().getClassLoader().getResourceAsStream("ShoppingCartConfig.xml
> "),
> getConnection());
>         Command command = das.getCommand("all items");
>         DataObject allItems = command.executeQuery();
>
>         DataObject newItem = allItems.createDataObject("ITEM");
>         newItem.setString("DESCR", description);
>         newItem.setInt("UNITS", units);
>
>         allItems.getList("ITEM").add(newItem);
>         das.applyChanges(allItems);
>
>     }
>
> }
>
> ShoppingCartConfig.xml
>
> <?xml version="1.0" encoding="ASCII"?>
> <Config xsi:noNamespaceSchemaLocation="
> http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
>
> <Command name="all items" SQL="select * FROM ITEM"  kind="Select"/>
>
> </Config>
>
> Table
>
> CREATE TABLE ITEM (
>   ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
>   DESCR CHAR(30),
>   UNITS INTEGER
> );
>
> I used a debugger and found out that the das.applyChanges(allItems) - last
> line of method void newItem(String description, int units) -  is never
> returning, may it be a DAS internal error?
>
>