Active Record Java

Active Record is a design pattern frequently found in enterprise applications and as per the definition goes as "An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data".

Using ARJ you dont have to define any XML file mappings, most of the things are handled for you. Only thing you have to do is name your class file name same as table name. There are no rules for table name only thing is to name your class file as table name and you are done.

Eg: Parent(Java class file) => parent(table name).

You don't need to define variables like "private String name" , during startup metadata is read from the database and also the relationships between tables of type 1..*.With metadata the track of all the variables and their datatype is kept.

Eg:
                     parent table:->
                     id | int(11) | PRI
                     name | varchar(15)
                     
                     The class Parent will have
                     public class Parent extends ActiveRecordJava{
                         public Parent(){}
                     }