G
Guest
Anyone got any ideas/sample code on how to construct classes which map to
database tables, in particular the CRUD type code. What I had in mind so far
was to have a constructor in the classes which takes the primary key of the
database table as a parameter and calls a stored procedure which will run a
select to retrive the relevant row of data. These database values will then
be set to the property values in the class (assuming one property per column
in the database table).
There will also be a persist method which would access the values of all the
properties and then call a stored procedure which runs an update statement.
Am I on the right lines?
PS I know there are object-relational mapping type products but for various
reasons I have decided not to use one.
Thanks
database tables, in particular the CRUD type code. What I had in mind so far
was to have a constructor in the classes which takes the primary key of the
database table as a parameter and calls a stored procedure which will run a
select to retrive the relevant row of data. These database values will then
be set to the property values in the class (assuming one property per column
in the database table).
There will also be a persist method which would access the values of all the
properties and then call a stored procedure which runs an update statement.
Am I on the right lines?
PS I know there are object-relational mapping type products but for various
reasons I have decided not to use one.
Thanks