-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate-SQL-Problem
PostPosted: Tue Jun 06, 2006 7:06 am 
Newbie

Joined: Tue Jun 06, 2006 6:50 am
Posts: 3
Hello,
i've a problem with hibernate 3. i have two tables in my database, one is called QUESTIONNAIRE with a primary key qid, the other is called ANSWERS with a primary key aid and a column qid - which is not declarated as foreign key!

in my code i have the following statement:

Code:
ses = HibernateSessionFactory.currentSession();
sql = "from Questionnaire as questionnaire order by questionnaire.qid";
Query query = ses.createQuery(sql);


but: after calling this, all lines of the EVALUATION-table are included into the resulting set too!

how can this be possible, what can i do to fix it (or what do i wrong - but something like that shouldn't happen)?

thx in advance,
mart05


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 06, 2006 8:38 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

Is EVALUTION table is ANSWERS table?

If you want hibernate not to load all the other values then you need to set lazy="true" in the mapping for Lazy Initialization.

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 06, 2006 10:59 am 
Newbie

Joined: Tue Jun 06, 2006 6:50 am
Posts: 3
i solved the problem. the EVALUATION-class was extended from QUESTIONNAIRE-class.
it was an error/bug in the auto-generated hibernate-mapping of myeclipse. i don't know if there are general problems with that, but we had some ..

mart05


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

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.