Friday, October 20, 2006

Hibernate Tools for Eclipse

There are a lot of Hibernate/Eclipse plugins out there. One that I used recently was the Hibernate Tools plugin that is part of the JBoss IDE. I'm paranoid about installing plugins in Eclipse, since I've used some that caused a lot of instability (XMLSpy comes to mind,) so I only installed the Hibernate Tools plugin, not all of the JBoss IDE plugins.

It seems to be very good for maintaining/upgrading Hibernate artifacts. It was very easy to configure a Hibernate console by using an existing Hibernate configuration file. This file specified annotated classes. I had made some changes to the database, but I was easily able to connect to the DB and generate new artifacts (new annotated classes, i.e. EJB3 Entity Beans.) This served my purposes perfectly.

I could also load a separate Hibernate configuration file, this one that specified classes mapped with good 'ol HBM XML files. I could easily generate Entity Beans for these classes as well (or new HBMs, etc.)

I also gave it a try at reverse engineering from an existing schema. This worked very well. I still like Middlegen's interface for this, since it allows you to easily customize data types (like specifying java.util.Date instead of java.sql.Timestamp) and relationships (removing inverses, etc.) Still, this seems to be a great all-around tool.

No comments: