org.hibernate.MappingException: Unable to find column with logical name: email_address.email_address

Hibernate JIRA | Brian Lenz | 1 decade ago
  1. 0

    If you use the ImprovedNamingStrategy in conjunction with Hibernate annotations, and one of your properties has an index defined via @Index, you will get the following error: Exception in thread "main" org.hibernate.MappingException: Unable to find column with logical name: email_address.email_address at org.hibernate.cfg.Mappings.getPhysicalColumnName(Mappings.java:493) at org.hibernate.cfg.IndexSecondPass.addIndexToColumn(IndexSecondPass.java:49) at org.hibernate.cfg.IndexSecondPass.doSecondPass(IndexSecondPass.java:44) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1016) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:244) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1172) Here's the basic example: public class EmailAddress { private int id; private String emailAddress; @Id public int getId() { return id; } public void setId(int id) { this.id = id; } @NotNull @Length(min=6, max=80) @Index(name="email_address_email_address_idx") public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } public static void main(String[] args) { AnnotationConfiguration cfg = new AnnotationConfiguration(); cfg.configure("hibernate.cfg.xml"); //cfg.setNamingStrategy(new TestNamingStrategy()); cfg.setNamingStrategy(ImprovedNamingStrategy.INSTANCE); //cfg.setNamingStrategy(DefaultNamingStrategy.INSTANCE); cfg.addAnnotatedClass(EmailAddress.class); SessionFactory sf = cfg.buildSessionFactory(); } } Here is the config XML: <hibernate-configuration> <session-factory> <property name="hibernate.generate_statistics">true</property> <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> <property name="cglib.use_reflection_optimizer">true</property> <property name="jdbc.batch_size">10</property> <property name="use_outer_join">true</property> <property name="default_batch_fetch_size">8</property> <property name="max_fetch_depth">2</property> <property name="query.substitutions">true 1, false 0</property> </session-factory> </hibernate-configuration>

    Hibernate JIRA | 1 decade ago | Brian Lenz
    org.hibernate.MappingException: Unable to find column with logical name: email_address.email_address
  2. 0

    If you use the ImprovedNamingStrategy in conjunction with Hibernate annotations, and one of your properties has an index defined via @Index, you will get the following error: Exception in thread "main" org.hibernate.MappingException: Unable to find column with logical name: email_address.email_address at org.hibernate.cfg.Mappings.getPhysicalColumnName(Mappings.java:493) at org.hibernate.cfg.IndexSecondPass.addIndexToColumn(IndexSecondPass.java:49) at org.hibernate.cfg.IndexSecondPass.doSecondPass(IndexSecondPass.java:44) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1016) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:244) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1172) Here's the basic example: public class EmailAddress { private int id; private String emailAddress; @Id public int getId() { return id; } public void setId(int id) { this.id = id; } @NotNull @Length(min=6, max=80) @Index(name="email_address_email_address_idx") public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } public static void main(String[] args) { AnnotationConfiguration cfg = new AnnotationConfiguration(); cfg.configure("hibernate.cfg.xml"); //cfg.setNamingStrategy(new TestNamingStrategy()); cfg.setNamingStrategy(ImprovedNamingStrategy.INSTANCE); //cfg.setNamingStrategy(DefaultNamingStrategy.INSTANCE); cfg.addAnnotatedClass(EmailAddress.class); SessionFactory sf = cfg.buildSessionFactory(); } } Here is the config XML: <hibernate-configuration> <session-factory> <property name="hibernate.generate_statistics">true</property> <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> <property name="cglib.use_reflection_optimizer">true</property> <property name="jdbc.batch_size">10</property> <property name="use_outer_join">true</property> <property name="default_batch_fetch_size">8</property> <property name="max_fetch_depth">2</property> <property name="query.substitutions">true 1, false 0</property> </session-factory> </hibernate-configuration>

    Hibernate JIRA | 1 decade ago | Brian Lenz
    org.hibernate.MappingException: Unable to find column with logical name: email_address.email_address
  3. 0

    Hibernate mapping. Table related with other two

    Stack Overflow | 1 year ago | Rob
    org.hibernate.MappingException: An association from the table A refers to an unmapped class: Shortcut
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/.../DataConfiguration.class]:

    Stack Overflow | 2 years ago | AixNPanes
    javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
  6. 0

    how to insert values in database using Hibernate in dynamic web project

    Stack Overflow | 2 years ago | Vishnu Ranganathan
    org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(email)]

  1. kuldeep 16 times, last 3 months ago
  2. esaar 1 times, last 4 months ago
  3. r1chjames 1 times, last 6 months ago
  4. Kawada 6 times, last 6 months ago
  5. Harsh 1 times, last 8 months ago
34 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.hibernate.MappingException

    Unable to find column with logical name: email_address.email_address

    at org.hibernate.cfg.Mappings.getPhysicalColumnName()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.cfg.Mappings.getPhysicalColumnName(Mappings.java:493)
    2. org.hibernate.cfg.IndexSecondPass.addIndexToColumn(IndexSecondPass.java:49)
    3. org.hibernate.cfg.IndexSecondPass.doSecondPass(IndexSecondPass.java:44)
    4. org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1016)
    5. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:244)
    6. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1172)
    6 frames