12 Replies Latest reply on Feb 13, 2009 3:16 PM by Amin Mohammed-Coleman

    java.lang.StringIndexOutOfBoundsException when using Inherit

    Amin Mohammed-Coleman Newbie


      I never had this problem before but I am getting the following exception when i flush (hibernate session):

      java.lang.StringIndexOutOfBoundsException: String index out of range: -3
       at java.lang.String.substring(String.java:1938)
       at java.lang.String.substring(String.java:1905)
       at org.jboss.envers.synchronization.work.PersistentCollectionChangeWorkUnit.<init>(PersistentCollectionChangeWorkUnit.java:48)
       at org.jboss.envers.event.VersionsEventListener.onCollectionAction(VersionsEventListener.java:167)
       at org.jboss.envers.event.VersionsEventListener.onPostRecreateCollection(VersionsEventListener.java:196)
       at org.hibernate.action.CollectionRecreateAction.postRecreate(CollectionRecreateAction.java:93)

      This occurs when I mark a super class Contact with @Versioned. Contact has a set of addresses, phones and notes. PersonalContact extends Contact. When inspecting the code I find that the name of the colleciton is

      com.amin.app.domain.search.domain.Contact.notes, this is causing the substring exception. If change it to com.amin.app.domain.search.domain.PersonalContact.notes (via debug in eclipse) it works.

      I am currently using the following:

      hibernate core 3.3.1.GA
      jboss envers 1.1.0.GA-hibernate-3.3
      hibernate annotations 3.4.0.GA

      I am also using a patched verision of VersionsEventListener from previous problem with Inheritence and collections.

      I'm not sure why this is happening as I have done this before in previous code example.

      Any help would be appreciated.