0 Replies Latest reply on Nov 28, 2009 3:51 AM by ptitjeojeo

    HQL query doesn't have same result when deployed in JBoss

    ptitjeojeo

      Hello everybody,

      I don't know if there is the good place for this post...

      Maven dependencies :
      - hibernate-3.2.4.sp1
      - hibernate-entitymanager-3.2.1.ga
      - hibernate-annotation-3.2.1.ga
      - persistence-api-1.0
      - mysql-connector-java-5.1.8

      Application Server : JBoss 4.2.3
      Database Server : MySQL 5.1

      The hibernate library are those that can be found in the /lib folder of JBoss 4.2.3.
      I have a different behaviour when I test my application via JUnit and via my Web Application deployed under JBoss.

      I have a class MyClass with a property type. The type property is an enumeration define like that :

      @Enumerated(EnumType.STRING)


      I have the following query :
      SELECT m FROM MaClasse WHERE m.type = ?
      
      request.setParameter(Type.TEST);


      When I test the query with a JUnit test, the type parameters is correctly replaced by the "TEST" value in the sql query.

      If i deploy the WebApplication and do the same test the type parameters is not replaced by "TEST" value but by a strange value with hexa characters "2c14f2c45d47d58c8c8c8c8......"

      I've put the debug mode and I found that the Enumeration is not evaluated in the same way :
      - JUnit : EnumType
      - JBoss : SerializableType.

      My question is, why such behaviour ? Is there a specific link between JBoss and hibernate libraries ???
      I tried to delete hibernate libraries from JBoss.. it didn't work.

      If someone has already encountered this kind of problem ??

      Thanks in advance.

      ps : I can prepare a little test to reproduce the behaviour if you want.