SQL : It is not possible to use an SQLUpdateClause which sets columns to expressions

Bug #650617 reported by Luis Fernando Planella Gonzalez on 2010-09-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Querydsl
Fix Released
Medium
Unassigned

Bug Description

Currently, the update clause only have a .set(Path<T>, T), but with this, it is not possible to do things like "update t set a = a + 1"
I think we would need another method like .set(Path<T>, Expression<T>).
Maybe this should be supported in inserts as well (defined on the StoreClause). Maybe custom expressions which invokes db functions would work (like insert into x values (current_timestamp())).

Tags: sql Edit Tag help
tags: added: sql
summary: - It is not possible to use an SQLUpdateClause which sets columns to
+ SQL : It is not possible to use an SQLUpdateClause which sets columns to
expressions

I implemented that change in SVN trunk, but there is now the problem that set(someStringPath, null) calls are ambiguous and the compiler complains.

This can be fixed like this though :

set(someStringPath, (String)null)

Maybe an additional setNull(Path<?> path) could work. What do you think?

Changed in querydsl:
status: New → In Progress
Changed in querydsl:
importance: Undecided → Medium

For me, both solutions would be fine: either having an extra setNull(path) or having a method with a different name, like setExpression(path, expression)

Fixed in SVN trunk :

set(Path<T>,T)

set(Path<T>, Expression<? extends T>)

setNull(Path<T>)

Changed in querydsl:
status: In Progress → Fix Committed

Released in 2.0.1

Changed in querydsl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers