Problem with MAX function in Hibernate
- From: David <dav.david@xxxxxxxxx>
- Date: Tue, 31 Jul 2007 08:19:49 -0700
Hi
I have a mapped class called Position that have a field called max. I
want to update this field with a HQL sentence with Hibernate version
3.0:
Session session = sessionFactory.openSession();
String s = "update Position set max=1 where stock=1";
Query query = session.createQuery(s);
int i = query.executeUpdate();
When I execute this code I get an error:
*** WARNING: Keyword 'max' is being intepreted as an identifier due
to: expecting IDENT, found 'max'
Error: null
I thnig that hibernate is confused with the SQL MAX function. Is there
any way to execute this without change the field class?
I have tried with this too:
String s = "update Position p set p.max=1 where p.stock=1";
*** ERROR: line 1:16: expecting "set", found 'p'
String s = "update Position as p set p.max=1 where p.stock=1";
*** ERROR: line 1:16: expecting "set", found 'as'
String s = "update Position set {max}=1 where stock=1";
unexpected char: '{' [update Posicio set {max}=1 where tock=1]
Thanks
David
.
- Prev by Date: Re: masks and enums
- Next by Date: Re: Need efficient search strategy in list of time intervals
- Previous by thread: html tag lib
- Next by thread: Status of floating point arithmetic in Java?
- Index(es):
Relevant Pages
|