Problem with MAX function in Hibernate



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

.



Relevant Pages

  • Re: "Using hdparm in limited user accounts" or "starting progs with admin rights before waking up fr
    ... when I use Hibernate Trigger programs are not executed with admin ... returning from hibernation to my limited account. ... simply be but into a batch file and placed in the start-up folder. ... execute the command as part of your startup process. ...
    (microsoft.public.windowsxp.general)
  • Re: Endless Preparing to Hibernate
    ... Enquire, plan and execute ... Derek Harvey wrote: ... 'Preparing to Hibernate' but never gets any further and the machine ...
    (microsoft.public.windowsxp.help_and_support)
  • Hibernate - Collection Mapping
    ... I'm new to Hibernate and now I got stuck when trying to map a simple 1- ... can have a number of posts for which reason the class Location holds a ... The problem is now that if I execute the following code, ... Location is stored into the DB, but not the contained Posts in its ...
    (comp.lang.java.databases)
  • Re: Shutdown vs Turn Off Computer (for Hibernate)
    ... Enquire, plan and execute ... while I have a pull down menu (that includes Hibernate). ...
    (microsoft.public.windowsxp.general)