| Summary: | The MySQL Module should use quotes around colum names or reject some special names | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Christoph Laeubrich <laeubi> |
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> |
| Status: | CLOSED MOVED | QA Contact: | |
| Severity: | blocker | ||
| Priority: | P5 | CC: | tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Christoph Laeubrich
Changing to enhancement. Our philosophy regarding this paricular issue has been to have persistence-unit designers deal with this issue themselves either by choosing different column names or by using the delimiting support provided in JPA. Hi Tom, this is IMO still an (annoying) issue. Especially if one wants to write portable application that runs on different database systems it is very disturbing the the "persistence-unit designer" must think about how to name the fields of the class. I can understand that if someone forces the name (e.g. by @Column) to a particular value there is no way to change it, but for the autogenerated names I think the Persitence Provider should choose compatible names. The most common ones on my daily work are for example: - Have class that imposes some kind of ordering and thus has an integer field named "order", mysql complains always about that names and spits out confusing error messages that order is a keyword and must be quoted. - Mappings of key/value, so the Class "Entry" has a key field and a value field -> same issue since key is a keyword and is not quoted - Having a class referencing some child items via a values field -> again collides with VALUES keyword The most annoying thing is that this even can influence the table generation, so EclipseLink generates invalid ddl statements and silently ignores the error (well as least it logs some kind of warning) and you only get a problem if you try to access the PU item later on, with an "TABEL DOES NOT EXITS" error... Of course I can always rename the field or put an @Colum annotation o it, but that is really distrubing because JPA was meant to make autoconfiguration possible, so it would be a really good idea to add support so that either: - a PU is rejected with a meaningful error message - or even better: either quote the column name or simply add an underscore to the autogenerated name 1 year later and still an issue, hit the same problem with mssql (works fine for h2 database where we want to choose between):
> Incorrect syntax near the keyword 'database'.
This is really a mess, JPA should abstract things from the raw database details, its completely annoying having to tweak member names so these gets not confused and counteract the idea of an abstraction.
Is it really such a big deal to add quotes around either all names or at least around names that match database keywords?
*** Bug 536651 has been marked as a duplicate of this bug. *** The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |