1 Reply Latest reply on Oct 27, 2009 1:00 AM by llowrey

    Help Setting Hibernate NamingStrategy

    llowrey
      I need help setting hibernate.ejb.naming_strategy to DefaultComponentSafeNamingStrategy.

      From what I've read, this goes in META-INF/persistance.xml, but I don't have one. I am using a Seam managed hibernate session.

      I tried putting the following in my hibernate.cfg.xml but it didn't seem to make a difference.

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

      I'm running tomcat 5.5/6, Seam 2.2.0 GA, and Hibernate 3.3.2 GA.

      My goal is to be able to use multiple instances of an @Embeddable in an @Entity. Right now, the column names are colliding so I have to specify them explicitly. My understating is that DefaultComponentSafeNamingStrategy would make that unnecessary.

      Tips / suggestions?
        • 1. Re: Help Setting Hibernate NamingStrategy
          llowrey
          Found the answer myself... the extremely hard way!

          In components.xml

               <persistence:hibernate-session-factory
                    name="hibernateSessionFactory">
                    <persistence:naming-strategy>
                         #{namingStrategy}
                    </persistence:naming-strategy>
               </persistence:hibernate-session-factory>

               <component name="namingStrategy" class="org.hibernate.cfg.DefaultComponentSafeNamingStrategy"/>

          It sure would be nice to add this to the documentation!