I have a question.
I have this code.
Code:
public Element getData(String queryString) {
Element queryResult = null;
Session session = null;
try {
session = hibernateUtil.getSessionFactory().openSession();
Session dom4jSession = session.getSession(EntityMode.DOM4J);
Query query = dom4jSession.createQuery(queryString);
List res = query.list();
if (res != null && res.size() > 0) {
Object[] temp = null;
try {
temp = (Object[]) res.get(0);
if (temp != null) {
queryResult = (Element) temp[0];
}
} catch (ClassCastException e) {
queryResult = (Element) res.get(0);
}
}
} catch (Throwable e) {
throw new QualaRuntimeException(e);
} finally {
if (session != null) {
session.close();
}
}
return queryResult;
}
Example queryString "from element as x where x.id = 8";
<elem>
<id></id>
<file1></file1>
<text1></text1>
<text2></text2>
<file2></file2>
</elem>
if element have a field of type file I did not want to do the loading of your content. is it possible? how?
I needed that because this field can have a very large size and if you're 2 or 3 such fields filled and this is quite slow loading.
Thanks in advance for your support, I'm quite new to hibernate and this is my first message on the board :)