Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session.find method not found.

 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using hibernate3.jar and trying one example from "http://www.javaworld.com/javaworld/jw-01-2005/jw-0124-strutshibernate.html". I am getting a compile error at this line elements =
session.find(
HQL_FIND_ELEMENT,
searchForm.getSymbol(),
Hibernate.STRING);

I wasnot able to find session.find methos in the session class.

Can some one help what to do ?

Thanks
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
possibly relates to this:
Session interface
Certain redundant methods were deprecated and removed from the org.hibernate.Session interface. However, to make migration easier, these methods are still available, via the org.hibernate.classic.Session subinterface. These deprecated methods are:

query execution methods: find(), iterate(), filter(), delete()
saveOrUpdateCopy()
Hibernate3 applications should use createQuery() for all query execution, DELETE queries for bulk delete and merge() instead of saveOrUpdateCopy(). Existing applications may continue to use the deprecated methods.



you can read more in Hibernate3 Migration Guide
 
Unnikrishnan Nair
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the difference, for instance on session.find


List results = null;
Session session = session();
Query hibernateQuery = session.createQuery(query);
if (value != null) hibernateQuery.setParameter(0, value, Hibernate.STRING);
results = hibernateQuery.list();

Old code

List results = null;
Session session = session();
if (value != null) {
results = (List) session.find(query, value, Hibernate.STRING);
} else {
results = (List) session.find(query);
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic