Skip to content

desaurabh/ResultSetMarshaller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

ResultSetMarshaller

Shorter way to copy the output result set into the Java beans

Define factory class object


//filled result set java.sql.ResultSet 
resultSet; 
UnmarshallerFactory factory = new UnmarshallerFactory();
Get model type object from factory by passing resultSet as a parameter

ModelType mType=factory.getModelType(resultSet);

if result will be a single row then instantiate the Model class


Model model=mtype.getModel();
String jsonString=model.getJsonString(); //getting json data from model object 

or if result may have multiple rows then instantiate the ListModel class


ListModel listModel=mtype.getListModel();
String jsonString=listModel.getJsonString();  //getting json data from listmodel  object

Now you have the constructed result and as well as json string


YourDomain yd=(YourDomain) model.populateModel(YourDomain.class);
//or
List listObj=listModel.populateListModel(YourDomain.class);

About

Shorter way to copy the output result set into the Java beans

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages