Hvorfor findes dette synbol ikke
Jeg har mit dao obj. Til at hente en customer op af DB.package hs.backend.dao;
import hs.backend.entity.Customer;
import org.hibernate.SessionFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.HibernateOperations;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class CustomerDAO {
private HibernateOperations hibernateOperations;
public Customer retrieveCustomer(long customerID) throws Exception {
Customer customer = null;
try {
customer = (Customer) hibernateOperations.load(Customer.class, customerID); // FEJL
}
catch (HibernateObjectRetrievalFailureException e) {
throw new Exception(e.getMessage());
}
return customer;
}
public void createCustomer(Customer customer) {
hibernateOperations.save(customer);
}
public void updateCustomer(Customer customer) {
hibernateOperations.update(customer);
}
public void deleteCustomer(long customerID) {
//Customer customer = (Customer) hibernateOperations.load(Customer.class, customerID);
//hibernateOperations.delete(customer);
}
public HibernateOperations getHibernateOperations() { return hibernateOperations; }
public void setHibernateOperations(HibernateOperations hibernateOperations) { this.hibernateOperations = hibernateOperations; }
public void setSessionFactory(SessionFactory sessionFactory) {
HibernateTemplate template = (HibernateTemplate) hibernateOperations;
template.setSessionFactory(sessionFactory);
}
}
Fejl: C:\Documents and Settings\admin\Skrivebord\Spring Eksempel\HelloSpring\src\java\hs\backend\dao\CustomerDAO.java:25: cannot find symbol
symbol : method load(java.lang.Class,long)
location: interface org.springframework.orm.hibernate3.HibernateOperations
customer = (Customer) hibernateOperations.load(Customer.class, customerID);
1 error
Der er fejl i min load/get metode.
men der står her at det burde virke - http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/HibernateOperations.html#get(java.lang.Class,%20java.io.Serializable)