Example: Weblog Application
Persistent Classes
The persistent classes represent a weblog, and an item posted
in a weblog. They are to be modelled as a standard parent/child
relationship, but we will use an ordered bag, instead of a set.
Hibernate Mappings
The XML mappings should now be quite straightforward.
]]>
]]>
Hibernate Code
The following class demonstrates some of the kinds of things
we can do with these classes, using Hibernate.
:minDate"
);
Calendar cal = Calendar.getInstance();
cal.roll(Calendar.MONTH, false);
q.setCalendar("minDate", cal);
result = q.list();
tx.commit();
}
catch (HibernateException he) {
if (tx!=null) tx.rollback();
throw he;
}
finally {
session.close();
}
return result;
}
}]]>