-->
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: with-clause referenced two different from-clause elements
PostPosted: Sun Oct 14, 2012 9:57 am 
Newbie

Joined: Sun Oct 14, 2012 9:19 am
Posts: 1
Hello All,

I have the same issue as described in https://hibernate.onjira.com/browse/HHH-7321. Any attempt to make complex condition using 'with' HSQL statement fails with exception: 'with-clause referenced two different from-clause elements'.

Has anyone workaround this issue?

I see only the two ways:
1) write Native SQL
2) patch Hibernate according to patch in https://hibernate.onjira.com/browse/HHH-1673

But both solutions are dirty for me. Also it is not clear for me why HHH-1673 is marked as deprecated?

In my example there was following classes:

Code:
MInstance (long id, String name, MInstanceScanResult lastScanResult, Set<MInstanceThreshold> thresholds)
MInstanceThreshold (long id, MInstance instanse, String metric, Double value)
MInstanceScanResult (long id, Date startDate, Date finishDate, Set<MInstanceValue> values)
MInstanceValue (long id, MInstanceScanResult scanResult, String metric, Double value)


I wanted to select planned and actual values by one HSQL query:

Code:
select i.id, p.metric, p.value, s.value
from MInstance i
join i.thresholds p
left join i.lastScanResult lsr
left join lsr.values s with s.metric = p.metric


It fails with exception 'with-clause referenced two different from-clause elements'. And it is not clear why, because I'm able to add similar 'ON' statement in SQL.


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.