This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 124789

Summary: JPA needs to automatically add the hibernate jars in project classpath,when its chosen as the persistance provider
Product: javaee Reporter: Vadiraj Deshpande <vadirajvd>
Component: PersistenceAssignee: Dongmei Cao <dongmeic>
Status: RESOLVED FIXED    
Severity: blocker CC: abadea, kganfield
Priority: P3    
Version: 5.x   
Hardware: Sun   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Vadiraj Deshpande 2008-01-07 05:54:53 UTC
JPA currently allows to select Hibernate as one of the implementation. However, users are expected to manually add the
jars in the project classpath. This registering of jar files in the current project classpath can be automated helping
the user in development.
Comment 1 Dongmei Cao 2008-05-28 20:10:36 UTC
Need to create a new library definition containing the necessary jars (including Hibernate EntityManager jars) for the
persistence module to use. The library will be automatically added if Hibernate is selected as the Persistence Provider.
Comment 2 Dongmei Cao 2008-06-02 22:28:39 UTC
Checked in fix in the j2ee.persistence module - http://hg.netbeans.org/main/rev/4d2b121bbf94
Need to fix the hibernatelib module to create the hibernate-jpa library (TBD).

As commented in the checkin:

The hibernate-jpa library is added by the hibernatelib module, which is one of the Hibernate
support modules. The logic here is if the hibernate-jpa library is found, meaning
hibernate support modules are installed, then the necessary hibernate jars will be added.
If Hiberante support modules are not installed, then the user still needs to add the jars
manually as before. I do not want to declare dependency on the hibernatelib module.
Comment 3 Andrei Badea 2008-06-04 14:28:20 UTC
Sorry, I would like to question this changeset. 

First, please start by adding the hibernate-jpa library (the name is not important, it just needs to contain the
org.hibernate.ejb.HibernatePersistence class). Actually, I would prefer that no library be added -- just add the
respective jar to the Hibernate library. Then the Hibernate library should be added to the project just as the TopLink 
library is added today -- do you know how that works?. Also, if you need to search for the Hibernate library you should
do so by searching for a specific class, not by the name. You want to support the user removing the bundled Hibernate
library and registering his/her own.
Comment 4 Dongmei Cao 2008-06-05 23:17:39 UTC
Modified the Hibernate Library to have the necessary jars for JPA
http://hg.netbeans.org/main?cmd=changeset;node=483e4b888ee3
http://hg.netbeans.org/main?cmd=changeset;node=c6dfa5559bc1
ttp://hg.netbeans.org/main?cmd=changeset;node=0f5797a79360
Comment 6 Dongmei Cao 2008-06-05 23:23:28 UTC
So, we'll only automatically add the system defined (or bundled) hibernate library. If the user decides to delete the
bundled library, then s/he is on her/his own. 
Comment 7 Dongmei Cao 2008-06-11 00:41:03 UTC
Please verify the bunlded Hibernate library is automatically added when Hibernate is selected as Provider