Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] IndirectMap.containsKey leads to Exception because DISTINCT on @Lob-Field

Hi all,

I encountered a problem in our application. Maybe some of you can help me.

Using 
- EclipseLink 1.1.3
- Given a class A with a @Lob Field String stringValue;
- Given class B with 
    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
    @MapKey(name = "field")
    private Map<AType, A> As;

When I call As.containsKey(someAType) on the lazy loaded map 
Then a Query with a DISTINCT is created.
SELECT DISTINCT ...,t0.stringValue,...
this leads to the following exception on oracle databases (and we made a test with DB2 and it also fails)
ORA-00932: inconsistent datatypes: expected - got CLOB

This is because DISTINCT queries are not allowed on BLOB or CLOB fields. 
Is this expected behavior?
Did we miss a restriction of eclipselink? 
Is there a way to not generate the query without DISTINCT?

In toplink we never had this problem, so it seems that toplink did not generate the DISTINCT.

Here is the Stack Trace.

regards,
Hans

org.eclipse.persistence.exceptions.DatabaseException: Internal Exception: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CLOB Error Code: 932 Call: SELECT DISTINCT t1.ID, t1.EXPLICITVERSION, t1.STRINGVALUE, t1.UUID, .....
org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:332) 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:667) 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:512) 
org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:536) 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205) 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191) 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:262) 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:599) 
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2518) 
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2476) 
org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:481) 
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:928) 
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:664) 
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:889) 
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:458) 
org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2244) 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181) 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1165) 
org.eclipse.persistence.mappings.ManyToManyMapping.extractResultFromBatchQuery(ManyToManyMapping.java:231) 
org.eclipse.persistence.internal.indirection.BatchValueHolder.instantiate(BatchValueHolder.java:58) 
org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:71) 
org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83) 
org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:161) 
org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:230) 
org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83) 
org.eclipse.persistence.indirection.IndirectMap.buildDelegate(IndirectMap.java:110) 
org.eclipse.persistence.indirection.IndirectMap.getDelegate(IndirectMap.java:316) 
org.eclipse.persistence.indirection.IndirectMap.containsKey(IndirectMap.java:165) 

_____________________________________________________________
DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon für 
16,99 Euro/mtl.!* Hier klicken: http://produkte.web.de/go/02/



Back to the top