Results 1 to 3 of 3

Thread: Problem with LockMode

  1. #1
    Join Date
    Jun 2005
    Location
    Bangalore, India
    Posts
    11

    Default Problem with LockMode

    Hi all,

    I am experiencing a problem while integrating Hibernate with Spring.

    Problem:-
    While compiling the error comming is....

    The type net.sf.hibernate.SessionFactory cannot be resolved. It is indirectly referenced from required .class files


    The code is as bellow:--

    import org.springframework.orm.hibernate.HibernateTemplat e;
    import org.hibernate.LockMode;
    import org.hibernate.SessionFactory;
    import com.cingular.phoenix.vo.Employee;

    public class EmployeeDaoHibernate {
    private SessionFactory sessionFactory;
    private HibernateTemplate hibernateTemplate;

    public void setSessionFactory(SessionFactory sessionFactory){
    this.sessionFactory = sessionFactory;
    this.hibernateTemplate = new HibernateTemplate(this.sessionFactory);
    }

    public Employee getEmployee(int id) {
    Integer empId= new Integer(id);
    return (Employee) hibernateTemplate.load(Employee.class, empId,LockMode.READ);
    }
    }

    I am using the latest Spring 1.2.1 and Hibernate 3.0
    I have seen that while building the latest Spring , the build was refering to some net.sf.net.sf.hibernate package was used for the classes like SessionFactory and Hibernatetemplate.

    The signature of the constructors are as follows...

    public org.springframework.orm..hibernate.Hibernatetempla te(net.sf.hibernate.SessionFactory arg);
    public org.springframework.orm..hibernate.Hibernatetempla te(net.sf.hibernate.SessionFactory arg, boolean arg);

    You can see how the SessionFactory is referenced from the net.sf.hibernate package while compiling. But there is no such package in the latest jars. I am not sure whether this is the source of the compilation problem or it might be any thing else.

    So if some body can kindly help me getting the solution?
    Thanks in advance.
    Thanks and Regards,
    Mahendra Kumar Dash
    Contact: 09886265054

  2. #2
    Join Date
    Jun 2005
    Posts
    19

    Default

    Hibernate 2.x uses packages:

    org.springframework.orm.hibernate.*

    Hibernate 3.x uses packages:

    org.springframework.orm.hibernate3.*

    Be sure you are importing from the correct package.

  3. #3
    Join Date
    Jun 2005
    Location
    Bangalore, India
    Posts
    11

    Default Problem with LockMode

    Yes lightc,
    I have also tried with the package org.springframework.orm.hibernate3

    But the same error is comming.
    I dont know what is the reason.

    Thanks for your inputs. Is there any other solution to the problem.

    Can any body send me a working code via email? I would like to see the running example, wherein Spring is intigrated with Hibernate3.0.

    Thanks a lot.
    Thanks and Regards,
    Mahendra Kumar Dash
    Contact: 09886265054

Similar Threads

  1. Replies: 1
    Last Post: Jul 5th, 2005, 03:48 AM
  2. Replies: 1
    Last Post: Jun 30th, 2005, 12:56 AM
  3. pagination and continuation problem in SWF
    By yfmoan in forum Web Flow
    Replies: 6
    Last Post: Jun 29th, 2005, 03:42 AM
  4. Replies: 0
    Last Post: Feb 16th, 2005, 01:45 PM
  5. Lazy Load Problem when Doing UnitTest
    By yoshi in forum Data
    Replies: 7
    Last Post: Sep 29th, 2004, 10:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •