Hibernate is generating invalid sql for a named query that's attempting to do an update. I have other similar named queries that work fine. Don't know what's going on here.
I will be happy to provide whatever other information is necessary to help resolve the issue.
It might be hard to spot the problem, so I'll just include the fact that a comma follows the name of the table to be updated in the generated sql:
update media, set is.....
Thanks for any insights.
Hibernate version:
core: 3.2.6ga
entity manager: 3.2.2.ga
annotions 3.2.1.ga
Mapping documents:
Quote:
<query name="Medium.SetCoversUnavailable_movie_inStockOn_region">
<![CDATA[update Medium m set m.isCoverAvailable = 'false' where
m.movie = :movie and m.dateInStock = :inStockOn and
m.purchaseOrder.shipToRegion = :region]]>
</query>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Name and version of the database you are using:PostgreSQL 8.?
The generated SQL (show_sql=true):Quote:
2009-04-15 13:25:24,395 DEBUG [org.hibernate.SQL] update media, set isCoverAvai
lable='false' where movieid=? and dateInStock=? and shipToRegion=?
Debug level Hibernate log excerpt:Quote:
2009-04-15 13:25:24,390 TRACE [org.hibernate.engine.query.HQLQueryPlan] executeUpdate:
update Medium m set m.isCoverAvailable = 'false' where
m.movie = :movie and m.dateInStock = :inStockOn and m.purchaseOrder.shipToRegion = :region
2009-04-15 13:25:24,390 TRACE [org.hibernate.engine.QueryParameters] named parameters: {inStockOn=26 February 2009, movie=com.nym.session.common.Movie#4203, reg
ion=com.nym.hbm.model.Region#1}2009-04-15 13:25:24,393 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open
PreparedStatement (open PreparedStatements: 0, globally: 0)2009-04-15 13:25:24,393 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDB
C connection2009-04-15 13:25:24,395 DEBUG [org.hibernate.SQL] update media, set isCoverAvai
lable='false' where movieid=? and dateInStock=? and shipToRegion=?2009-04-15 13:25:24,395 INFO [STDOUT] Hibernate: update media, set isCoverAvai
lable='false' where movieid=? and dateInStock=? and shipToRegion=?