-->
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.  [ 4 posts ] 
Author Message
 Post subject: Expression.in problem
PostPosted: Fri Nov 07, 2003 11:20 pm 
Beginner
Beginner

Joined: Mon Sep 22, 2003 7:16 am
Posts: 25
I created an xml:
Code:
<class name="LoadingPlanVO" table="loading_plan">
  <id name="id" column="lp_id" type="int" >
    <generator class="identity"/>
  </id>
  <property name="office" column="lp_office" type="string"/>
  <property name="bookingId" column="lp_booking_id" type="string"/>
  ...

Then I tried:
Code:
List lps = session.createCriteria(LoadingPlanVO.class)
  .add(Expression.eq("office", office))
  .add(Expression.in("bookingIds", bookingIds))
  .list().

However, a SQLException raised and i found the sql logged is:
Code:
... WHERE Loadi0_.lp_office=? and [Ljava.lang.String;@1b5139e in (?)

where the bookingId could not be mapped into the sql field name.
Any clue?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 08, 2003 12:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
"bookingIds" is not the name of a property, according to your mapping. It is "bookingId". Of course, we should throw a more meaningful exception....


....criteria stuff is still quite new ... I need to work on the error checking at some stage ....


Top
 Profile  
 
 Post subject: oops
PostPosted: Sun Nov 09, 2003 9:23 pm 
Beginner
Beginner

Joined: Mon Sep 22, 2003 7:16 am
Posts: 25
I made a mistake on the question. But I did wrote ".add(Expression.in("bookingId", bookingIds))
" in the code...

The reason why I'm sure I wrote the correct name is that a different exception is raised if the mapping name is incorrect.
And I tried using bookingId with Expression.eq elsewhere, which works fine.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 4:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
hmmm. I looked at the code ... it seems to be correct ... well, submit the testcase to JIRA so I can step through....


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