Learning the NetBeans Platform

Hibernate with the NetBeans Platform

I’ve had some difficulties using Hibernate in my NetBeans Platform application… so here is a quick summary of what I did. I created 4 NetBeans modules:

  • Derby
  • Hibernate
  • DataModel
  • Entities

Derby and Hibernate are library wrapper modules that contain JAR files.


  • Hibernate depends on Entities and on Derby
  • DataModel depends on Entities and Hibernate

I added some files in the Hibernate module:

  • log4j.properties
  • org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer (for the correct initialization of the module)


In Entities, I created the object “Imports” that needs to be stored in the DB:

  • hibernate.cfg.xml
  • Imports.hbm.xml
  • Imports.java


In DataModel, I have an installer (extends ModuleInstall) class that creates the connection to the DB:

  • sessionFactory = new Configuration().configure().buildSessionFactory();

Finally, I modified the project.properties file of the application to ignore some messages:

  • run.args.extra=-J-Dorg.netbeans.ProxyClassLoader.level=1000

And there we are, the application is connected to the Derby database when it is started !


April 8, 2009 Posted by | NetBeans RCP | 5 Comments