Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

session.find method not found.

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 "". I am getting a compile error at this line elements =

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

Can some one help what to do ?

Ranch Hand
Posts: 1282
  • 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()
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
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);
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic