-->
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: HQL Query funktioniert nicht
PostPosted: Tue Sep 22, 2009 4:51 am 
Newbie

Joined: Tue Sep 22, 2009 4:34 am
Posts: 4
HAllo,
ich nhabe folgendes problem, ich habe ein kleines hibernateprogramm, in dem ich auf meiner datenbank arbeite, das funktioniert alles wunderbar, solang ich keine hql-queries verwende, dann bekomme ich eine exception, zu der ich bis jetzt nichts gefunden hab. Ich bin neu auf dem gebiet hibernate und hoffe ihr könnt mir helfen. Danke euch

Code:
      Session session = null;
      Transaction tx    = null;
      Query query    = null;
      
      
      try
      {
         session = sf.openSession();
         tx = session.beginTransaction();
         query = session.createQuery("from Person");
         query.executeUpate();
         List<Person> persons = (List<Person>)query.list();
         
         tx.commit();
         
         
      }
      catch (Exception e)
      {
         e.printStackTrace();
         tx.rollback();
      }


hier meine exception
Code:
org.hibernate.HibernateException: Not supported for select queries
   at org.hibernate.hql.ast.QueryTranslatorImpl.errorIfSelect(QueryTranslatorImpl.java:237)
   at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:293)
   at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:808)
   at org.hibernate.impl.QueryImpl.executeUpate(QueryImpl.java:89)
   at test.TestCases.readAllByQuery(TestCases.java:349)
   at test.TestCases.prepareApplicationForRun(TestCases.java:100)
   at mainpackage.Main.main(Main.java:23)


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.