[jbosstools-dev] Unpredictable NamingStrategy interpretation

Dmitry Geraskov dgeraskov at exadel.com
Wed May 12 10:54:58 EDT 2010


Hi, Emmanuel,

The problem is in interpretation of specified names with dots.

I created naming strategy where all method just join all passed 
parameters with "_".
For example
@Override
     public String collectionTableName(String ownerEntity,  String 
ownerEntityTable, String associatedEntity,
             String associatedEntityTable, String propertyName) {
         return ownerEntity + "_"+ associatedEntity+ "_" + 
associatedEntityTable + "_" + associatedEntity  +
         "_" +propertyName;
     }


And what I have found:

@Entity(name = "e.M11")
public class ManyToMany1 implements Serializable {

}

What do you think will be DB table name? The correct answer is "e.M11".
The same for @Entity @Table(name = "e.M11")

But when this entity is used in relationship mapping as target entity 
things become different:
for @Entity(name = "e.M11") 
entity.ManyToMany2_entity.ManyToMany1_*M11*_entity.ManyToMany1_mtm1
for @Table(name = "e.M11") 
entity.ManyToMany2_entity.ManyToMany1_*e.M11*_entity.ManyToMany1_mtm1

I didn't see any specification for how NamingStrategy should be used. 
And I even *fear* to compare this behaviour with core hibernate 
behaviour. I guess there will be some differences too.

Dmitry.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20100512/f860b97d/attachment-0001.html 


More information about the jbosstools-dev mailing list