On Thu, Jul 7, 2016 at 3:58 AM andrea boriero <and...@hibernate.org> wrote:
> On 6 July 2016 at 21:01, Steve Ebersole <st...@hibernate.org> wrote: > >> >> One option is that they need to match exactly (maybe with some simple >> handling of quoted versus case-insensitive, similar to Identifier#equals >> leveraging Identifier#getCanonicalName), e.g.: >> >> @Entity >> @Table( name="`USER`" ) >> @org.hibernate.annotations.Table( appliesTo="`USER`", ... ) >> class User { >> ... >> } >> >> I guess the first question here is whether we want to support referring to >> implicit table names in other annotations at all. JPA for the most part >> discourages this; in order for a table name to be referenced in other >> annotations it should be named explicitly. >> >> In my opinion make sense not supporting implicit naming strategy. > I was not so much asking about leveraging the ImplicitNamingStrategy. More I was asking conceptually whether we want to allow this at all. What about comparing the names after having previously removed, if > presents, the quoting chars? > Personally, I think using straight String comparisons is the main problem. If you look at the code for Identifier#equals that is really exactly what we need already. We cannot just drop the quotes for an accurate comparison. "`MY_TABLE`" and "`my_table`" are different tables to each sane and SQL spec compliant database. But conversely "MY_TABLE" and "my_table" are the same table. Overall though I think it is reasonable to just expect to match an explicit name. Especially if we allow org.hibernate.annotations.Table#appliesTo to be empty like javax.persistence.Column#table, etc as a means to refer to the root table. _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev