Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 146022 - Hibernate framework is not recognized on project imported from eclipse
Hibernate framework is not recognized on project imported from eclipse
Product: javaee
Classification: Unclassified
Component: Hibernate
All All
: P3 (vote)
: 8.1
Assigned To: Sergey Petrov
Depends on:
  Show dependency treegraph
Reported: 2008-09-03 11:42 UTC by Jan Horvath
Modified: 2014-07-21 12:43 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description Jan Horvath 2008-09-03 11:42:23 UTC
build 20080902

-create hibernate project in Eclipse
-enable Hibernate support 
-create valid hibernate.cfg
-import the project to netbeans
-ERROR: hibernate framework is not recognized in imported project
Comment 1 David Konecny 2008-09-04 00:09:46 UTC
Btw. what hibernate plugin are you using in Eclipse? Fresh Eclipse does not have any support for Hibernate.
Comment 2 Dongmei Cao 2008-09-04 00:48:02 UTC
You need to install the plugin for the Hibernate. Don't remember where I got it. Must be from somewhere on the
Comment 3 Dongmei Cao 2008-09-04 00:51:18 UTC
It is because the .cfg.xml is not in the excepcted location - src root (src/java). Currently, we look for any .cfg.xml
under src root to determine if Hibernate framework is included in the project. Eclipse seems to let the user put the cfg
file anywhere they want, not just the src directory. I don't know how this works for them. But it seems to be a problem
for us.
Comment 4 David Konecny 2008-09-04 01:03:19 UTC
dongmeic, in worst case scenario we could do something similar to what we did for persistence.xml - eclipse importer
will find a .cfg.xml file and update a NetBeans property. Btw. where does Eclipse place the files?
Comment 5 Dongmei Cao 2008-09-04 01:15:17 UTC
When you create a new cfg.xml file in Eclipse, it ask you to specify the location. From what I can tell, it can be
anywhere in the project. And you can have more than one cfg file in one project and they can be in different locations.

Also, to install the hibernate plugin, follow
Comment 6 Dongmei Cao 2008-09-05 19:47:18 UTC
I don't think anything needs to be fixed here (what do you think, Vadiraj?). Here are the difference scenarios: 
- If the .cfg.xml file is in the src root, the Hibernate framework is recognized just fine.
- If the .cfg.xml is in src, but not at src root, the Hibernate framework is not recognized. But this is not an import
project issue. It is a general issue of how we recognize the Hibernate framework in the project. See issue 145464 - desc 14.
- If the .cfg.xml is not in the src, the framework is not recognized. But I don't think this is an issue. The cfg files
should be in the src. According to Hibernate spec, cfg files need to be on classpath.
Comment 7 David Konecny 2008-09-08 01:19:19 UTC
Re. "I don't think anything needs to be fixed" - in this particular test case I tend to agree. I just wonder how Eclipse
project can work if config file is not in a package root. That I think would be worth to investigate.

Aside from this issue, as you probably know, Hibernate is quite flexible when it comes to configuration and there are
options of not using XML config file at all and use programmatic way instead. Or you can programatically load XML
configuration file from any location and file can have any name.
Comment 8 Vadiraj Deshpande 2008-11-20 09:17:17 UTC
Will re-look in 7.0
Comment 9 Petr Jiricka 2009-05-06 17:57:09 UTC
Do you have a pointer to the Hibernate documentation which says that hibernate.cfg must be in src/java? It makes sense
that this requirements is important at runtime, but do people really also do this at development time? Often people use
some obscure 'conf' directories and then use Ant script to copy them to the Java source root at build time. I am not a
fan of this approach, but it may not be too uncommon.
Comment 10 Sergey Petrov 2014-07-15 13:30:35 UTC
According to some comments it looks as a candidate to close as won't fix.
We may not support any location for eclipselink project as if we wil move to some recognized by importer, it may break some other dependencies, but we also do not work with custom location outside of src, it's our limitation If I've got it right (may be based on required/preferred way hibernate specification state)
Comment 11 Sergey Petrov 2014-07-21 12:43:44 UTC
if anybody have smth to add, feel free, but I'm closing now

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo