Hibernate Learning Post 2:

  1. HQL language

HQL language stands for Hibernate Query Language.

select from ? where ? group by ? order by?

The HQL doesn’t support “*” statement. If needed, type “select username u from …” where u stands for an alias for “username”

HQL is most used for “search”, while fucntions of update, create and delete is mostly processed in POJO

POJO hibernate operating database function:

Configuration config=new Configuration().configure();

SessionFactory sf=config.buildSessionFactory();

Session session=sf.openSession();

// If intended on search for an item:

session.load(Employee.class, index);

 

Transaction ts=session.beginTransaction(); //only matters in update, save, or get mode

ts.commit(); // only matters in update, save or get mode

HQL hibernate operating database function:

basic settings remain the same with that of the mentioned above in the POJO method

String hql = “from Employee”;

Query query =session.createQuery(hql);

 

 

 




Sites DOT MIISThe Middlebury Institute site network.