You can edit almost every page by Creating an account. Otherwise, see the FAQ.

ActiveJDBC

From EverybodyWiki Bios & Wiki



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[edit]

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[edit]

Creating and updating records[edit]

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[edit]

ActiveJDBC does not have a query language. Search criteria are written in abbreviated SQL.

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

Related projects[edit]

While ActiveJDBC is a general purpose Java ORM, it served as a first building block for JavaLite

External links[edit]


This article "ActiveJDBC" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:ActiveJDBC. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.