org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid

Hibernate JIRA | Christian Bauer | 1 decade ago
  1. 0

    This might be another variation of filtered one-to-one, but I think this is supposed to work. In org.hibernate.test.bidi, add a subclass of Bid, let's call it SpecialBid. Mapping is the same, except for new subclass: <hibernate-mapping package="org.hibernate.test.bidi"> <class name="Auction" table="TAuction"> <id name="id"> <generator class="native"/> </id> <property name="description"/> <property name="end" column="endDatetime"/> <bag name="bids" inverse="true" cascade="persist"> <key column="auctionId"/> <one-to-many class="Bid"/> </bag> <one-to-one name="successfulBid" property-ref="abc"> <formula>id</formula> <formula>1</formula> </one-to-one> </class> <class name="Bid" table="TBid" abstract="true"> <id name="id"> <generator class="native"/> </id> <discriminator column="DISC"/> <property name="amount" scale="19" precision="38" /> <property name="datetime" column="createdDatetime"/> <properties name="abc"> <many-to-one name="item" column="auctionId" cascade="persist"/> <property name="successful" column="success"/> </properties> <subclass name="SpecialBid" discriminator-value="SPECIAL"> <property name="isSpecial" access="field"/> </subclass> </class> Saving Auction/SpecialBid instances now fails with: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79) at org.hibernate.tuple.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:89) at org.hibernate.type.ComponentType.instantiate(ComponentType.java:428) at org.hibernate.type.ComponentType.deepCopy(ComponentType.java:351) at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:323) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:255) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:590) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:568) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:572) at org.hibernate.test.bidi.AuctionTest.testLazy(AuctionTest.java:40) I need this to demonstrate "successful Bid" or "default selection" flag handling for CaveatEmptor USER->BILLING_DETAILS

    Hibernate JIRA | 1 decade ago | Christian Bauer
    org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid
  2. 0

    A simple <properties> group in a superclass mapping produces the following exception when trying to save a instance of a non-abstract subclass. To reproduce, simply add a <properties> grouping to any inheritance mapping: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79) at org.hibernate.tuple.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:89) at org.hibernate.type.ComponentType.instantiate(ComponentType.java:428) at org.hibernate.type.ComponentType.deepCopy(ComponentType.java:351) at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:323) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:255) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:590) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:568) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:572) at org.hibernate.test.bidi.AuctionTest.testLazy(AuctionTest.java:40)

    Hibernate JIRA | 1 decade ago | Christian Bauer
    org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid
  3. 0

    This might be another variation of filtered one-to-one, but I think this is supposed to work. In org.hibernate.test.bidi, add a subclass of Bid, let's call it SpecialBid. Mapping is the same, except for new subclass: <hibernate-mapping package="org.hibernate.test.bidi"> <class name="Auction" table="TAuction"> <id name="id"> <generator class="native"/> </id> <property name="description"/> <property name="end" column="endDatetime"/> <bag name="bids" inverse="true" cascade="persist"> <key column="auctionId"/> <one-to-many class="Bid"/> </bag> <one-to-one name="successfulBid" property-ref="abc"> <formula>id</formula> <formula>1</formula> </one-to-one> </class> <class name="Bid" table="TBid" abstract="true"> <id name="id"> <generator class="native"/> </id> <discriminator column="DISC"/> <property name="amount" scale="19" precision="38" /> <property name="datetime" column="createdDatetime"/> <properties name="abc"> <many-to-one name="item" column="auctionId" cascade="persist"/> <property name="successful" column="success"/> </properties> <subclass name="SpecialBid" discriminator-value="SPECIAL"> <property name="isSpecial" access="field"/> </subclass> </class> Saving Auction/SpecialBid instances now fails with: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79) at org.hibernate.tuple.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:89) at org.hibernate.type.ComponentType.instantiate(ComponentType.java:428) at org.hibernate.type.ComponentType.deepCopy(ComponentType.java:351) at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:323) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:255) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:590) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:568) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:572) at org.hibernate.test.bidi.AuctionTest.testLazy(AuctionTest.java:40) I need this to demonstrate "successful Bid" or "default selection" flag handling for CaveatEmptor USER->BILLING_DETAILS

    Hibernate JIRA | 1 decade ago | Christian Bauer
    org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    A simple <properties> group in a superclass mapping produces the following exception when trying to save a instance of a non-abstract subclass. To reproduce, simply add a <properties> grouping to any inheritance mapping: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79) at org.hibernate.tuple.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:89) at org.hibernate.type.ComponentType.instantiate(ComponentType.java:428) at org.hibernate.type.ComponentType.deepCopy(ComponentType.java:351) at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:323) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:255) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:590) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:568) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:572) at org.hibernate.test.bidi.AuctionTest.testLazy(AuctionTest.java:40)

    Hibernate JIRA | 1 decade ago | Christian Bauer
    org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid
  6. 0

    org.hibernate.InstantiationException: Cannot instantiate abstract class or interface

    Stack Overflow | 1 year ago | Nimchip
    org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: sijc.davt.compensation.model.concepts.Compensation

    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.InstantiationException

      Cannot instantiate abstract class or interface: org.hibernate.test.bidi.Bid

      at org.hibernate.tuple.PojoInstantiator.instantiate()
    2. Hibernate
      TypeFactory.deepCopy
      1. org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:79)
      2. org.hibernate.tuple.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:89)
      3. org.hibernate.type.ComponentType.instantiate(ComponentType.java:428)
      4. org.hibernate.type.ComponentType.deepCopy(ComponentType.java:351)
      5. org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:323)
      5 frames
    3. Hibernate
      SessionImpl.persist
      1. org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:255)
      2. org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
      3. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
      4. org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
      5. org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
      6. org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
      7. org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:590)
      8. org.hibernate.impl.SessionImpl.persist(SessionImpl.java:568)
      9. org.hibernate.impl.SessionImpl.persist(SessionImpl.java:572)
      9 frames
    4. org.hibernate.test
      AuctionTest.testLazy
      1. org.hibernate.test.bidi.AuctionTest.testLazy(AuctionTest.java:40)
      1 frame