1

Apparently, a lot of ORMs do something like this:

query.filter(username == "bob")

to generate SQL like

... WHERE username = 'bob'

Why override the == operator instead of something like:

query.filter(username.eq("bob"))

2 Answers 2

4

This is a subjective question, but in general I would say that the syntax for the former is more intuitive, and since many (if not most) ORM's do this it's generally expected (making it more intuitive).

0

The whole point of orm is brideing the "impedance mismatch" between object and relational world , So in theory you can be blissfully unaware of "=" in sql world and work with "==" of the object world.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.