-->
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: Problems with Hibernate and subqueries
PostPosted: Tue Jun 21, 2005 2:34 am 
Newbie

Joined: Mon Jun 06, 2005 8:21 am
Posts: 13
What is wrong with this query?

FROM table_a as a WHERE a.id in ( from table_b as b where b.opt_value='dsd')


Hibernate version:
2.1.7c

Mapping documents:

Code:
   <class name="Table_a" table="Table_a">
        <id name="id" type="int">
            <column name="id" sql-type="int" not-null="true" />
            <generator class="native"/>
        </id>
        <property name="name" />
        </class>

   <class name="Table_b" table="Table_b">
      <composite-id name="id" class="com.jme.Id" >
         <key-property name="id" column="id"/>
         <key-property name="opt_key">
            <column name="opt_key" sql-type="varchar(255)" />
         </key-property>
      </composite-id>   
      <property name="opt_value">
         <column name="opt_value" sql-type="text" />
      </property>
   </class>


Full stack trace of any exception that occurs:

2005-06-21 09:27:54,546 WARN net.sf.hibernate.util.JDBCExceptionReporter - SQL
Error: 1241, SQLState: 21000
2005-06-21 09:27:54,546 ERROR net.sf.hibernate.util.JDBCExceptionReporter - Oper
and should contain 1 column(s)

Name and version of the database you are using:
MySql 4.1.12 (Win)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 2:50 am 
Beginner
Beginner

Joined: Fri Feb 11, 2005 12:03 pm
Posts: 48
Location: Kiel, Germany
What about
Code:
FROM table_a as a WHERE a.id in ( select b.id from table_b as b where b.opt_value='dsd')
?


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.