Hibernate Syncronizer now generates code for Hibernate 3.0

M

msenin

I am one of those enterprise Java developers who loves Hibernate
Synchonizer plugin for Eclipse IDE. I think it's brilliant. It allows
you to go from database schema to Hibernate configuration file and
mapping files, and from them to generate Java code. "Yes", you may say,
"but there are other plugins that do that". True, but Hibernate Tools
3.0 are still in alpha4 version, and other plugins are generating
Hibernate 2.X-compliant code. Hibernate Synchronizer allows you to
regenerate your Java code every time your database or mappings change -
with one mouse click. And your custom code will not be wiped out: it
will keep your customized code. For each mapped entity it will create
DAO class and a Base class. DAO will incapsulate all Hibernate
operations, such as load(), save(), delete(), get(), find() etc., while
Base is a class you can subclass your POJO from, and that's why your
customized POJO code will not be erased - only Base and DAO are
regenerated. The only downside is that current version of Hibernate
Synchronizer generates code for Hibernate 2.X.

The original Hibernate Synchronizer can be found here:
http://hibernatesynch.sourceforge.net/

I modified the original product, and now it generates Hibernate
3.0-compliant code according with Migration Guide:


- packages changed from net.sf.hibernate.* to org.hibernate.*
- deprecated methods like session.find() are replaced with
session.createQuery()
- proper exceptions are thrown
- generated code is modified to use org.hibernate.Session instead of
net.sf.hibernate.Session (which has been moved to org.hibernate.classic
package in Hibernate 3.0)



You can download it here:
http://www.supremistic.com/pub/hibernate-sync-h3.zip

Installation:
Copy contents of the /features/ directory to your
<Eclipse-install-directory>/features directory.
Copy contents of the /plugins/ directory to your
<Eclipse-install-directory>/plugins directory.
Start Eclipse. Now if you right-click on any *.hbm.xml files, there
will be a Hibernate Synchronizer menu. Select "Synchronize Files". Java
code will be regenerated. For more information please refer to original
documentation here: http://hibernatesynch.sourceforge.net/

Alternatively, you can follow original installation instructions
(http://hibernatesynch.sourceforge.net/)(see "How do I install this
plugin" below on that page) and unzip my archive over it to overwrite
older files with mine.

An excellent article called "Working with Hibernate in Eclipse" by
James Elliott talking about Hibernate Synchronizer can be found here:
http://www.onjava.com/pub/a/onjava/2004/06/23/hibernate.html

Enjoy!
www.supremistic.com

The related discussion thread is here:
http://forums.supremistic.com/viewtopic.php?t=163
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top