[hibernate-dev] Naming and "naming strategies"

Emmanuel Bernard emmanuel at hibernate.org
Fri Jan 16 13:09:34 EST 2015


> On 16 Jan 2015, at 18:37, Steve Ebersole <steve at hibernate.org> wrote:
> 
> On Fri, Jan 16, 2015 at 8:10 AM, Steve Ebersole <steve at hibernate.org <mailto:steve at hibernate.org>> wrote:
> 
> I have one question, regarding logical name. The name that a given user needs to use inside say @Column( …, table=“SomeEntity1”) is the name that comes out of the implicit naming contract (assuming the original table was implicit). Is that correct?
> 
> This is true.  But remember that this is mainly intended to signify a secondary table, whose name cannot be implicit.  Also, I think that mixing implicit naming and explicit naming and expecting that to work is not necessarily a valid expectation.
> 
> I just wanted to clarify here a bit.  As far as I know, the only time that this could be a problem is when we need @Column to refer to the primary table and the name of the primary table is implicit.  But JPA designs for that by saying that @Column is expected to refer to the primary table when @Column#table is null or not specified.  What I was saying above was this, imo, it is not a reasonable for this to work:
> 
> @Entity
> public Customer {
>     @Column( ..., table="Customer" )
>     ...
> }
> 
> I just think that makes no sense.
> 
> Am I missing any potential uses where @Column#table would refer to something that might reasonably be implicit?
> 

No but it might be more problematic for `@JoinColumn(name=“customer_fk, referencedColumnName=“id”)` where the referenced entity has `@Id String id`. That family of references might be more common than secondary tables.


More information about the hibernate-dev mailing list