First, kudos to Daniel for coming straight out and admitting that
I don't have very much experience with Hibernate and that:
I am comparing ActiveObjects and ActiveRecord to an annotations-less Hibernate. After all, that's what the default download is, right?
(Um, well, I guess the default download is whatever you decide to download by default...?)
Ok, that little blurb does deserve an apology; or rather a clarification. I had no intention of saying that AO is inherently faster than Hibernate under all circumstances. In fact, I think I've said a few times that AO is inherently less performant than Hibernate, just by design.
However, Daniel again complains that Hibernate is difficult to configure:
I've never been able to actually wade through the configuration to get it running.
Well, Daniel, let me help you get started with this. If you already have a JCA datasource configured, the following is usually all the extra configuration you need to use Hibernate inside the application server:
<persistence> <persistence-unit name="bookingDatabase"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/MyDatasource</jta-data-source> <properties> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> </properties> </persistence-unit> </persistence>
If you're not in an application server environment, the following should be enough to get you started:
<persistence> <persistence-unit name="bookingDatabase"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.jdbc.url" value="jdbc:hsqldb:."/> <property name="hibernate.jdbc.driver_class" value="org.hsqldb.jdbcDriver"/> <property name="hibernate.jdbc.username" value="sa"/> </properties> </persistence-unit> </persistence>
I hope that helps.
Finally, Daniel points to an error in my previous post. It turns out that ActiveObjects /does/ have a way to add business logic to your domain model. All you need to do is write an additional class (that does not implement the AO interface) with the methods and accessors that you want to customize.
OMG, OMG, OMG! I'm so excited: /the EJB 2 programming model lives again! Entity beans are reborn!/
The sad part about this is that in non-trivial cases, AO will often require /more/ code than Hibernate, since you will need to write two artifacts for each domain model class instead of just one.