I've just done a first version of the insert and update CRUD operations to impl.data module. Both are working with a XMLStreamReader stream, and have some limitations that need to be enhanced.
(JIRA: https://issues.apache.org/jira/browse/TUSCANY-1917) For the update operation, the limitations are: -The XMLStreamReader has only columns that were modificated; -The update is done based on the ID primary key attribute; -The ID must be the first column, and musn't be null; -The columns updated should be char or varchar type; In other words, the update operation is doing something like this: <result_set> <record> <column name="ID">51</column> <column name="NAME">ACME Publishing</column> </record> </result_set> UPDATE table SET name = 'ACME Publishing' WHERE ID = 51 The insert operation, on the other hand, has the following limitations: -Must exist an ID primary key attribute auto increment on the table; -The table must only have column which type is char or varchar; The insert operation is doing something like this: <result_set> <record> <column name="NAME">ACME Publishing II</column> </record> </result_set> INSERT INTO table ( column ) VALUES ( 'ACME Publishing II' ) I'm using a insert.xml and a update.xml in the tests. I think that the next steps is create a good way to modify the xmlstreamreader retrivied by the get method, and improve the CRUD operations. Suggestions? On Nov 6, 2007 2:54 PM, Douglas Leite <[EMAIL PROTECTED]> wrote: > What could be better? Should the "modifications" stream contain only the > modifications, or should it be the stream retrieved by the get method (DATA > interface) with the updates? > > Other comments inline. > > On 11/5/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote: > > > > > > A few comments inline. > > > > [snip] > > Douglas Leite wrote: > > > With the data being manipulated like a XmlStreamReader, I suppose that > > a > > > good way to implement the update operator is use a stream that > > contains the > > > modifications. Something like that: > > > > > > int update(XmlStreamReader modifications); > > > > > > Therefore, the 'modifications' stream will cotain all the > > modifications made > > > in the stream retrieved from the get operator. > > > > > > > What's the "int" for? can't that method just be void? > > > > > However, in the scenary where we have a simple java developer, how is > > he > > > supposed to manipulate the stream reader ? > > > > > > > A Java developer developing a client component talking to your Data > > component will probably want to do: > > update(Customer customer) > > with customer being a Java Object representation of the Customer > > business object / resource to update. > > > > So IMO implementation-data should support both modes: > > - good integration with XML, useful for local and remote XML enabled > > clients > > - good integration with Java business objects for local Java clients, > > and Java-friendly remote clients (e.g. Json clients) > > > > > What about a XmlStreamReader that allow some sets methods? > > > > > > > I think that a set can be represented as an update. Also, a set of > > related sets can be batched in a single update. > > > > > > > > On 10/12/07, Douglas Leite <[EMAIL PROTECTED]> wrote: > > > > > >> As suggested, I've made some improvements in the sample store. Now > > the > > >> catalog data is accessed by JDBC instead of a hardcoded table in > > memory. (https://issues.apache.org/jira/browse/TUSCANY-1844 > > >> ) > > >> > > >> After running the sample with the property currencyCode configured as > > >> 'EUR', in the store.composite, I got an float parse error in the > > getTotal > > >> method in the ShoppingCartImpl. Because of that, I've changed a > > little the > > >> way of get the price of each product. > > >> > > > > This looks like a work around, do you know what the problem with the > > Euro symbol is? is it a problem with the Atom binding not > > reading/writing that symbol properly? > > > I'm not sure, but I think that it can be possible. > > In the ShoppingCartImpl: > > private String getTotal() { > [...] > String item = > ((Content)cart.values().iterator().next().getContents().get(0)).getValue(); > [...] > } > > The String "item" contains the wrong symbol, and the cart map is filled > with the catalog data using the atom binding. > > -- > > Jean-Sebastien > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >
