-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Question HQL and field type file
PostPosted: Mon Aug 05, 2013 10:44 am 
Newbie

Joined: Mon Aug 05, 2013 10:36 am
Posts: 1
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 :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.