I am trying to use squeryl and update a column with another value concatenated with a string. So at first I tried this (simplified/contrived example):
update(songs)(s =>
where(s.name isNull)
set(s.year_str := Some(s.default_year + " AD"))
This results in the query:
update `songs` set
`year_str` = (`songs`.`default_year`)
Where `songs`.`name` is null
Notice the concatenation is gone!
I read the squeryl documentation and tried with:
update(songs)(s =>
where(s.name isNull)
set(s.year_str := Some(&(s.default_year || " AD")))
this resulted in a NullPointerException
Caused by: java.lang.NullPointerException: null
at org.squeryl.internals.FieldReferenceLinker$.pushExpressionOrCollectValue(FieldReferenceLinker.scala:36) ~[squeryl_2.10-0.9.6-M1.jar:0.9.6-M1]
at org.squeryl.dsl.QueryDsl$class.$amp(QueryDsl.scala:204) ~[squeryl_2.10-0.9.6-M1.jar:0.9.6-M1]
...
What is the squeryl way to generate the following query:
update `songs` set
`year_str` = concat(`songs`.`default_year`, 'AD')
Where `songs`.`name` is null