3 Replies Latest reply on Jun 3, 2008 5:49 PM by infinity2heaven

    Setting Hibernate NamingStrategy

    Firat Alagöz Newbie

      Hi,


      I am trying to use an @Embedded Component multiple times in a class


      @Entity
      @Name("myentity")
      public class MyEntity extends AbstractEntity  {
           @AttributeOverride(name = "value", column = @Column(name = "component_value_1"))
           private Component c1;
      
           @Embedded
           @AttributeOverride(name = "value", column = @Column(name = "component_value_2"))
           private Component c2;
      
      [...]
      }



      but this always results in a

      org.hibernate.MappingException: Repeated column in mapping for entity MyEntity

      I've read that using a different Hibernate NamingStrategy like
      org.hibernate.cfg.DefaultComponentSafeNamingStrategy

      would fix this. I know I'm supposed to set this in persistence.xml but I can't seem to get it right...


      I tried


      <property name="hibernate.naming_strategy" 
      value="org.hibernate.cfg.DefaultComponentSafeNamingStrategy"/>



      and countless variations like namingStrategy, org.hibernate.ejb.HibernatePersistence.naming_strategy and many more, but I can't seem to make this work... How is this set correctly? Or is there another solution to using multiple same components in a class?


      Any help would be greatly appreciated!