1.0          Other languages

4 O/R mapping


O/R mapping means mapping between Java bean object and database table data. For nearly all normal JDBC operations, such as insert/update/delete/search, O/R mapping make it possible to use only Java bean objects, call some methods named as save() or something else, all relative JDBC operations will be done accordingly.

The Java bean information is retrieved using reflection in JDK. Normally, all bean fields are included. And then, check if they have getXXX(), setXXX() methods.

And the database table information is retrieved using JDBC ResultSetMetaData.

Generally, this O/R mapping is based on one database table and one Java bean class. And there is some tools, for example, Middlegen, can be used to generate code files based on specified template file format of Velocity.