Announcement Announcement Module
No announcement yet.
Problem with LockMode Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with LockMode

    Hi all,

    I am experiencing a problem while integrating Hibernate with Spring.

    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 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.

  • #2
    Hibernate 2.x uses packages:


    Hibernate 3.x uses packages:


    Be sure you are importing from the correct package.


    • #3
      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.