net.sf.hibernate.MappingException: duplicate import: EmailRecord

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

    The SchemaExport tool works fantastic with the exception of compiling for properties that have the second letter in uppercase even though the first leter is lowercase. For example, I have an object that is used to store e-mail communications. The "to," "cc," and "bcc" addresses properties are written as tO, cC, and bCC so the getter and setters are "pretty" (getTO(), getCC(), getBCC()). I am able to fix the error by having the first two letters of the property as lowercase and the third letter as uppercase is acceptable. i.e. property bcC with getBcC() works fine. The error that is thrown read as: ERROR [main] (Configuration.java:233) - Could not compile the mapping document net.sf.hibernate.PropertyNotFoundException: Could not find a getter for bcC in class fdot.prm.directory.email.EmailRecord at net.sf.hibernate.util.ReflectHelper.getGetter(ReflectHelper.java:206) at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:260) at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:92) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:912) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:838) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746) at fdot.prm.directory.DDLExporter.main(DDLExporter.java:29) rethrown as net.sf.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for bcC in class fdot.prm.directory.email.EmailRecord at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:103) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:912) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:838) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746) at fdot.prm.directory.DDLExporter.main(DDLExporter.java:29) Caused by: net.sf.hibernate.PropertyNotFoundException: Could not find a getter for bcC in class fdot.prm.directory.email.EmailRecord at net.sf.hibernate.util.ReflectHelper.getGetter(ReflectHelper.java:206) at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:260) at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:92) ... 10 more ERROR [main] (Configuration.java:233) - Could not compile the mapping document net.sf.hibernate.MappingException: duplicate import: EmailRecord at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746) at fdot.prm.directory.DDLExporter.main(DDLExporter.java:29) Error initializing configuration: duplicate import: EmailRecord Thanks.

    Hibernate JIRA | 1 decade ago | Brian Duguid
    net.sf.hibernate.MappingException: duplicate import: EmailRecord
  2. 0

    The SchemaExport tool works fantastic with the exception of compiling for properties that have the second letter in uppercase even though the first leter is lowercase. For example, I have an object that is used to store e-mail communications. The "to," "cc," and "bcc" addresses properties are written as tO, cC, and bCC so the getter and setters are "pretty" (getTO(), getCC(), getBCC()). I am able to fix the error by having the first two letters of the property as lowercase and the third letter as uppercase is acceptable. i.e. property bcC with getBcC() works fine. The error that is thrown read as: ERROR [main] (Configuration.java:233) - Could not compile the mapping document net.sf.hibernate.PropertyNotFoundException: Could not find a getter for bcC in class fdot.prm.directory.email.EmailRecord at net.sf.hibernate.util.ReflectHelper.getGetter(ReflectHelper.java:206) at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:260) at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:92) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:912) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:838) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746) at fdot.prm.directory.DDLExporter.main(DDLExporter.java:29) rethrown as net.sf.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for bcC in class fdot.prm.directory.email.EmailRecord at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:103) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:912) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:838) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746) at fdot.prm.directory.DDLExporter.main(DDLExporter.java:29) Caused by: net.sf.hibernate.PropertyNotFoundException: Could not find a getter for bcC in class fdot.prm.directory.email.EmailRecord at net.sf.hibernate.util.ReflectHelper.getGetter(ReflectHelper.java:206) at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:260) at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:92) ... 10 more ERROR [main] (Configuration.java:233) - Could not compile the mapping document net.sf.hibernate.MappingException: duplicate import: EmailRecord at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746) at fdot.prm.directory.DDLExporter.main(DDLExporter.java:29) Error initializing configuration: duplicate import: EmailRecord Thanks.

    Hibernate JIRA | 1 decade ago | Brian Duguid
    net.sf.hibernate.MappingException: duplicate import: EmailRecord
  3. 0

    When trying to make two classes with the same name in different packages I get the stacktrace below. The classes are part of an auditing system and are called: com.wol.access.core.AuditEntry com.wol.core.AuditEntry I cannot thus map the classes to a database using hibernate. I would have thought that hibernate should use the fully qaulified class name for mapping ? I scanned the documentation, but could not find any references for a parameter to correct this. << Stack Trace >> net.sf.hibernate.MappingException: duplicate import: AuditEntry at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:59) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:96) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:153) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1000) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:211) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:233) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:254) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:807) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:758) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:698) at com.wol.util.PersistanceManager.init(PersistanceManager.java:35) at com.wol.util.PersistanceManager.getInstance(PersistanceManager.java:24) at com.wol.util.PersistanceManager.getPMSession(PersistanceManager.java:59) at __jspPage7_admin_modules_ar_billingconfig_searchresult_jsp._jspService(__jspPage7_admin_modules_ar_billingconfig_searchresult_jsp.java:155) at com.orionserver.http.OrionHttpJspPage.service(Unknown Source) at com.evermind._ah._rad(Unknown Source) at com.evermind.server.http.JSPServlet.service(Unknown Source) at com.evermind._cxb._abe(Unknown Source) at com.evermind._cxb._uec(Unknown Source) at com.evermind._io._twc(Unknown Source) at com.evermind._io._gc(Unknown Source) at com.evermind._if.run(Unknown Source)

    Hibernate JIRA | 1 decade ago | Manuel De Jesus
    net.sf.hibernate.MappingException: duplicate import: AuditEntry
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping schema="pkr"> <class name="edu.sdsc.pkr.orm.pkr.ProteinSequence" table="protein_sequences" > <id name="proteinSequenceId" column="protein_sequence_id" type="java.lang.Long" unsaved-value="null"> <generator class="assigned"/> </id> <property name="sequence" column="sequence" type="java.lang.TextType" not-null="true" unique="true" /> </class> </hibernate-mapping> ##The error is in the mapping in in line: -- name="sequence" column="sequence" type="java.lang.TextType" ##which should be ++name="sequence" column="sequence" type="net.sf.hibernate.type.TextType" But the error message "net.sf.hibernate.MappingException: duplicate import: ProteinSequence" is rather misleading. I believe a similar error was addressed in last release 2.1.1 <http://sourceforge.net/project/shownotes.php?group_id=40712&release_id=214960> <quote> * fixed a problem where mapping validation failure was reported as duplicate import (Michael Gloegl)"</quote> 11:53:35,323 INFO Environment:462 - Hibernate 2.1.2 11:53:35,390 INFO Environment:491 - hibernate.properties not found 11:53:35,412 INFO Environment:519 - using CGLIB reflection optimizer 11:53:35,428 INFO Configuration:854 - configuring from resource: /hibernate.cfg.xml 11:53:35,429 INFO Configuration:826 - Configuration resource: /hibernate.cfg.xml 11:53:38,080 INFO Configuration:311 - Mapping resource: edu/sdsc/pkr/orm/pkr/MasterSource.hbm.xml 11:53:38,318 INFO Binder:229 - Mapping class: edu.sdsc.pkr.orm.pkr.MasterSource -> master_source 11:53:38,407 INFO Configuration:311 - Mapping resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml 11:53:38,671 INFO Binder:229 - Mapping class: edu.sdsc.pkr.orm.pkr.ProteinSequence -> protein_sequences 11:53:38,688 ERROR Configuration:252 - Could not compile the mapping document net.sf.hibernate.MappingException: Could not interpret type: java.lang.TextType at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:910) at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:411) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1023) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:352) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:973) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842) at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8) at edu.sdsc.pkr.struts.ActionWithHbmSession.getSession(ActionWithHbmSession.java:33) at edu.sdsc.pkr.test.testPkrEntry.main(testPkrEntry.java:54) 11:53:38,807 INFO Configuration:311 - Mapping resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml 11:53:39,045 ERROR Configuration:252 - Could not compile the mapping document net.sf.hibernate.MappingException: duplicate import: ProteinSequence at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842) at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8) at edu.sdsc.pkr.struts.ActionWithHbmSession.getSession(ActionWithHbmSession.java:33) at edu.sdsc.pkr.test.testPkrEntry.main(testPkrEntry.java:54) Exception in thread "main" java.lang.ExceptionInInitializerError at edu.sdsc.pkr.struts.ActionWithHbmSession.getSession(ActionWithHbmSession.java:33) at edu.sdsc.pkr.test.testPkrEntry.main(testPkrEntry.java:54) Caused by: java.lang.RuntimeException: Exception building SessionFactory: Error reading resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:11) ... 2 more Caused by: net.sf.hibernate.MappingException: Error reading resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:318) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842) at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8) ... 2 more Caused by: net.sf.hibernate.MappingException: duplicate import: ProteinSequence at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315) ... 7 more

    Hibernate JIRA | 1 decade ago | R. Hannes Niedner
    java.lang.ExceptionInInitializerError
  6. 0

    When trying to make two classes with the same name in different packages I get the stacktrace below. The classes are part of an auditing system and are called: com.wol.access.core.AuditEntry com.wol.core.AuditEntry I cannot thus map the classes to a database using hibernate. I would have thought that hibernate should use the fully qaulified class name for mapping ? I scanned the documentation, but could not find any references for a parameter to correct this. << Stack Trace >> net.sf.hibernate.MappingException: duplicate import: AuditEntry at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:59) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:96) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:153) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1000) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:211) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:233) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:254) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:807) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:758) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:698) at com.wol.util.PersistanceManager.init(PersistanceManager.java:35) at com.wol.util.PersistanceManager.getInstance(PersistanceManager.java:24) at com.wol.util.PersistanceManager.getPMSession(PersistanceManager.java:59) at __jspPage7_admin_modules_ar_billingconfig_searchresult_jsp._jspService(__jspPage7_admin_modules_ar_billingconfig_searchresult_jsp.java:155) at com.orionserver.http.OrionHttpJspPage.service(Unknown Source) at com.evermind._ah._rad(Unknown Source) at com.evermind.server.http.JSPServlet.service(Unknown Source) at com.evermind._cxb._abe(Unknown Source) at com.evermind._cxb._uec(Unknown Source) at com.evermind._io._twc(Unknown Source) at com.evermind._io._gc(Unknown Source) at com.evermind._if.run(Unknown Source)

    Hibernate JIRA | 1 decade ago | Manuel De Jesus
    net.sf.hibernate.MappingException: duplicate import: AuditEntry

    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. net.sf.hibernate.MappingException

      duplicate import: EmailRecord

      at net.sf.hibernate.cfg.Mappings.addImport()
    2. net.sf.hibernate
      Configuration.configure
      1. net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
      2. net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108)
      3. net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
      4. net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
      5. net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
      6. net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
      7. net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
      8. net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
      9. net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
      10. net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746)
      10 frames
    3. fdot.prm.directory
      DDLExporter.main
      1. fdot.prm.directory.DDLExporter.main(DDLExporter.java:29)
      1 frame