-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL query depth
PostPosted: Wed Dec 06, 2006 2:57 am 
Newbie

Joined: Wed Dec 06, 2006 2:48 am
Posts: 2
Is it possible to reference Object children to any depth:

The query below fails with exception:
Code:

ca.edbc.util.EdbcEx: line 1, Syntax error on ','.  The correct syntax is:
UPDATE table
   [FROM table {, ... }]
   SET column = expression|NULL {, ... }
   [WHERE search_condition]



This is the Query:
Code:
String hqlUpdate = "update CaseStage caseStage set caseStage.stageEnd=:stageEndValue where caseStage.stageType.finalStage=:finalStage";

        Query query = createQuery(hqlUpdate);
        query.setDate("stageEndValue", assignedDate);
        query.setLong("caseId", caseKey);
        query.setBoolean("finalStage", true);

        return query.executeUpdate();


I think it is the addition of the stageType.finalStage which is a Boolean, I have tried various things, is this a valid query.


Top
 Profile  
 
 Post subject: Further investigation
PostPosted: Wed Dec 06, 2006 7:19 pm 
Newbie

Joined: Wed Dec 06, 2006 2:48 am
Posts: 2
After digging into the hibernate source it looks like the SQL that is generated is adding a comma:
This is only occuring for the first query:
Code:
HQL:
update CaseStage _caseStage set _caseStage.stageEnd=:stageEndValue where  _caseStage.clasCase.id=:caseId AND   _caseStage.stageType.finalStage=:finalStage
                               
SQL:
update cl_case_stage, set d_stage_end=? where n_key_case=? and t_name=?

Code:
HQL:
update CaseStage _caseStage set _caseStage.stageEnd=:stageEndValue where  _caseStage.clasCase.id=:caseId

SQL:
update cl_case_stage set d_stage_end=? where n_key_case=?"


Am I doing this wrong


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.