-->
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: Joined-subclass joins
PostPosted: Thu Jun 08, 2006 10:51 am 
Newbie

Joined: Wed Jul 13, 2005 2:00 pm
Posts: 6
Is it not possible to do theta style joins and reporting style queries with joined-subclass and table per subclass? Inserts and selections by id work fine for me.

I've looked through two off-the-shelf books and all relevant forum entries and would greatly appreciate any help.

Hibernate version: Latest

Database version: SQL Server

Full stack trace of any exception that occurs:Caused by: java.sql.SQLException: The column prefix 'foo0_1_' does not match with a table name or alias name used in the query.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:418)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:693)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 24 more


The generated SQL (show_sql=true):

select
foo1_.description as col_0_0_, count(*) as col_1_0_
from foo foo0_, bar bar1_
where bar1_.contact_code=foo0_1_.contact_code and
foo0_1_.client_id=?
group by bar1_.description


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 12, 2006 9:19 am 
Newbie

Joined: Wed Jul 13, 2005 2:00 pm
Posts: 6
Can I provide any additional information? I would really like to get this solved.

Here's the hql query snippet:
Code:
             .createQuery(
                        "select foo.description,count(*) "
                        + "from Foo foo, "
                        + "Bar bar "
                        + "where "
                        + "bar.contactCode=foo.contactCode and "
                        + "foo.clientID=? "
                        + "group by bar.description");


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.