-->
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: Invalid SQL generated: (+) in SQL query
PostPosted: Tue May 17, 2005 3:58 am 
Beginner
Beginner

Joined: Sun Mar 28, 2004 9:01 am
Posts: 21
Hello,

I'm using Hibernate 3.0. I have a strange effect when using a criteria query running on postgres 8.0:

return session.createCriteria(Person.class)
.add(Expression.and(Expression.eq("userid", userid), Expression.eq("vsnr", vsnr))
.uniqueResult();

The Person.class has a set to a PersonGroup.class what I think causes the problem:

* @hibernate.set
* inverse = "true"
* cascade = "all-delete-orphan"
* lazy = "false"
*
* @hibernate.collection-key
* column = "person"
* @hibernate.collection-one-to-many
* class = "PersonGroup"

And this are the SQL that are generated:

select this_.id as id0_, this_.VERSION as VERSION2_0_, this_.nachname as nachname2_0_, this_.titel as titel2_0_, this_.vorname as vorname2_0_, this_.vsnr as vsnr2_0_, this_.userid as userid2_0_ from person this_ where (this_.userid=? and this_.vsnr=?)

select persongrup0_.person as person__, persongrup0_.id as id__, persongrup0_.id as id1_, persongrup0_.VERSION as VERSION4_1_, persongrup0_.gruppe as gruppe4_1_, persongrup0_.person as person4_1_, persongrup0_.userid as userid4_1_, gruppe1_.id as id0_, gruppe1_.VERSION as VERSION3_0_, gruppe1_.beschreibung as beschrei3_3_0_, gruppe1_.name as name3_0_, gruppe1_.userid as userid3_0_ from person_gruppe persongrup0_, gruppe gruppe1_ where persongrup0_.gruppe=gruppe1_.id(+) and persongrup0_.person=?

As you can see, the second SQL is invalid as it contains a construct like gruppe1_.id(+). Is this a hibernate bug or is it a wrong definition?

Thx
Rene


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 5:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
seems like you havent set the proper Dialect. you should use the postgress dialect.

_________________
Max
Don't forget to rate


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.