[hibernate-issues] [JIRA] (HHH-13903) Automatically quote if keywords are used as identifiers

Juri Berlanda (JIRA) jira at hibernate.atlassian.net
Tue Mar 24 12:09:08 EDT 2020


Juri Berlanda ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A703b026f-0251-4729-828b-9ed45f283202 ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMGYwMTU5YTkzZDI1NDAxMmIxOGZjM2Q3NDBiZGVhNWEiLCJwIjoiaiJ9 ) / New Feature ( https://hibernate.atlassian.net/browse/HHH-13903?atlOrigin=eyJpIjoiMGYwMTU5YTkzZDI1NDAxMmIxOGZjM2Q3NDBiZGVhNWEiLCJwIjoiaiJ9 ) HHH-13903 ( https://hibernate.atlassian.net/browse/HHH-13903?atlOrigin=eyJpIjoiMGYwMTU5YTkzZDI1NDAxMmIxOGZjM2Q3NDBiZGVhNWEiLCJwIjoiaiJ9 ) Automatically quote if keywords are used as identifiers ( https://hibernate.atlassian.net/browse/HHH-13903?atlOrigin=eyJpIjoiMGYwMTU5YTkzZDI1NDAxMmIxOGZjM2Q3NDBiZGVhNWEiLCJwIjoiaiJ9 )

Issue Type: New Feature Affects Versions: 5.4.12 Assignee: Unassigned Created: 24/Mar/2020 09:09 AM Priority: Major Reporter: Juri Berlanda ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A703b026f-0251-4729-828b-9ed45f283202 )

Currently, at least using Oracle 12c Dialect, table names are not automatically quoted (or escaped/modified in any other way for that matter) if keywords are used as name for the respective @Entity class.

Manually quoting using @Table(name ="...") is a bit cumbersome, especially if the relevant keyword is not a keyword in all supported databases (e.g. level is keyword in Oracle, but not in PostgreSQL), since then the identifier has to be quoted on every query on every database system, regardless whether it is a keyword in that particular database system or not (see the "level" example from before).

Therefore I would propose to introduce some automatic escaping/modifying of identifiers if they happen to be a keyword on the particular database system.

OpenJPA for example, appends a 0 (as in Zero) in this case, still sticking to the level example this would lead to a unquoted Level0 on Oracle, while on PostgreSQL it would be Level.

( https://hibernate.atlassian.net/browse/HHH-13903#add-comment?atlOrigin=eyJpIjoiMGYwMTU5YTkzZDI1NDAxMmIxOGZjM2Q3NDBiZGVhNWEiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13903#add-comment?atlOrigin=eyJpIjoiMGYwMTU5YTkzZDI1NDAxMmIxOGZjM2Q3NDBiZGVhNWEiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100122- sha1:092c6a7 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200324/5d9a6c33/attachment.html 


More information about the hibernate-issues mailing list