Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Bogdan, thanks for posting this. I had a similar problem with case-sensitive table names for Unix/Windows portability using Hibernate/JPA/MySQL on Linux.</p> <p>Like you, I set out to bind my table names as all lower-case by configuring a custom NamingStrategy in my META-INF/persistence.xml file:</p> <pre><code>&lt;property name="hibernate.ejb.naming_strategy" value="my.package.LowerCaseNamingStrategy" /&gt; </code></pre> <p>I got the same exception: org.hibernate.DuplicateMappingException: Same physical table name... Through using the debugger, I had an epiphany that maybe <strong>I wasn't using DefaultNamingStrategy to begin with! So I changed my base class to org.hibernate.cfg.EJB3NamingStrategy</strong>. This is more appropriate when using JPA Annotations, I believe! Here was my final NamingStrategy:</p> <pre><code>package my.package; import org.apache.commons.lang.StringUtils; import org.hibernate.cfg.EJB3NamingStrategy; public class LowerCaseNamingStrategy extends EJB3NamingStrategy { @Override public String classToTableName(String className) { return StringUtils.lowerCase(super.classToTableName(className)); } @Override public String collectionTableName(String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, String propertyName) { return StringUtils.lowerCase(super.collectionTableName(ownerEntity, ownerEntityTable, associatedEntity, associatedEntityTable, propertyName)); } @Override public String logicalCollectionTableName(String tableName, String ownerEntityTable, String associatedEntityTable, String propertyName) { return StringUtils.lowerCase(super.logicalCollectionTableName(tableName, ownerEntityTable, associatedEntityTable, propertyName)); } @Override public String tableName(String tableName) { return StringUtils.lowerCase(super.tableName(tableName)); } } </code></pre> <p>PS the previous solution by dursun did not work for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload