[hibernate-dev] Naming strategies and join tables

2016-02-22 Thread Guillaume Smet
Hi,

I'm migrating another application to 5.x and have the following issue with
the new naming strategies.

We used EJB3NamingStrategy and are now using
ImplicitNamingStrategy*Legacy*JpaImpl which is advertised as being its
replacement.

The model is the following:
@Entity
AbstractProjet
   > @Entity
  @DiscriminatorValue(value = "ProjetDiffusion")
   public class ProjetDiffusion extends AbstractProjet {
 @ElementCollection
 @Enumerated(EnumType.STRING)
 @JoinTable(uniqueConstraints = {
@UniqueConstraint(columnNames = { "projetdiffusion_id", "technologies" }) })
 private List technologies =
Lists.newArrayList();

Before the upgrade to 5, the join table was called
projetdiffusion_technologies and the column was projetdiffusion_id.

After the upgrade to 5, the join table is called
abstractprojet_technologies and the column abstractprojet_id. Thus, we have
an error on the creation of the unique constraint.

Is this change expected?

-- 
Guillaume
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] Naming strategies and join tables

2016-02-22 Thread Guillaume Smet
Important point: AbstractProjet uses SINGLE_TABLE inheritance.

On Mon, Feb 22, 2016 at 12:10 PM, Guillaume Smet 
wrote:

> Hi,
>
> I'm migrating another application to 5.x and have the following issue with
> the new naming strategies.
>
> We used EJB3NamingStrategy and are now using
> ImplicitNamingStrategy*Legacy*JpaImpl which is advertised as being its
> replacement.
>
> The model is the following:
> @Entity
> AbstractProjet
>> @Entity
>   @DiscriminatorValue(value = "ProjetDiffusion")
>public class ProjetDiffusion extends AbstractProjet {
>  @ElementCollection
>  @Enumerated(EnumType.STRING)
>  @JoinTable(uniqueConstraints = {
> @UniqueConstraint(columnNames = { "projetdiffusion_id", "technologies" }) })
>  private List technologies =
> Lists.newArrayList();
>
> Before the upgrade to 5, the join table was called
> projetdiffusion_technologies and the column was projetdiffusion_id.
>
> After the upgrade to 5, the join table is called
> abstractprojet_technologies and the column abstractprojet_id. Thus, we have
> an error on the creation of the unique constraint.
>
> Is this change expected?
>
> --
> Guillaume
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] Naming strategies and join tables

2016-02-22 Thread Steve Ebersole
It is also important to understand that lots of Hibernate code calling into
NamingStrategy did so in quite inconsistent ways.  We decided that
consistency of the calling was more important moving forward.  So while
ImplicitNamingStrategyLegacyJpaImpl strives to be compatible with the
older EJB3NamingStrategy,
we won't do that at the compromise of consistency in the calls.

Step into ImplicitNamingStrategyLegacyJpaImpl#determineJoinTableName and
find out:
1) where this particular call is coming from
2) what information is passed in




On Mon, Feb 22, 2016 at 6:34 AM Guillaume Smet 
wrote:

> Important point: AbstractProjet uses SINGLE_TABLE inheritance.
>
> On Mon, Feb 22, 2016 at 12:10 PM, Guillaume Smet  >
> wrote:
>
> > Hi,
> >
> > I'm migrating another application to 5.x and have the following issue
> with
> > the new naming strategies.
> >
> > We used EJB3NamingStrategy and are now using
> > ImplicitNamingStrategy*Legacy*JpaImpl which is advertised as being its
> > replacement.
> >
> > The model is the following:
> > @Entity
> > AbstractProjet
> >> @Entity
> >   @DiscriminatorValue(value = "ProjetDiffusion")
> >public class ProjetDiffusion extends AbstractProjet {
> >  @ElementCollection
> >  @Enumerated(EnumType.STRING)
> >  @JoinTable(uniqueConstraints = {
> > @UniqueConstraint(columnNames = { "projetdiffusion_id", "technologies"
> }) })
> >  private List technologies =
> > Lists.newArrayList();
> >
> > Before the upgrade to 5, the join table was called
> > projetdiffusion_technologies and the column was projetdiffusion_id.
> >
> > After the upgrade to 5, the join table is called
> > abstractprojet_technologies and the column abstractprojet_id. Thus, we
> have
> > an error on the creation of the unique constraint.
> >
> > Is this change expected?
> >
> > --
> > Guillaume
> >
> ___
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev