Hibernate EntityManager library for Netbeans 5.5

Today, I wanted to use Hibernate EntityManager in one project. I downloaded Hibernate EntityManager from official pages. Then unziped the file and just used all jars in my project. However, I got NoClassDefFoundError when executed my project. I asked on Hibernate forum and got very quick response that Hibernate core is required for using Hibernate EntityManager. Thanks steckemetz for you hint.
Many jars are needed for running Hibernate on your project and it's not simple to find out all jars on Hibernate pages. Therefore, I decided to create Hibernate EntityManager library for NetBeans 5.5 that includes all required jars and JavaDoc as well. You can download NetBeans nbm here.
Install this nbm in NetBeans 5.5 and you can see new library in Tools - Library Manager. Now, let's use it. It's really simple. If you want to develop application that uses Hibernate as O/R framework you can follow same steps as for TopLink that is bundled with NetBeans by default. Create new application, you can choose J2SE project, web or EJb project and then create new persistence unit. In this wizard choose Hibernate as Persistence Library and generate persistence.xml.
You can see in file that correct Hibernate options and provider are used in this file. Next, you can use Hibernate provider in your code. This module provides code completion for Hibernate as weel, see screenshot:
Comments:

Thanks for the info, I was just looking for that. However, I can not download the nbm file. It just fails everytime I try. Cheers!

Posted by Marcel Schepers on May 27, 2006 at 03:51 AM CEST #

The download works for me...

Posted by Lukas on May 28, 2006 at 10:29 AM CEST #

I downloaded the nbm and installed it but when I create the new persistence unit the only one listed is TopLink. Any ideas? Thanks

Posted by Carlos on May 29, 2006 at 07:42 PM CEST #

I have been trying for a couple of days and I can't download it either. I'm in Sweden and get a few bytes a second for a few minutes until IE finally gives up. Is it possible to mirror the file somewhere?

Posted by Patrik on May 30, 2006 at 03:09 PM CEST #

Hi Patrick, I can't upload the nbm to blogs.sun.com side since the size was exceeded (required Hibernate jars have 11 MB :-(). Therefore, I uploaded nbm on some public server that is very slow. If you want I can send you nbm directly to you Patrik.

Posted by PetrB on May 31, 2006 at 03:38 AM CEST #

Hi Carlos, can you send me screenshot of you PU wizard and build number of your IDE? Thanks for your help. Petr

Posted by PetrB on May 31, 2006 at 03:39 AM CEST #

Same here, when i use the PU wizard, only Toplink showed up and currently I am using the netbeans 5.5 beta with enterprise pack. Could you tell me which version is your netbeans? Thanks

Posted by Richard Huang on May 31, 2006 at 02:27 PM CEST #

A few painful hours with a download manager solved the problem ;) I will mirror it for a week or two in case anybody else is having problems downloading.

I get the below exception when browsing the auto created jsf pages. The first page view is allways ok. It is on the second (different page) view that the exception is thrown.

Petr, if you need more info, you can reach me at patrik{dot}buckau{at}buckadero{dot}se.

Cheers,
Patrik

javax.persistence.PersistenceException: org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache was: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "C:\\Documents and Settings\\demo\\.netbeans\\5.5beta\\apache-tomcat-5.5.16_base\\temp" which is already used by an existing CacheManager. The source of the configuration was classpath.

Posted by Patrik on May 31, 2006 at 02:43 PM CEST #

Hi guys, I tested the Hibrenate plugin in the latest NetBeans 5.5 builds. I'm sorry that the plugin doesn't work for you. I will test it tomorrow morning with NetBeans Beta 5.5.

Posted by PetrB on May 31, 2006 at 04:02 PM CEST #

Hi Patrik, you faced issue that is described here. Try to add mentioned element in persistence.xml.

Posted by PetrB on May 31, 2006 at 04:17 PM CEST #

Hi all, you are right only Toplink is listed in Provider combo box in NetBeans 5.5 Beta release. There was a bug that is already fixed in latest daily builds. I was able to use Hibernate in EJB module with Glassfish taget server. Use this plugin in latest daily builds.

Posted by PetrB on June 01, 2006 at 03:03 AM CEST #

Post a Comment:
Comments are closed for this entry.
About

pblaha

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks