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


  1. What version of NetBeans are you using? I tried this with 6.8 and it did not work for me.

    Comment by Michael | January 27, 2010

  2. I was using NetBeans 6.7
    I haven’t tried with NetBeans 6.8 yet.

    Comment by RunningTracker | January 28, 2010

  3. hi,
    i have a problem using hibernate in netbeans rcp. im using oracle database with ojdbc14 oracle driver. everything works fine in a simple swing environtment, but after i use it in rcp, there is an oracle driver exception,

    could you please give us bit complete sample, since i am still confuse for one and another, your tutorial is too short


    Comment by tejo | April 21, 2010

  4. hi, i have a problem with hibernate using netbean platform 6.8

    This is my story.

    i am using oracle database with ojdbc14.jar driver.

    First i create hibernate entity tobe wrapped latter in a netbean module, i tested the hibernate connection configuration and everything just works well. i can connect to oracle database.

    Then i wrapped that hibernate entity jar as a netbean module, create another module to warp my ojdbc14.jar then i test it. and, im using hibernate library dependency that available on netbean platform,

    but unfutornatelly i got oracle sql error saying “no suitable driver for [connection url]”

    thats quite weird since that doesn’t happend when test it before with out netbean platform.

    i thought that is related to netbeans lazy loading issue, i am not sure,.

    any idea ?

    Comment by tejo | April 25, 2010

  5. you wrote:
    I added some files in the Hibernate module:

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

    hi, plz help, how to add the hibernate module with cglib, do i need to rebuild the hibernate distribution ?

    Comment by Tejo | June 9, 2010

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: