1 Reply Latest reply on Mar 8, 2007 6:38 AM by axelgrrr

    problem generics and pretty printer

    axelgrrr

      i'm using JPA/EJB3/jboss (4.0.5.GA) in my diploma-project.
      I run into a problem concerning using generics in my @Entity classes.
      The entity class does have a generic payload extending java.io.Serializable which in truth is just used with a string. I try to map it with @org.hibernate.annotations.Type( type="serializable") or type="string".
      in a stripped down version of the project it simply works, but in the real one it doesnt.

      so after debugging:
      what happens is that the payload value is passed through to ComponentType.toLoggableString; the value is a string.
      tuplizerMapping.guessEntityMode guesses a null entityMode and ComponentType throws a ClassCastexception.

      i'm sorry i couldnt isolate the issue. it works in the stripped down project. dont see any difference in deployment or the affected source code though.
      hope you can help. have to switch to DAO's and JDBC if i cant figure this out.
      i'm *scared* :-o
      hope you can help

        • 1. Re: problem generics and pretty printer
          axelgrrr

          ok also tried now with the 4.2.0.CR1 AS.
          same situation as far as i can see; the pretty printer is throwing a
          exception causing a rollback.
          this certainly is a bug; should I file it to JIRA?

          with a non-generic version of the class (using a String field instead):

          2007-03-08 12:28:19,546 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
          2007-03-08 12:28:19,546 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
          2007-03-08 12:28:19,546 DEBUG [org.hibernate.pretty.Printer] listing entities:
          2007-03-08 12:28:19,546 DEBUG [org.hibernate.pretty.Printer] application.server.TicketDataImpl_String{ticketId=component[id_i]{id_i=89547}, status=1, ticketPayload=testATestSpecificTicket}


          And here it fails with the generic (P extends Serializable) class:

          2007-03-08 12:28:19,593 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
          2007-03-08 12:28:19,593 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
          2007-03-08 12:28:19,593 DEBUG [org.hibernate.pretty.Printer] listing entities:
          2007-03-08 12:28:19,593 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] mark transaction for rollback