ActiveJDBC
ActiveJDBC is a Java implementation of the Active Record design pattern developed by Igor Polevoy. It was inspired by ActiveRecord ORM from Ruby on Rails. It is based on convention over configuration.
Writing models
Similar to Ruby on Rails, the ActiveJDBC infers meta data from a database. The result is that models do not require setters and getters.
Example
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.
List<Employee> employees = Employee.where("first_name = ?", "John");
Related projects
While ActiveJDBC is a general purpose Java ORM, it served as a first building block for ActiveWeb
gollark: You could. Bone removal surgery.
gollark: The body contains miniaturised fusion reactors, obviously?
gollark: It says there's lots of uneconomical-to-extract phosphorous. It would become economical if we actually ran out of easier sources probably.
gollark: Since most plants can't fix atmospheric nitrogen, since they're bad.
gollark: I'm pretty sure they're mostly nitrogen-based and something something Haber-Bosch.
External links
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.