the type="myclass.db.dao.Ver" is a custom user type. In the Java code, we're using Ver (and Inl and Inc) as objects where we use the java object's accessors methods to get and set the various attributes.
Here's an example of what I mean:
public static Resource getResource(Res a_res, String as_resourceId, String as_lang, String as_country, Session a_session)
throws HibernateException, SystemException {
Resource l_resourceObject = null;
try {
Criteria l_criteria = a_session.createCriteria(Res.class);
l_criteria.add(Expression.eq("Uid", new Long(2)));
// l_criteria.add(Expression.eq("Id", as_resourceId));
// l_criteria.add(Expression.eq("InlCode", as_lang));
// l_criteria.add(Expression.eq("IncCode", as_country));
Res l_res =(Res) l_criteria.uniqueResult();
if (l_res != null) {
l_resourceObject = new Resource("M", l_res.getInlCode().getCode(), l_res.getIncCode().getCode(),
l_res.getId(), l_res.getVerCode().getCode(), l_res.getRevision(), l_res.getValue());
}
} catch (HibernateException e) {
e.printStackTrace();
throw new SystemException(new Resource ("M", "EN", "US", "HIB", "1", 1, "Error fetching Resource from Hibernate"),
null, e);
}
return l_resourceObject;
Essentially, I'd like to be using the 3 lines that are commented out and get rid of the one line that is above them.
|