java.lang.ExceptionInInitializerError

Hibernate JIRA | Gerald Klopp | 10 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'd like to specify the on-delete="cascade" attribute for a map or for a set with just one element. When I try to do this, I get the following exception : Initial SessionFactory creation failed.org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade" The on-delete="cascade" attribute can be specified for more complex relationships like one-to-many. But it seems that the case of a simple map or set is not covered. - Mapping document example: <hibernate-mapping> <class name="Document" table="DOCUMENT"> <id name="id" column="DOCUMENT_ID"> <generator class="native" /> </id> <map name="titles" table="DOCUMENT_TITLE" lazy="false"> <key column="DOCUMENT_ID" on-delete="cascade" /> <index column="LANGUAGE" type="string" /> <element column="TITLE" type="text" not-null="true" /> </map> <set name="references" table="DOCUMENT_REFERENCE" lazy="false"> <key column="DOCUMENT_ID" on-delete="cascade" /> <element type="string" column="REFERENCE" /> </set> </class> </hibernate-mapping> - Exception stack trace : Initial SessionFactory creation failed.org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": Document.references Exception in thread "main" java.lang.ExceptionInInitializerError at fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:17) at fr.gklopp.test.hibernate3.simple.DocumentManager.createAndStoreDocument(DocumentManager.java:23) at fr.gklopp.test.hibernate3.simple.DocumentManager.main(DocumentManager.java:68) Caused by: org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": fr.gklopp.test.hibernate3.simple.Document.references at org.hibernate.mapping.Collection.validate(Collection.java:267) at org.hibernate.mapping.Set.validate(Set.java:19) at org.hibernate.cfg.Configuration.validate(Configuration.java:1106) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287) at fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:13) ... 2 more - Database : Oracle 10

    Hibernate JIRA | 10 years ago | Gerald Klopp
    java.lang.ExceptionInInitializerError
  2. 0

    I'd like to specify the on-delete="cascade" attribute for a map or for a set with just one element. When I try to do this, I get the following exception : Initial SessionFactory creation failed.org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade" The on-delete="cascade" attribute can be specified for more complex relationships like one-to-many. But it seems that the case of a simple map or set is not covered. - Mapping document example: <hibernate-mapping> <class name="Document" table="DOCUMENT"> <id name="id" column="DOCUMENT_ID"> <generator class="native" /> </id> <map name="titles" table="DOCUMENT_TITLE" lazy="false"> <key column="DOCUMENT_ID" on-delete="cascade" /> <index column="LANGUAGE" type="string" /> <element column="TITLE" type="text" not-null="true" /> </map> <set name="references" table="DOCUMENT_REFERENCE" lazy="false"> <key column="DOCUMENT_ID" on-delete="cascade" /> <element type="string" column="REFERENCE" /> </set> </class> </hibernate-mapping> - Exception stack trace : Initial SessionFactory creation failed.org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": Document.references Exception in thread "main" java.lang.ExceptionInInitializerError at fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:17) at fr.gklopp.test.hibernate3.simple.DocumentManager.createAndStoreDocument(DocumentManager.java:23) at fr.gklopp.test.hibernate3.simple.DocumentManager.main(DocumentManager.java:68) Caused by: org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": fr.gklopp.test.hibernate3.simple.Document.references at org.hibernate.mapping.Collection.validate(Collection.java:267) at org.hibernate.mapping.Set.validate(Set.java:19) at org.hibernate.cfg.Configuration.validate(Configuration.java:1106) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287) at fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:13) ... 2 more - Database : Oracle 10

    Hibernate JIRA | 10 years ago | Gerald Klopp
    java.lang.ExceptionInInitializerError
  3. 0

    Unable to instantiate custom type error in Hibernate mapping Enum mapping

    Stack Overflow | 4 years ago | Johnny
    org.hibernate.MappingException: Unable to instantiate custom type: org.hibernate.type.EnumType
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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
  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 6 months ago
  2. esaar 1 times, last 8 months ago
  3. r1chjames 1 times, last 9 months ago
  4. Kawada 6 times, last 10 months ago
  5. Harsh 1 times, last 12 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

    only inverse one-to-many associations may use on-delete="cascade": fr.gklopp.test.hibernate3.simple.Document.references

    at org.hibernate.mapping.Collection.validate()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.mapping.Collection.validate(Collection.java:267)
    2. org.hibernate.mapping.Set.validate(Set.java:19)
    3. org.hibernate.cfg.Configuration.validate(Configuration.java:1106)
    4. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
    4 frames
  3. fr.gklopp.test
    DocumentManager.main
    1. fr.gklopp.test.hibernate3.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
    2. fr.gklopp.test.hibernate3.simple.DocumentManager.createAndStoreDocument(DocumentManager.java:23)
    3. fr.gklopp.test.hibernate3.simple.DocumentManager.main(DocumentManager.java:68)
    3 frames