[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Re: IndirectMap.containsKey leads to Exception because, DISTINCT on @Lob-Field
|
Hi Hans,
the stack trace shows that you are using a query optimization feature
called batch reading
e.g.
@NamedQuery(
...
hints= {
@QueryHint(
name=QueryHints.BATCH,
...
Batch reading and an attributed mapped to a LOB column run into this
problem.
As James described there are two possible solutions:
1. Do not use batch reading.
or
2. Add another releationship mapping to an entity object that maps the
LOB column.
For this relationship mapping no batch reading should be used.
Best regards,
Reinhard
eclipselink-users-request@xxxxxxxxxxx wrote:
Send eclipselink-users mailing list submissions to
eclipselink-users@xxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
or, via email, send a message with subject or body 'help' to
eclipselink-users-request@xxxxxxxxxxx
You can reach the person managing the list at
eclipselink-users-owner@xxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of eclipselink-users digest..."
Today's Topics:
1. Re: IndirectMap.containsKey leads to Exception because
DISTINCT on @Lob-Field (Hans Harz)
2. Re: Defining persistence.xml programmatically? (dhermanns)
3. Re: ReadAllQuery fetch all (Janda Martin)
4. Re: ReadAllQuery fetch all (christopher delahunt)
----------------------------------------------------------------------
Message: 1
Date: Wed, 18 Nov 2009 11:21:30 +0100
From: Hans Harz <hansharz_eclipselink@xxxxxx>
Subject: Re: [eclipselink-users] IndirectMap.containsKey leads to
Exception because DISTINCT on @Lob-Field
To: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID: <1854269327@xxxxxx>
Content-Type: text/plain; charset=iso-8859-15
Hi James, Hi Reinhard,
thank you very much for your answers.
I'm not sure about your suggested workaround. How can I set the dontUseDistinct() property on the query, when I don't specify the query manually.
Is there a annotation based possibility on the Many-to-Many property?
Right now the field in the owning class looks like this:
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
@MapKey(name = "typeId")
@XStreamAlias("customFields")
private Map<CustomFieldType, CustomFieldValue> customFields;
and the CustomFieldValue class contains the Clob Field
@Lob
@Column(nullable = true)
@XStreamAlias("stringValue")
private String stringValue;
I searched the API and documentation but can't find anything.
Because the exception appeared at one of our customers a hint to a workaround through editing the persistence.xml and the orm.xml would be great.
Thanks in advance,
Hans
-----Ursprüngliche Nachricht-----
Von: "James Sutherland" <jamesssss@xxxxxxxxx>
Gesendet: 17.11.09 19:42:42
An: eclipselink-users@xxxxxxxxxxx
Betreff: Re: [eclipselink-users] IndirectMap.containsKey leads to Exception because DISTINCT on @Lob-Field
The distinct is used because you are using batch reading on the query. If
you do not set batch reading on the query then you will not have the issue.
Batch reading uses a distinct to avoid fetching duplicate data. You can
disable the usage of the distinct by setting dontUseDistinct() on the
original batch query. But then you will be selecting duplicate potentially.
You could also try moving the Lob to another table, or use a fetch group
(LAZY) on the Lob to avoid selecting it by default.
We could probably try to auto-detect a Lob field in the descriptor and not
add the distinct, so you could log a bug for that.
Hans Harz-2 wrote:
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/
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_____________________________________________________________
DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon für
16,99 Euro/mtl.!* Hier klicken: http://produkte.web.de/go/02/
------------------------------
Message: 2
Date: Wed, 18 Nov 2009 03:08:19 -0800 (PST)
From: dhermanns <d.hermanns@xxxxxx>
Subject: Re: [eclipselink-users] Defining persistence.xml
programmatically?
To: eclipselink-users@xxxxxxxxxxx
Message-ID: <26405973.post@xxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii
Thanks for the hint.
I filed it and you can find it here now:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=295427
Hopefully i was able to express what we would really appreciate to have ;)
Shaun Smith wrote:
You can enter a bug/enhancement request in Eclipse's bugzilla. You'll
need to create an account before you can enter a bug. EclipseLink is an
RT project and here's a quick link to entering an EclipseLink bug:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink
Shaun
--
Oracle <http://www.oracle.com>
Reinhard Girstenbrei | Senior Principal Technical Support Engineer
Phone: +498914302318 | Mobile: +491775941318
Oracle Oracle Customer Service
ORACLE Deutschland GmbH | Riesstr. 25 | 80992 München
ORACLE Deutschland GmbH, Hauptverwaltung: Riesstraße 25, D-80992 München
Geschäftsführer: Jürgen Kunz, Registergericht: Amtsgericht München, HRB
82775
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment