-->
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: Unterschiedliche Ergebnisse vom HQL Editor und vom Java-Code
PostPosted: Tue Jun 05, 2007 8:15 am 
Newbie

Joined: Mon Jun 04, 2007 4:32 am
Posts: 2
Ich habe folgendes Problem:

Die Liste "result" bleibt leer, wenn ich folgende HQL-Abfrage aus dem Java-Programm heraus aufrufe.


select
count(*)
from
Consumerview
where
id.lastName in (
select
lastName
from
Psconsumer
where
status = 'loaded' and status in ('generated', 'loaded', 'locked', 'used', 'broken', 'saved') and isCompany= false)


Wenn ich aber die selbe Abfrage aus dem HQL-Editor aufrufe, dann erhalte ich ein Ergebnis.

Kann mir da jemand helfen?


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2.0

Mapping documents:

Code between sessionFactory.openSession() and session.close():
public static List executeSearch(String search) {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List result = session.createQuery(search).list();
System.out.println("SEARCH: " + search);
// Workaround for Sessions Problem (lazy Initialization)
if ((!search.equals("from Status")) && (!search.equals("from Stati"))
&& (!search.contains("from Gisaddresses where status"))
&& (!search.contains("from Sim"))
&& (!search.contains("from Msisdn"))
&& (!search.contains("from Fln"))
&& (!search.contains("count(*) from Psconsumer"))
&& (!search.contains("from Bankaccountview"))
&& (!search.contains("Consumerview"))
&& (!search.contains("count(cons) from Psconsumer"))) {
System.out.println("Bin wieder drin!");
for (Iterator it = result.iterator(); it.hasNext();) {
Psconsumer psc = (Psconsumer) it.next();
Hibernate.initialize(psc);
Hibernate.initialize(psc.getAccounts());
Hibernate.initialize(psc.getBankAccounts());
Hibernate.initialize(psc.getGObjects());
Hibernate.initialize(psc.getPssubscriptions());
}
}
/*
* if((search.contains("from Addresses where status")) ){ for(Iterator
* it=result.iterator();it.hasNext();){ Addresses
* psc=(Addresses)it.next(); Hibernate.initialize(psc); } }
*/

session.getTransaction().commit();
// session.close();
return result;
Full stack trace of any exception that occurs:

Name and version of the database you are using: Oracle 9

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


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.