Hi. I've been having a problem with 'setParameter'. I'm trying to filter a table by read-in 'affiliateID'. When I used setParameter within a very similar method, it worked fine. I would appreciate any tips or suggestions on this problem.
Hibernate version: 3.0
Code between sessionFactory.openSession() and session.close():
Movie theMovie = new Movie();
Session s = factory.openSession();
Transaction tx = s.beginTransaction();
//Retrieving data from DB
List test = s.createQuery("from Theatre").list();
Query q = s.createQuery("from Theatre t where t.affiliateID = :affiliateID");
q.setParameter("affiliateID",affiliateID);
List theAffiliateMovieList = q.list();
s.flush();
tx.commit();
if (s != null){
s.close();
}
Full stack trace of any exception that occurs:
The method setParameter(int, Object, Type) in the type Query is not applicable for the arguments (String, int)
Name of the database:MySQL
|