[jbosstools-dev] Diffenerent interpretation of NamingStrategy methods.

Max Rydahl Andersen max.andersen at redhat.com
Mon Aug 10 08:14:39 EDT 2009


Hi,

I know there are some subtle differences in JPA and hibernate core but 
not calling logicalColumnName sounds like a bug to me.

Emmanuel, could you help out here ?

Does Hibernate Entitiy Manager use the namingstrategy different than 
Hibernate core ?

FYI, the usecase is that we are implementing support for naming strategy 
in Eclipse Dali (JPA tooling) so that
users doesn't get wrong warnings/errors when they used a different 
naming strategy. Iniitally we just implemented
it as hibernate core uses naming strategy but then bumped into Hibernate 
EntityManager yielding different results.

/max

Dmitry Geraskov wrote:
> Hi, guys,
>
> I tried to generate ddl from console configuration using my
> NamingStrategy and found at least 2 differences between them.
>
> My NamingStrategy has 3 significant(for this issue) methods:
>
> public class TestNamingStrategy extends DefaultNamingStrategy{
>      public String propertyToColumnName(String propertyName) { return
> "PTCN_"+propertyName;}
>      public String columnName(String columnName) {return "CN_"+columnName; }
>      public String logicalColumnName(String columnName, String
> propertyName) { return "LCN_"+super.logicalColumnName(columnName,
> propertyName);}
> }
> -----------------------------------------------------------------------
> Mapped class is pretty simple:
>
> @Entity
> public class Customers implements java.io.Serializable {
>      @Id   @Column(name="id")    private int id;
>      @Column(name = "specified_column")    private String specified_column;
>      ...
> }
> -----------------------------------------------------------------------
> Class mapped as:
> <class name="r.Customers">
>          <id name="id" type="int"/>
>          <property name="specified_column" column="specified_column" />
> </class>...
> ===========================================
> Generated ddl for jpa console configuration is
>      create table Customers (
>          CN_id int4 not null,
>          CN_specified_column varchar(255),
>          primary key (CN_id)
>      );
> -------
> for core:
>      create table Customers (
>          PTCN_id int4 not null,
>          CN_LCN_specified_column varchar(255),
>          primary key (PTCN_id)
>      );
>
> Are this differences expected?
>
>    


More information about the jbosstools-dev mailing list