Tagged: Open source

ActiveJDBC: new Java ORM and an ActiveRecord implementation

This is a guest post by Igor Polevoy (blog, @ipolevoy). Igor is a Chief Architect at Productive Edge, LLC.

When I learned Ruby on Rails, I was first and foremost impressed with ActiveRecord. For those who do not know ActiveRecord, it is a Ruby on Rails’ ORM layer, which is an equivalent to Hibernate in Java. However, ActiveRecord is easier to work with because it is based on conventions rather than configuration, and also it configures itselt at start time based on structure of data in the database. I was so impressed with ActiveRecord, that I was sure someone would implement it in Java, but after waiting a couple of years, I put a stop to wait and implemented it myself (with help of a few friends).

ActiveJDBC is a fast and lightweight library for accessing relational databases. Its syntax is concise and easy to understand. The library is based on following principals:

  • No configuration, just conventions
  • No need to learn another QL – SQL is sufficient
  • Code must be lightweight and intuitive, should read like English
  • No sessions, no “attaching, re-attaching”
  • No persistence managers.
  • No proxying. What you write is what you get (WYWIWYG)

ActiveJDBC has no configuration, it maps models to tables automatically. Here is an example:

1
2
public class Person extends Model{
}

This is a fully functioning class for accessing the PEOPLE table. The following code works right out of the box:

List retirees = Person.where("age > ?", age);

Since ActiveJDBC does not introduce a new query language, the snippet “age > ?” is a true SQL snippet which usually follows the “WHERE” clause. ActiveJDBC does not require setter/getter methods for mapping to columns. Instead, it provides a single get and a single set method:

String firstName = person.get("first_name");
person.set("last_name", lastName);

Writing setters and getters is possible for convenience:

public Sting getFirstName(){
   return get("first_name");
}

ActiveJDBC supports three types of relationships: one to many, many to many and polymorphic. In a one to many relationship, many records from a “child” table relate to one record in the parent table. Exampes are: customer and addresses, order and line items, etc. When ActibeJDBC starts up, it undergoes a disovery phase, when it examines database metadata (tables, columns, relationships) and maps model classes to tables. For example, if there is a table CUSTOMERS and a table ADDRESSES, and a table ADDRESSES has a column “CUSTOMER_ID”, then you can write code like this without any additional configuration:

Customer c = Customer.findById(123);
List addresses = c.getAll(Address.class);

Many to many and polymorphic associations are supported similarly. ActiveJDBC is full featured and has been around since 2009. If you are interested to learn more, follow the link to the project site:http://code.google.com/p/activejdbc/


After years of “complicated” enterprise Java, things are starting to improve, one of the main directions in enterprise Java today is to make things simple. I think persistence is still more complicated than it should be. ORM frameworks such as Hibernate or JPA, although very powerful (and appropriate in some projects), are also complicated to understand and learn and don’t always “make your development simpler” (JPA has almost 500 page specification document). ActiveJDBS is very simple and elegant persistence framework. My guess is that more and more projects will consider using simple and elegant persistence solutions such as ActiveJDBS.

Exadel Fiji: new forum, issue tracker, JavaFX support, open source soon

Exadel Fiji extends JSF by allowing the use of Flex with JSF components and within a JSF page. It comes with ready-to-use charting components based on Flash as well as universal wrapper which allows to wrap any Flash component as JSF component.

We are working on Fiji version 2.0 which is going to be open source and also include a new tag to wrap any JavaFX applet as JSF component. We are going to host Fiji on exadel.org site. Work is still in progress but we have already made some changes to make it simpler for you to get involved. We now have a new Fiji forum on exadel.org (moved from Google Groups) and an issue tracker (Jira). This will enable you to request new features and enter any bugs you find. Once your register on exadel.org, you will be able to post on the forum and Jira.

JavaFX plug-in for Eclipse: suggest features, try nightly builds

With the launch of exadel.org, it’s now very easy to try nightly builds of JavaFX plug-in for Eclipse, and view and submit new bugs. Using Jira (or the forum), you can tell us what features you would like to see in JavaFX plug-in for Eclipse. Our plan is to have a very short release cycle, around 2 weeks. We will fix bugs and add a few minor features each release. Let us know what features you would like to see!

exadel.org – Exadel’s open source community and projects

I’m happy to announce that our open source community and projects web site exadel.org is now live. It also hosts its first project: JavaFX plug-in for Eclipse. Why did we create this web site? Exadel always had a number of projects available on its site for download, most of them are free. One of the biggest challenges for users was to get involved. Even though most products were open source, it wasn’t easy to get the source code. The actual download was hosted on exadel.com, support forum for each project was hosted on Google Groups, and there was no way to enter any bugs. There was a big disconnect. exadel.org will try to solve all this, it will provide everything you would expect from man open source site and community. Everything is integrated now, you get product download, source code, forum and Jira to enter bugs. Our goal is to make it as simple as possible to get involved and use our products.

exadel.org is still work in progress. We are planning to move more projects there in the near future. We would love to hear your feedback, let us know what we can do better!

JavaFX plug-in for Eclipse has been updated as well, it’s now version 1.2.2 with the following new feature:

  • New JavaFX Script Wizard
  • Outline View with navigation

I’ll have a separate blog post about the plug-in.