[jbosstools-dev] Diffenerent interpretation of NamingStrategy methods.

Dmitry Geraskov dgeraskov at exadel.com
Mon Aug 10 07:35:26 EDT 2009


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?

-- 
Best regards,

 Dmitry Geraskov              
 dgeraskov at exadel.com
 Senior Developer
 Exadel Inc



More information about the jbosstools-dev mailing list