java.lang.UnsupportedOperationException

Hibernate JIRA | Adrien | 8 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

    When using a StatelessSession and saving a ManyToOne, we have an UnsupportedOperationException because of a call to getTimestamp() on the StatelessSession. May be the AbstractEntityPersister.isTransient() should always return null when dealing with a StatelessSession, since everything is transient in this case. StatelessSession s = getSessions().openStatelessSession(); s.beginTransaction(); Person p = new Person( new Long(1), "steve", 123 ); s.insert(p); Order o = new Order( new Long(1), p ); s.insert(o); // --> UnsupportedOperationException java.lang.UnsupportedOperationException at org.hibernate.impl.StatelessSessionImpl.getTimestamp(StatelessSessionImpl.java:435) at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3422) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204) at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430) at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:102) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2045) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2291) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2708) at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:117) at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:99) at org.hibernate.test.timestampStateless.TimeStampProbTest.testTimeStampTest(TimeStampProbTest.java:28) You may see the joined test case. I found a old post on the forum with the same problem : http://forum.hibernate.org/viewtopic.php?p=2304937&sid=03c689ec5b12eebd8b26efa350241e80 I hope this will help.

    Hibernate JIRA | 8 years ago | Adrien
    java.lang.UnsupportedOperationException
  2. 0

    When using a StatelessSession and saving a ManyToOne, we have an UnsupportedOperationException because of a call to getTimestamp() on the StatelessSession. May be the AbstractEntityPersister.isTransient() should always return null when dealing with a StatelessSession, since everything is transient in this case. StatelessSession s = getSessions().openStatelessSession(); s.beginTransaction(); Person p = new Person( new Long(1), "steve", 123 ); s.insert(p); Order o = new Order( new Long(1), p ); s.insert(o); // --> UnsupportedOperationException java.lang.UnsupportedOperationException at org.hibernate.impl.StatelessSessionImpl.getTimestamp(StatelessSessionImpl.java:435) at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3422) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204) at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430) at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:102) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2045) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2291) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2708) at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:117) at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:99) at org.hibernate.test.timestampStateless.TimeStampProbTest.testTimeStampTest(TimeStampProbTest.java:28) You may see the joined test case. I found a old post on the forum with the same problem : http://forum.hibernate.org/viewtopic.php?p=2304937&sid=03c689ec5b12eebd8b26efa350241e80 I hope this will help.

    Hibernate JIRA | 8 years ago | Adrien
    java.lang.UnsupportedOperationException

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      No message provided

      at org.hibernate.impl.StatelessSessionImpl.getTimestamp()
    2. Hibernate
      StatelessSessionImpl.getTimestamp
      1. org.hibernate.impl.StatelessSessionImpl.getTimestamp(StatelessSessionImpl.java:435)
      1 frame
    3. Hibernate
      AbstractEntityPersister.insert
      1. org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3422)
      2. org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
      3. org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241)
      4. org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
      5. org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:102)
      6. org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2045)
      7. org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2291)
      8. org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2708)
      8 frames
    4. Hibernate
      StatelessSessionImpl.insert
      1. org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:117)
      2. org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:99)
      2 frames
    5. org.hibernate.test
      TimeStampProbTest.testTimeStampTest
      1. org.hibernate.test.timestampStateless.TimeStampProbTest.testTimeStampTest(TimeStampProbTest.java:28)
      1 frame