cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping ResultSet to Context and vice versa

former_member212767
Participant
0 Kudos

Hi,

We've been pondering the usage of SQL ResultSet (java.sql.ResultSet) and the context.

When creating database applications we have to get the data from database to a ResultSet and copy the data to the context to be able to use it. Then if we make changes to the data in the context, and have the same changes in the database, we have to create SQL update clauses for the data in the context and execute them. With ResultSet it would be just:

rs.updateString("NAME", "AINSWORTH"); // updates the name

rs.updateRow(); // updates the row in the datasource

We would like to use ResultSets for the data behind controls (tables etc.) to be able to update the resultset and the database without having to write SQL update, insert, delete etc. clauses.

Is this possible ? If it is, how ? If it is not, why ?

Any insight or suggestions are greatly appreciated.

Kind Regards,

Jari Pakarinen

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jari,

The main logic here will lie with the model.

You can have your whole logic of connecting to database,fetching results etc using a model classes.

You can choose javabean model for this.This will be a very simple solution.

But what you can achieve using J2EE will not be possible by this.

Have your business logic in some EJBs and espose them as webservice.Then you can use webservice model to carry out what you want.

For small solution use JavaBean Model else go for 2nd solution.

Regards,

Ashwani

former_member212767
Participant
0 Kudos

Thanks for the reply,

Web service would just add complexity, as we are aiming for simplicity. Also we would like to lessen the amount of boilerplate code to do this. Now we have to create SQL clauses for everything we do with the database. And this for every application we code.

If we could use ResultSet instead of Context or somehow map Context and ResultSet dynamically as the data source for the controls we'd be all set.

We would like to just load the data into a ResultSet, do modifications to it WITHOUT SQL (with e.g. WebDynPro table) and commit the modifications WITHOUT SQL back to the database. Only SQL needed would be the one that loads the ResultSet in the first place.

Regards,

Jari

Message was edited by: Jari Pakarinen

Former Member
0 Kudos

Jari,

If you have complex set of business objects (tens of them or more) why not to give CAF framework a try? It was developed exactly to fulfill your requirements )

And resulted models are completely WD-friendly. Plus, many developer's tasks are "right-hand-only", i.e. accomplished with mouse and wizards.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

former_member212767
Participant
0 Kudos

Thanks. I'll try it when I get the access key.

Jari