Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat does "org.hibernate.DuplicateMappingException" error mean?
    text
    copied!<p>I'm trying to force JPA/Hibernate to generate and use only lowercase tablenames. I've implemented a NamingStrategy like this:</p> <pre><code>public class MyNamingStrategy extends DefaultNamingStrategy { @Override public String classToTableName(String className) { return super.classToTableName(className).toLowerCase(); } } </code></pre> <p>I have applied it by setting this property in persistence.xml:</p> <pre><code>&lt;property name="hibernate.ejb.naming_strategy" value="entities.strategy.MyNamingStrategy"/&gt; </code></pre> <p>When I do this I get this stacktrace:</p> <pre><code>SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method org.hibernate.DuplicateMappingException: Same physical table name [planning] references several logical table names: [Planning], [OrderProductMan_Planning] at org.hibernate.cfg.Configuration$MappingsImpl.addTableBinding(Configuration.java:2629) at org.hibernate.cfg.annotations.TableBinder.buildAndFillTable(TableBinder.java:254) at org.hibernate.cfg.annotations.TableBinder.bind(TableBinder.java:177) </code></pre> <p>What does the </p> <blockquote> <p>Same physical table name [planning] references several logical table names: [Planning], [OrderProductMan_Planning] </p> </blockquote> <p>mean?</p> <p>Entities from the error, simplified as much as I could. Let me know if you need the rest.</p> <pre><code>@Entity public class Planning implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private Integer qty; @ManyToOne private OrderProductMan orderProduct; .... } @Entity @Table public class OrderProductMan implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) private Integer opId; @Basic(optional = false) private int qty; @ManyToOne(optional = false) private ProductMan produse; @ManyToOne(optional = false) private OrderMan orders; @Transient private int totalScheduled; @Transient private int totalProduced; // ... } </code></pre>
 

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