facebook

the import net.sf.hibernate cannot be resolved

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #232853 Reply

    agenturs
    Member

    BEWARE: I’m a newbie and so far still completely ignorant to java and J2EE.

    I’m trying to work through some tutorials to get introduced to the java enviroment.

    By working through the database/hibernate tutorial I get stuck at the import in VipService.java (frame 209) with the above message on the following lines of code:

    import net.sf.hibernate.HibernateException;
    import net.sf.hibernate.ObjectNotFoundException;
    import net.sf.hibernate.Query;
    import net.sf.hibernate.Session;

    I run MyEclipse 4.0 Milestone 2 on Eclipse 3.1 on Mac OS X 10.4 Tiger.

    I know that the tutorial was made with an earlier version of MyEclipse.

    Does that have any influence? Where should net.sf.hibernate be? Should those classes have been created with adding hibernate capabilities?

    Any help is appreciated. If I missed a topic or documentation covering this, please forgive me. Just point me to it and I keep trying…

    Thanks

    Jean-Marie

    #232884 Reply

    Riyad Kalla
    Member

    Jean-Marie,
    You might just be missing the Hibernate.jar file from your build path. Right click on your project root, go down to Properties then click “Java Build Path” then click the “Libraries” tab and click “Add”, then navigate down into your project and find the hibernate.jar file, select it and hit OK. Do the errors go away?

    #232893 Reply

    agenturs
    Member

    Riyad,

    I checked the libraries and found

    hibernate3.jar – BasicDB/WebRoot/WEB-INF/lib

    No need to add…

    There is a hibernate3.jar in the root of the project but I can’t access it with Add JARs because there is only the other Project JSFLoginDemo to choose from.

    Error is still there.

    Jean-Marie

    #232895 Reply

    Brian Fernandes
    Moderator

    Jean-Marie,

    Our hibernate tutorial is for Hibernate 2, not Hibernate 3; you seem to have created a Hibernate 3 project.

    While this is not really a big deal at an itroductory level, Hibernate 3 changes the package names from net.sf.hibernate.* to org.hibernate.*

    Make that change in your files and you should be just fine.

    Hope this helps,
    Brian.

    #232937 Reply

    agenturs
    Member

    Yep, that was it. I didn’t catch the automatic hibernate 3 selection. As soon as I changed net.sf to org the errors dissapeared.

    Thanks a lot.

    Jean-Marie

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: the import net.sf.hibernate cannot be resolved

You must be logged in to post in the forum log in