Naming a property "in" in combination with Column(name="inputName") produces SQL Syntax Errors

58 views
Skip to first unread message

David Asbrand

unread,
Apr 25, 2022, 7:52:41 AM4/25/22
to Ebean ORM
  Hello,

we've stumbled upon a peculiar behaviour when naming a property of an entity "in" while giving it another column name (e.g. input) to avoid reserved keyword conflicts.

For example, our Entity Customer has a property:

@Size(max = 40)
@Column(name = "inputName")
String in;

For the most parts, this gets properly translated to t0.input_name in a lot of queries. However, whenever there is an actual sql "in" in the where clause, the translation becomes too eager - for example 

 where t0.id in (?) order by t0.id limit 1

becomes

 where t0.id [*]t0.input_name (?) order by t0.id limit 1

which understandably produces syntax errors.

I created a simple demonstration PR in which just adding this property breaks a lot of tests due to this replacement issue:


Our question is whether this behaviour works as intended and we should just avoid any reserved keywords even if we give a different name using the @Column annotation? For time being, we simply renamed the property to "inParams", avoiding all issues.

Michael Benz

unread,
May 5, 2022, 4:55:28 AM5/5/22
to Ebean ORM
This is mainly a *bump* for Rob to see if his E-Mail notifications are working properly.

To add some information for the mailing group - the issue has been created on GitHub now as Issue #2684
Column name replacement caused by @Column annotation produces invalid SQL for property named 'in' · Issue #2684 · ebean-orm/ebean (github.com)

Rob Bygrave

unread,
May 5, 2022, 6:32:28 AM5/5/22
to ebean@googlegroups
Nice :)  ... it works, I must have just deleted the email somehow.  I'll dig into by email bin tomorrow.

Thanks !!

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/6ad6b03f-2b1f-4451-a14d-fc69ea59f497n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages