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 185755 - Problems with built-in Hibernate in NetBeans 6.8 (It doesn't come with JPA2.0 implementation). Also problem triyng to add latest Hibernate version, downloaded recently from Hibernate.org.
Summary: Problems with built-in Hibernate in NetBeans 6.8 (It doesn't come with JPA2.0...
Status: RESOLVED INVALID
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-08 02:48 UTC by tesshu
Modified: 2010-10-13 01:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tesshu 2010-05-08 02:48:21 UTC
(An anticipated sorry for the mispellings, english is not my main language)

I´ve just downloaded the most complete NetBeans 6.8 from netbeans.org (netbeans-6.8-ml-java-windows).
First of all, i started following some tutorials using the built-in hibernate libraries that came along with the NetBeans 6.8 itself, namely Hibernate-JPA wich can be added to the project by right-clicking the Libraries folder of the project, then add Library and select Hibernate-JPA.
I had no problem using JPA imports to let the application independant from the implementation (hibernate), such as using javax.persistance.EntityManagerFactory, EntityManager and Persistence. I could also auto-generate my tables simply using annotations. It was all working fine using EntityManager methods like "find", "remove" and "add".

When i tried doing something more advanced, like a Criteria-based search, i found out that the "javax.persistence.criteria" wasn't in the library (AS SHOWN IN THE RIGHT PART OF THE ATTACHMENT). I tried adding all hibernate-related libraries i could find, but none of them had it, only the EclipseLink-JPA2.0 Library had the criteria package, but was of no use since the rest of my Hibernate packages that came with NetBeans6.8 couldn´t use Criteria features.

So i downloaded the latest release from hibernate.org (hibernate-distribution-3.5.1-Final-dist) but could neither open the Projects that came inside the file nor explicit import the libraries into my project. I will try to explain step-by-step what i did:
I extracted the hibernate-distribution-3.5.1-Final-dist.zip to a folder and went back into the IDE Window and tried adding the folder as a library (Right click on Libraries -> add jar/folder -> select folder hibernate-distribution-3.5.1-Final-dist), it took a while for the IDE to finish searching the new files and then i tested importing javax.persistence.EntityManagerFactory; but it didnt recognize the class. So i undone this last step: removed it from the project, added the Hibernate-JPA built-in library again.
Then i tried opening the Hibernate examples/tutorials that came with the Hibernate 3.5.1 file (AS SHOWN IN THE LEFT PART OF THE ATTACHMENT) because NetBeans recognized it as Maven projects. But none of the "supposed projects" opened, all of the folders marked as Maven Projects in the attachment gave the same message:


WARNING: You are running embedded Maven builds, some build may fail due to incompatibilities with latest Maven release.
         To set Maven instance to use for building, click here.
[ERROR]Error scanning for extensions: Cannot resolve pre-scanned plugin artifact (for use as an extension): org.jboss.maven.plugins:maven-jdocbook-style-plugin: Failed to resolve extension plugin: org.jboss.maven.plugins:maven-jdocbook-style-plugin:maven-plugin:2.0.0
------------------------------------------------------------------------
For more information, run with the -e flag
------------------------------------------------------------------------
 + Ignoring build failures
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 2 seconds
Finished at: Fri May 07 21:02:05 GMT-04:00 2010
Final Memory: 126M/303M
------------------------------------------------------------------------
Comment 1 Petr Jiricka 2010-10-06 13:03:32 UTC
Reassigning to Persistence. In general, Hibernate should be supported as the JPA 2.0 implementation, right now the IDE can only use the bundled Hibernate as a JPA 1.0 implementation - I created a separate bug 190800 so we don't mix several things together.
Comment 2 Sergey Petrov 2010-10-12 11:05:40 UTC
What I see now the issue either invalid, as I'm not sure any library can be added by "select folder hibernate-distribution-3.5.1-Final-dist" or maven related if there is valid usage/opening of maven projects from hibernate distribution.
Comment 3 Sergey Petrov 2010-10-12 13:10:42 UTC
regarding library addition as I said I dont see it's valid to addd root folder for entire hibernate distribution.

regarding maven.
have you tried http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/ch01.html regarding ide configuration, paths, repository?

Move to maven for evaluation, ide may not know about jboss maven repository but I'm not sure if it should know or not by default.

regarding jpa2.0 and hibernate itself it's in issue 190800
Comment 4 David Konecny 2010-10-13 01:47:11 UTC
tesshu,

none of the problems you are experiencing are NetBeans specific. They both are related to Hibernate documentation or Maven documentation which you should consult. More details inlined:

(In reply to comment #0)
> So i downloaded the latest release from hibernate.org
> (hibernate-distribution-3.5.1-Final-dist) but could neither open the Projects
> that came inside the file nor explicit import the libraries into my project. I
> will try to explain step-by-step what i did:
> I extracted the hibernate-distribution-3.5.1-Final-dist.zip to a folder and
> went back into the IDE Window and tried adding the folder as a library (Right
> click on Libraries -> add jar/folder -> select folder
> hibernate-distribution-3.5.1-Final-dist), it took a while for the IDE to finish
> searching the new files and then i tested importing
> javax.persistence.EntityManagerFactory; but it didnt recognize the class. So i
> undone this last step: removed it from the project, added the Hibernate-JPA
> built-in library again.

What you were supposed to do was to add to project classpath these two jars:
- hibernate-distribution-3.5.6-Final/hibernate3.jar
- hibernate-distribution-3.5.6-Final/lib/jpa/hibernate-jpa-2.0-api-1.0.0.Final.jar
(for example by using "Libraries -> add jar/folder -> select a jar file")
That would make Criteria API available as well as Hibernate implementation of it. This info should be part of how to use Hibernate docs.


> Then i tried opening the Hibernate examples/tutorials that came with the
> Hibernate 3.5.1 file (AS SHOWN IN THE LEFT PART OF THE ATTACHMENT) because
> NetBeans recognized it as Maven projects. But none of the "supposed projects"
> opened, all of the folders marked as Maven Projects in the attachment gave the
> same message:
> 
> 
> WARNING: You are running embedded Maven builds, some build may fail due to
> incompatibilities with latest Maven release.
>          To set Maven instance to use for building, click here.
> [ERROR]Error scanning for extensions: Cannot resolve pre-scanned plugin
> artifact (for use as an extension):
> org.jboss.maven.plugins:maven-jdocbook-style-plugin: Failed to resolve
> extension plugin:
> org.jboss.maven.plugins:maven-jdocbook-style-plugin:maven-plugin:2.0.0

Most likely you need to register JBoss Maven repository so that Maven can use it to resolve above plugin. After that the build should pass. In any case NetBeans just execute given Maven pom.xml and if something does not work with it then you would get the same problem when executing the maven from command line. So you should consult Hibernate documentation on how to build there the Hibernate from sources and what preconditions needs to be met.

Hope that helps. Once issue 190800 is fixed then you will be able to skip all these steps.