You are asking, "How can I do regular SQL in Hibernate" but I'm answering, "How can I use Hibernate to do with Java objects what I used to do with SQL."
Code:
org.hibernate.Session hS = HibernateUtil.getSessionFactory().getCurrentSession();
try {
hS.beginTransaction();
Fuel fuel = (Fuel) hS.get(Fuel.class, fuelId);
System.out.println(fuel.getName());
System.out.println(fuel.getFuelType().getName());
} finally {
if (hS.isOpen()) {
hS.close();
}
}
I recommend getting one of the books and reading it. There are lots of good examples, plus a certain amount of manifesto that gives you an idea what Hibernate is doing and why. I have Hibernate In Action because I'm old. It seems every page of this forum advertises Java Persistence with Hibernate at the top of the page - that's probably worth looking into.