views:

313

answers:

2

I have class that uses hibernate, I have included all required jars to classpath and class worked before Java updated itself. But now eclipse shows that it cannot resolve some hibernate imports. What could be solution to this?

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
+1  A: 

Did you try "Project > Clean ..."? What is the exact error message? After a Java update, you might need to update the path to the JDK: "Window > Preferences > Java > Installed JREs"

sfussenegger
I tried to clean project and I have updated path to jdk
newbie
And what's the exact error message?
sfussenegger
The import org.hibernate.SessionFactory cannot be resolved and same for other hibernate classes
newbie
Sounds really strange. Sorry, I don't have any good ideas on how to proceed. Maybe try to write a new class and import these two classes. Or remove the imports and use "Organize Imports" to automatically add them again. Try restarting eclipse, closing and reopening the project ... well, no rocket science here, but maybe ...
sfussenegger
I removed all jars and downloaded them again and then added jars to project, and now there is no problmes, very strange indeed
newbie
This is a glitch in eclipse. Most of the time cleaning and refreshing the project is enough, but sometimes it is necessary to remove and re-add the jars from the build path to force eclipse to re-evaluate the path. I doubt that downloading the jars again actually changed anything.
Yoni
+1  A: 

if you type (Ctrl + shit + t) or open the (type explorer) and type SessionFactory or Configuration does eclipse find them? if no then for sure you have some problems in the .jar files, try to delete and replace them back.

by the way are you using a Mac or PC?

Omar Al Kababji