Uploaded image for project: 'Hibernate ORM'
  1. HHH-8999

NullPointerException when updating or deleting multiple entities of same type with non-comparable IDs

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      If in composite-id is a field of type byte[] then removing more than one entity throws NullPointerException.

      it doesnt work on Hibernate 4.3.0.Final, It worked on Hibernate 4.2.8.Final.

      EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpaDemo");

      EntityManager em = emf.createEntityManager();
      EntityTransaction tx = em.getTransaction();
      tx.begin();
      Query query = em.createQuery("select s from MyEntity s");
      List l = query.getResultList();//returns 3 objects
      em.remove(l.get(0));
      em.remove(l.get(1));//throws exception

      java.lang.NullPointerException
      at org.hibernate.type.AbstractStandardBasicType.compare(AbstractStandardBasicType.java:221)
      at org.hibernate.type.ComponentType.compare(ComponentType.java:230)
      at org.hibernate.action.internal.EntityAction.compareTo(EntityAction.java:171)
      at org.hibernate.engine.spi.ExecutableList.add(ExecutableList.java:222)
      at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:219)
      at org.hibernate.event.internal.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:299)
      at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:160)
      at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:73)
      at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:916)
      at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:892)
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:1214)
      at hibernatetest.Main.test(Main.java:23)
      at hibernatetest.Main.main(Main.java:9)

        Attachments

        1. Main.java
          0.8 kB
        2. MyEntity.java
          1 kB
        3. MyEntityPK.java
          2 kB

          Issue links

            Activity

              People

              • Votes:
                10 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 16h
                  16h
                  Remaining:
                  Remaining Estimate - 16h
                  16h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified