cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Bug 146022 - Hibernate framework is not recognized on project imported from eclipse
: Hibernate framework is not recognized on project imported from eclipse
Status: NEW
: javaee
Hibernate
: 6.5
: All All
: P3 (vote)
: 6.9
Assigned To:
:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-09-03 11:42 by
Modified: 2009-11-04 17:07 (History)
Issue Type: DEFECT
:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-09-03 11:42:23
build 20080902

steps:
-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 From 2008-09-04 00:09:46 -------
Btw. what hibernate plugin are you using in Eclipse? Fresh Eclipse does not
have any support for Hibernate.
------- Comment #2 From 2008-09-04 00:48:02 -------
You need to install the plugin for the Hibernate. Don't remember where I got
it. Must be from somewhere on the
hibernate.org.
------- Comment #3 From 2008-09-04 00:51:18 -------
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 From 2008-09-04 01:03:19 -------
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 From 2008-09-04 01:15:17 -------
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
http://www.hibernate.org/hib_docs/tools/reference/en/html/setup.html
------- Comment #6 From 2008-09-05 19:47:18 -------
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 From 2008-09-08 01:19:19 -------
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 From 2008-11-20 09:17:17 -------
Will re-look in 7.0
------- Comment #9 From 2009-05-06 17:57:09 -------
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.