I was wondering if there was any way to create a data object from a sql query and the opposite.
Example :
Here is the object :
public class DataObject {
int id;
String name;
}
Is there any way to do something like :
DataObject[] dataObjects = methodXX("SELECT id, name from XXTABLEXX");
And by the opposite I mean for example create DataObject, set some value, and insert/update it directly into the database.
Hope it doesn’t seem too strange.
Thank you.
you are looking for ORM (http://en.wikipedia.org/wiki/Object-relational_mapping) framework.
for example hibernate (http://www.hibernate.org/).