Reputation: 834
Im getting a org.hibernate.hql.internal.ast.QuerySyntaxException in my query
Query query = session.createQuery("update Room as r "
+ "inner join Booking as b "
+ "on r.roomId = b.room.roomId "
+ "set r.roomAvailable = true "
+ "where b.checkOutDate < NOW()");
full error:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: expecting "set", found 'inner' near line 1, column 55 [update com.websystique.springsecurity.model.Room as r inner join com.websystique.springsecurity.model.Booking as b on r.roomId = b.room.roomId set r.roomAvailable = true where b.checkOutDate < NOW()]
the query is working fine in mysql workbench... so is this possible in anyway here in code or not?
Any help greatly appreciated.
Upvotes: 1
Views: 639
Reputation: 62
You have to use a query with a subselect instead of a join. Rewrite your query and it will work.
Upvotes: 1