问题
I have a table that, amongst other things, has two columns of type Long. In my query, i want to return rows where column A (type long) equals column B (type long). I would like to do this without writing raw sql, and instead use the much nicer method chaining.
So far i've always had a value to compare the column against, which i can pass in, such as
.eq("columnA", 5L)
However, I can't seem to find any method for something like
.eq("columnA", "columnB")
I feel like this should be a fairly standard kind of search to do (at least not rare). Does anyone out there know how I could do this?
回答1:
.raw("columnA = columnB") should work.
来源:https://stackoverflow.com/questions/25319922/ebeans-where-columna-equals-columnb-in-same-table