Results 1 to 4 of 4
  1. #1
    fevimu is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default Problem with "Restrictions.in"

    Hi, I am having a strange case that I want to expose, if you can give me some clue about what is happening.
    The following code stops working properly (it returns no record) when run a number of times:

    Criteria fonCriteria = this.getSession().createCriteria(igfFondo.class);

    String[] fondosPermitidos = new String[300];

    for (int i=0; i<300;i++)
    {
    fondosPermitidos[0]= "A01";
    }

    fonCriteria.add(Restrictions.in("fondo", fondosPermitidos));

    List fondos=fonCriteria.list();


    I know this code does not make much sense, it is a test code that I created to reproduce the error.

    The problem is that the query only gives the expected results a number of times, which is always the same number of times if we pass the same number of parameters to "Restrictions.in."

    The weirdest thing is that the problem only occurs in the following environments:

    Application Server: JBoss 4.0.5 on Linux Ubuntu Server 9.10 (Java Version: 1.6.0_15-b03)
    DB: DB2 en AS400

    It works correctly in the following environments:

    Application Server: JBoss 4.0.5 on Linux Ubuntu Server 9.10 (Java Version: 1.6.0_15-b03)
    DB: MySQL on Linux Ubuntu Server 9.10 (misma maquina que JBoss)

    Application Server: JBoss 4.0.5 on Windows XP
    DB: MySQL on Linux Ubuntu Server 9.10, or DB2 on AS400


    The query generated by Hibernate (version 3.1.3) is the same when it works good and evil, and is as follows:

    select this_.FONDO as FONDO3_0_, this_.IGFDNBR as IGFDNBR3_0_, this_.IGFDTIP as IGFDTIP3_0_, this_.IGFDNIF as IGFDNIF3_0_, this_.IGFDRBE as IGFDRBE3_0_, this_.IGFDRCN as IGFDRCN3_0_, this_.IGFDDEP as IGFDDEP3_0_, this_.IGFDFCO as IGFDFCO3_0_, this_.IGFDFBA as IGFDFBA3_0_, this_.IGFDFCN as IGFDFCN3_0_, this_.IGFDNIG as IGFDNIG3_0_, this_.IGFDRGE as IGFDRGE3_0_, this_.IGFDFRM as IGFDFRM3_0_, this_.IGFDNIN as IGFDNIN3_0_, this_.IGFDLI1 as IGFDLI15_3_0_, this_.IGFDTIT as IGFDTIT3_0_, this_.IGFDVLI as IGFDVLI3_0_, this_.IGFDNDI as IGFDNDI3_0_, this_.IGFDNPA as IGFDNPA3_0_, this_.IGFDTOM as IGFDTOM3_0_, this_.IGFDSGE as IGFDSGE3_0_, this_.IGFDSEC as IGFDSEC3_0_, this_.IGFDLIB as IGFDLIB3_0_, this_.IGFDFOL as IGFDFOL3_0_, this_.IGFDHOJ as IGFDHOJ3_0_, this_.IGFDFIG as IGFDFIG3_0_, this_.IGFDFFG as IGFDFFG3_0_, this_.IGFDVGA as IGFDVGA3_0_, this_.IGFDFGA as IGFDFGA3_0_, this_.IGFDCA2 as IGFDCA30_3_0_, this_.IGFDCA3 as IGFDCA31_3_0_, this_.IGFDDIV as IGFDDIV3_0_, this_.IGFDREF as IGFDREF3_0_, this_.IGFDM22 as IGFDM34_3_0_, this_.IGFDISI as IGFDISI3_0_, this_.IGFDPRO as IGFDPRO3_0_, this_.IGFDOM as IGFDOM3_0_, this_.IGFPOB as IGFPOB3_0_, this_.IGFCOP as IGFCOP3_0_, this_.IGFCCV as IGFCCV3_0_, this_.IGFCCC as IGFCCC3_0_, this_.IGFGGES as IGFGGES3_0_, this_.IGFAUD as IGFAUD3_0_, this_.IGFNOM as IGFNOM3_0_, this_.IGFMAI as IGFMAI3_0_, this_.IGFGEST as IGFGEST3_0_, this_.IGFMGE as IGFMGE3_0_, this_.IGFTEL as IGFTEL3_0_, this_.IGFFIA as IGFFIA3_0_, this_.IGFBEN as IGFBEN3_0_, this_.IGFTIG as IGFTIG3_0_, this_.IGFPOI as IGFPOI3_0_, this_.IGFDELEG as IGFDELEG3_0_, this_.IGFOFIC as IGFOFIC3_0_, this_.IGFBOLSA as IGFBOLSA3_0_ from IGDATTEST.IGFFONDO this_ where this_.FONDO in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?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?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and this_.IGFDTIP in (?, ?, ?, ?) and this_.IGFDNIG=? order by this_.FONDO asc

    What is happening?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    The only difference then is the DB, so it's either the driver for DB2 or it's DB2 itself.

  3. #3
    fevimu is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default

    But, It works correctly in the following environment:

    Application Server: JBoss 4.0.5 on Windows XP
    DB: DB2 on AS400

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    You didn't mention that one.

    I'd still look at DB2 as the culprit, or its Driver.
    You might be lucky and find a DB2 person here, but it's not too likely.

Similar Threads

  1. Replies: 1
    Last Post: 01-21-2010, 09:20 AM
  2. problem with argument list and precedence "(" and ")"
    By helpisontheway in forum Advanced Java
    Replies: 6
    Last Post: 12-24-2009, 07:50 AM
  3. Replies: 2
    Last Post: 10-08-2009, 11:28 PM
  4. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •