Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Fix for bug# 295556 - Do not add Distinct to Queries that including a Lob field - in DB2

I believe it's Oracle-only problem, it won't allow:
  select distinct my_id, my_lob from my_table
Try that on DB2, I believe it will work.
On 9/3/2014 11:45 AM, Tomas Kraus wrote:
Here is what's written in our internal bug:
Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=295556 was fixed for Oracle only. It should have been fixed for Db2 also.
The isLobCompatibleWithDistinct method is overridden in OraclePlatform, but not in Db2Platform.

TESTCASE DETAILS (REQUIRED):
----------------------------
Create a descriptor for a clob column, and try to select it in Db2.

I checked master branch and it's true, OraclePlatform overrides this to false but DB2Platform does not. I don't know if this is source of any problems in DB2. Adding Jay Turner (who reported this) to cc, maybe he will tell you more.

Tomas

Dne 9/3/14, 5:29 PM, J Grassel napsal(a):
Hey there, I’m having a bit of trouble reproducing this issue.  I wrote the following unit test and ran it against ECL 2.5.0 but unfortunately the test refuses to fail.  Is there something important from the problem reproduction description that I am overlooking?

Here’s my attempt at reproducing the problem:

@Entity
public class ECL295EntA {
    @Id
    private int id;

    

    @Basic
    private String strData;

    @Lob String stringValue;
}

@Entity
public class ECL295EntB {
    @Id
    private int id;

    

    @Basic
    private String strData;

    

    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
    @JoinTable(name="ECLENTA_ENTB")
    @MapKey(name="strData")
    private Map<String, ECL295EntA> entACollection;
}

public class TestD295556 {
...
    @Test
    public void test002() {
        EntityManagerFactory emf = null;
        EntityManager em = null;

        

        emf = javax.persistence.Persistence.createEntityManagerFactory("testpu");
        em = emf.createEntityManager();

        

        em.getTransaction().begin();
        em.createNativeQuery("DELETE FROM ECLENTA_ENTB").executeUpdate();
        em.createNativeQuery("DELETE FROM ECL295EntA").executeUpdate();
        em.createNativeQuery("DELETE FROM ECL295EntB").executeUpdate();

        

        em.getTransaction().commit();
        em.close();

        

        em = emf.createEntityManager();
        em.getTransaction().begin();

        

        final int entBCount = 10;
        ECL295EntB[] entBArr = new ECL295EntB[entBCount];

        

        for (int i = 0; i < entBCount; i++) {
            ECL295EntB entB = new ECL295EntB();
            entB.setId(i+1);
            entB.setStrData("Entity B-" + i);
            em.persist(entB);

            

            entBArr[i] = entB;
        }

        

        SecureRandom sr = new SecureRandom();

        

        for (int i = 0; i < 10; i++) {
            ECL295EntA entA = new ECL295EntA();
            entA.setId(i+1);
            entA.setStrData("EntA-" + i);

            

            StringBuffer sb = new StringBuffer();
            for (int j = 0; j < 200; j++) {
                sb.append(sr.nextLong());sb.append(' ');
            }
            entA.setStringValue(sb.toString());

            

                       

            for (int j = 0; j < entBCount; j++) {
                entBArr[j].getEntACollection().put(entA.getStrData(), entA);
            }

            

            em.persist(entA);
        }

        

        em.getTransaction().commit();
        em.close();
        emf.close();

        

        emf = javax.persistence.Persistence.createEntityManagerFactory("testpu");
        em = emf.createEntityManager();

       

        Query q = em.createQuery("SELECT b from ECL295EntB b");
        q.setHint(QueryHints.BATCH , "b.entACollection");

        

        List<ECL295EntB> resultSet = q.getResultList();
        assertNotNull(resultSet);

        

        ECL295EntB entB_find = resultSet.get(0); //  em.find(ECL295EntB.class, 1);
        assertNotNull(entB_find);

       

        boolean containsTarget = entB_find.getEntACollection().containsKey("EntA-1");
        assertTrue(containsTarget);

        

        assertEquals(10, entB_find.getEntACollection().size());      
    }
...


On Aug 26, 2014, at 4:53 AM, Tomas Kraus <tomas.kraus@xxxxxxxxxx> wrote:

Hi all,

I would like to ask guys from IBM to have a look at https://bugs.eclipse.org/bugs/show_bug.cgi?id=295556 and port this fix into DB2 code too. I wanted to do it myself but we currently do not have DB2 available here. Please let me know if someone has time available to fix it in next 2-3 weeks. We have to finalize 2.6 soon and this issue is one of those we would like to fix in 2.6.

Tomas

_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev



_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev



_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev


Back to the top