Hi,
I need to implement a DataSource that's backed by Spring+Hibernate to process a form. However, the dataSource doesn't simply map the fields of a form to a Hibernate POJO (as in the typical DataSource examples).
Instead, the form acts more like a "wizard" - users enter data and based on that data a number of different POJO's will be created and persisted to Hibernate.
The dataSource then has to supply a response back that indicates which POJO's were successfully created, which already existed and would have resulted in a duplicate; and which simply failed (due to a Hibernate error or some other sort of problem). That data is then displayed to the user.
From looking at the API docs and the showcase (specifically, the ORM DataSource example in the Enterprise Showcase); I imagine I will have to create a Custom DataSource implementation on the Server side, by extending com.isomorphic.datasource.BasicDataSource; as well as a client DataSource implementation that extends com.smartgwt.client.data.DataSource with a transformHandler to process the response.
However, some things aren't very clear to me and I was hoping for some pointers that could get me on my way.
1) I've looked at the documentation for the server side APIs but there's no javadoc on the BasicDataSource class, so I'm not sure what exactly to extend on that class. The ORM DataSource example shows a simple CRUD implementation, but in this case I don't need a CRUD design pattern. Should I just implement BasicDataSource.add(Object arg0)?
2) The ORM Datasource example uses an XML-mapped Datasource (cfr. the file ormDataSource_country.ds.xml) but I'm not sure that this will work for me. Don't dataSource declared this way need to have a primary key? The problem is that since my form is purely for data-entry and not backed by an actual POJO, the concept of a PK makes no sense here.
3) From the javadoc on com.smartgwt.client.data.DataSource, I gather that you need to call setDataURL to tell the client DS where the server DS is. However, all the examples I've seen in the showcase of custom client DataSources use test data and are client-only so I can't figure out what actual value to set this to. Any pointers regarding this?
4) Finally, I don't really care about whether I submit the data as XML or JSON, since I'll be writing both the client and server side of this solution. Something that would allow me to easily unmarshal a form and marshal it again on the server side would probably be best. Any ideas on this?
Thanks!
I need to implement a DataSource that's backed by Spring+Hibernate to process a form. However, the dataSource doesn't simply map the fields of a form to a Hibernate POJO (as in the typical DataSource examples).
Instead, the form acts more like a "wizard" - users enter data and based on that data a number of different POJO's will be created and persisted to Hibernate.
The dataSource then has to supply a response back that indicates which POJO's were successfully created, which already existed and would have resulted in a duplicate; and which simply failed (due to a Hibernate error or some other sort of problem). That data is then displayed to the user.
From looking at the API docs and the showcase (specifically, the ORM DataSource example in the Enterprise Showcase); I imagine I will have to create a Custom DataSource implementation on the Server side, by extending com.isomorphic.datasource.BasicDataSource; as well as a client DataSource implementation that extends com.smartgwt.client.data.DataSource with a transformHandler to process the response.
However, some things aren't very clear to me and I was hoping for some pointers that could get me on my way.
1) I've looked at the documentation for the server side APIs but there's no javadoc on the BasicDataSource class, so I'm not sure what exactly to extend on that class. The ORM DataSource example shows a simple CRUD implementation, but in this case I don't need a CRUD design pattern. Should I just implement BasicDataSource.add(Object arg0)?
2) The ORM Datasource example uses an XML-mapped Datasource (cfr. the file ormDataSource_country.ds.xml) but I'm not sure that this will work for me. Don't dataSource declared this way need to have a primary key? The problem is that since my form is purely for data-entry and not backed by an actual POJO, the concept of a PK makes no sense here.
3) From the javadoc on com.smartgwt.client.data.DataSource, I gather that you need to call setDataURL to tell the client DS where the server DS is. However, all the examples I've seen in the showcase of custom client DataSources use test data and are client-only so I can't figure out what actual value to set this to. Any pointers regarding this?
4) Finally, I don't really care about whether I submit the data as XML or JSON, since I'll be writing both the client and server side of this solution. Something that would allow me to easily unmarshal a form and marshal it again on the server side would probably be best. Any ideas on this?
Thanks!
Comment