ActiveJDBC
Encyclopedia
ActiveJDBC is a Java implementation of the Active Record design pattern
Active record pattern
In software engineering, the active record pattern is an architectural pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture...

 developed by Igor Polevoy. It was inspired by ActiveRecord ORM from Ruby on Rails
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...

. It is based on a set of conventions and does not require configuration.

Writing models

Similar to Ruby on Rails
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...

, the ActiveJDBC infers meta data from a database. The result is that models do not require setters and getters.

Creating and updating records

Creation of and saving new records in a table:


Employee e = new Employee;
e.set("first_name", "John");
e.set("last_name", "Doe");
e.saveIt;

or the same on one line:

Employee.createIt("first_name", "John", "last_name", "Doe");


And for updating an existing record:

Employee e = Employee.findFirst("first_name = ?", "John");
e.set("last_name", "Steinbeck").saveIt;

Finding records

ActiveJDBC does not have a query language. Search criteria are written in abbreviated SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

.

List employees = Employee.where("first_name = ?", "John");

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK