java - Cannot find symbol HibernateUtil -
i'm following tutorial on hibernate seen here , in 'filmhelper' class i'm trying session object so:
package dvdrental; import org.hibernate.session; public class filmhelper { session session = null; public filmhelper() { this.session = hibernateutil.getsessionfactory().getcurrentsession(); } }
but i'm getting 'cannot find symbol' error stating cannot find 'hibernateutil' ... has changed in way obtain session in hibernate, tutorial out of date, or have done wrong?
i'm not sure how should retrieve session, if filmhelper
instance stored somewhere.
if have access entity manager (i assume because of java-ee tag), need this:
session s = (session)entitymanager.getdelegate();
update:
the tutorial linked has part "creating hibernateutil.java helper file", maybe that's what's missing.
but please note start. more complex or robust solutions should have @ documentation , maybe use jpa abstraction level.
Comments
Post a Comment