<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<!-- MHonArc v2.6.10 -->
	<channel>
		<title>eclipselink-users</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/maillist.html</link>
		<description>eclipselink-users</description>
		<language>en-us</language>
		<pubDate>Fri, 20 Nov 2009 15:40:20 GMT</pubDate>
		<lastBuildDate>Fri, 20 Nov 2009 15:40:20 GMT</lastBuildDate>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>MHonArc RSS 2.0 RCFile</generator>
		<managingEditor>webmaster@eclipse.org (Webmaster)</managingEditor>
		<webMaster>webmaster@eclipse.org (Webmaster)</webMaster>
		<image>
			<title>eclipselink-users</title>
			<url>http://www.eclipse.org/eclipse.org-common/themes/Phoenix/images/eclipse_home_header.jpg</url>
			<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/maillist.html</link>
		</image>
 

	<item>
		<title>Re: [eclipselink-users] Failed insert results in invalid cache state</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03744.html</link>
		<description> </description>
		<content:encoded><![CDATA[<pre>
James,
  This is a response to a previous comment you made. I had to drop this
research for projects but now i'm back on it. I wanted to follow up with
something you mentioned:

 (EclipseLink will never generate duplicates).

What type of ID generator are you referring to? And, how is the guarantee
made (in a clustered environment)? I can only think of a few ways:

1) A database table manages the sequences (select from table, auto-update to
next value)
2) EclipseLink validates the value does not already exist as an ID in the
table prior to assigning it to the object. However this doesn't guarantee
that the ID won't be assigned by another process elsewhere, inserting into
the same table.
3) In the above instance, a sequence manager manages state across all
instance of EclipseLink in use.




James Sutherland wrote:
&gt; 
&gt; This is pretty advanced stuff, so you may want to reconsider you reasons
&gt; for trying to do this in the first place.  You might want to instead catch
&gt; the exception in your app and retry the whole transaction, or avoid having
&gt; duplicate sequence numbers in the first place (EclipseLink will never
&gt; generate duplicates).
&gt; 
&gt; To get your exception handler to work, you can't create a copy, as it
&gt; violates object identity.  You need to reset the object's pk to null.  You
&gt; could use the descriptor to do this generically.
&gt; 
&gt; 
&gt; Object value = builder.getSequenceMapping().getAttributeValue(null,
&gt; session);
&gt; builder.getSequenceMapping().setAttributeValueInObject(dup, value);
&gt; 
&gt; 

-- 
View this message in context: <a  href="http://old.nabble.com/Failed-insert-results-in-invalid-cache-state-tp25384148p26443298.html">http://old.nabble.com/Failed-insert-results-in-invalid-cache-state-tp25384148p26443298.html</a>
Sent from the EclipseLink - Users mailing list archive at Nabble.com.


</pre>]]></content:encoded>
		<pubDate>Fri, 20 Nov 2009 15:32:29 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03744.html</guid>
		<author>panth13@xxxxxxx (bryans)</author>
	</item>


	<item>
		<title>[eclipselink-users] batch-writing mode Oracle-JDBC leads to integrity constraint exception when a class contains lob field</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03743.html</link>
		<description>Hi all, I encountered another problem with Lob fields. Do you think this is a Bug in EclipseLink, Oracle or expected behavior. Given: A Test that - open a transaction - inserts a lot of Classes A with a Lob Field - Then insert some classes B that referenci...</description>
		<content:encoded><![CDATA[<pre>Hi all,

I encountered another problem with Lob fields. Do you think this is a Bug in EclipseLink, Oracle or expected behavior.

Given: 
A Test that 
- open a transaction
- inserts a lot of Classes A with a Lob Field
- Then insert some classes B that referencing class A with a manyToMany-Mapping.
- Commit Transaction

When
&lt;property name=&quot;eclipselink.jdbc.batch-writing&quot; value=&quot;Oracle-JDBC&quot; /&gt;
Then we get an java.sql.SQLException: ORA-02291 - Parent-Key not found. 
You see all necessary inserts into table A in the log. But the insert into the mapping table fails, although the id is correct and should be there.

When 
&lt;property name=&quot;eclipselink.jdbc.batch-writing&quot; value=&quot;JDBC&quot; /&gt;
Then everything runs fine.

When the tests is executed with H2 or DB2 everything runs fine.

And also we think to remember, that with the Oracle-JDBC setting and toplink the test runs fine.

regards,
Hans
______________________________________________________
GRATIS f&#xFC;r alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter <a  href="http://movieflat.web.de">http://movieflat.web.de</a>


</pre>]]></content:encoded>
		<pubDate>Thu, 19 Nov 2009 17:04:19 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03743.html</guid>
		<author>hansharz_eclipselink@xxxxxxx (Hans Harz)</author>
	</item>


	<item>
		<title>[eclipselink-users] Re: IndirectMap.containsKey leads to Exception because, DISTINCT on @Lob-Field</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03742.html</link>
		<description> -- Oracle &amp;lt;http://www.oracle.com&amp;gt; Reinhard Girstenbrei | Senior Principal Technical Support Engineer Phone: +498914302318 | Mobile: +491775941318 Oracle Oracle Customer Service ORACLE Deutschland GmbH | Riesstr. 25 | 80992 M&amp;#xFC;nchen ORACLE Deutschland GmbH,...</description>
		<content:encoded><![CDATA[<tt>Hi Hans,<br>
the stack trace shows that you are using a query optimization feature 
called batch reading</tt><br>
<br>
<pre style="margin: 0em;">e.g.</pre><br>
<pre style="margin: 0em;">@NamedQuery(</pre><br>
<pre style="margin: 0em;">...
hints= {</pre><br>
<tt>@QueryHint(<br>
     name=QueryHints.BATCH, </tt><br>
<br>
<pre style="margin: 0em;">...</pre><br>
<tt>Batch reading and an attributed mapped to a LOB column run into this 
problem.<br>
As James described there are two possible solutions:<br>
1. Do not use batch reading.<br>
or<br>
2. Add another releationship mapping to an entity object that maps the 
LOB column.<br>
For this relationship mapping no batch reading should be used.</tt><br>
<br>
<pre style="margin: 0em;">Best regards,
Reinhard</pre><br>
<tt><br>eclipselink-users-request@xxxxxxxxxxx wrote:
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">Send eclipselink-users mailing list submissions to
	eclipselink-users@xxxxxxxxxxx</pre><br>
<pre style="margin: 0em;">To subscribe or unsubscribe via the World Wide Web, visit
	<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a>
or, via email, send a message with subject or body 'help' to
	eclipselink-users-request@xxxxxxxxxxx</pre><br>
<pre style="margin: 0em;">You can reach the person managing the list at
	eclipselink-users-owner@xxxxxxxxxxx</pre><br>
<pre style="margin: 0em;">When replying, please edit your Subject line so it is more specific
than &quot;Re: Contents of eclipselink-users digest...&quot;</pre><br>
<pre style="margin: 0em;"><br>Today's Topics:</pre><br>
<pre style="margin: 0em;">   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)</pre><br>
<pre style="margin: 0em;"><br>----------------------------------------------------------------------</pre><br>
<pre style="margin: 0em;">Message: 1
Date: Wed, 18 Nov 2009 11:21:30 +0100
From: Hans Harz &lt;hansharz_eclipselink@xxxxxx&gt;
Subject: Re: [eclipselink-users] IndirectMap.containsKey leads to
	Exception because DISTINCT on @Lob-Field
To: EclipseLink User Discussions &lt;eclipselink-users@xxxxxxxxxxx&gt;
Message-ID: &lt;1854269327@xxxxxx&gt;
Content-Type: text/plain; charset=iso-8859-15</pre><br>
<pre style="margin: 0em;">Hi James, Hi Reinhard,</pre><br>
<tt>thank you very much for your answers. </tt><br>
<br>
<tt>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.<br>
Is there a annotation based possibility on the Many-to-Many property? </tt><br>
<br>
<pre style="margin: 0em;">Right now the field in the owning class looks like this:
    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
    @MapKey(name = &quot;typeId&quot;)
    @XStreamAlias(&quot;customFields&quot;)
    private Map&lt;CustomFieldType, CustomFieldValue&gt; customFields;</pre><br>
<pre style="margin: 0em;">and the CustomFieldValue class contains the Clob Field
   @Lob
    @Column(nullable = true)
    @XStreamAlias(&quot;stringValue&quot;)
    private String stringValue;</pre><br>
<pre style="margin: 0em;">I searched the API and documentation but can't find anything.</pre><br>
<pre style="margin: 0em;">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.</pre><br>
<pre style="margin: 0em;">Thanks in advance,
Hans</pre><br>
<pre style="margin: 0em;"><br></pre><br>
<tt>  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>-----Urspr&#xFC;ngliche Nachricht-----<br>
Von: &quot;James Sutherland&quot; &lt;jamesssss@xxxxxxxxx&gt;<br>
Gesendet: 17.11.09 19:42:42<br>
An: eclipselink-users@xxxxxxxxxxx<br>
Betreff: Re: [eclipselink-users] IndirectMap.containsKey leads to Exception because DISTINCT on @Lob-Field<br>
    
</tt></blockquote><pre style="margin: 0em;"><br></pre><br>
<tt>  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>The distinct is used because you are using batch reading on the query.  If<br>
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<br>
disable the usage of the distinct by setting dontUseDistinct() on the<br>
original batch query.  But then you will be selecting duplicate potentially.</tt><br>
<br>
<pre style="margin: 0em;">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.</pre><br>
<pre style="margin: 0em;">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.</pre><br>
<tt><br>Hans Harz-2 wrote:<br>
    
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">Hi all,</pre><br>
<pre style="margin: 0em;">I encountered a problem in our application. Maybe some of you can help me.</pre><br>
<tt>Using 
- EclipseLink 1.1.3<br>
- Given a class A with a @Lob Field String stringValue;<br>
- Given class B with 
    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})<br>
    @MapKey(name = &quot;field&quot;)<br>
    private Map&lt;AType, A&gt; As;</tt><br>
<br>
<tt>When I call As.containsKey(someAType) on the lazy loaded map 
Then a Query with a DISTINCT is created.<br>
SELECT DISTINCT ...,t0.stringValue,...<br>
this leads to the following exception on oracle databases (and we made a<br>
test with DB2 and it also fails)<br>
ORA-00932: inconsistent datatypes: expected - got CLOB</tt><br>
<br>
<tt>This is because DISTINCT queries are not allowed on BLOB or CLOB fields. 
Is this expected behavior?<br>
Did we miss a restriction of eclipselink? 
Is there a way to not generate the query without DISTINCT?</tt><br>
<br>
<pre style="margin: 0em;">In toplink we never had this problem, so it seems that toplink did not
generate the DISTINCT.</pre><br>
<pre style="margin: 0em;">Here is the Stack Trace.</pre><br>
<pre style="margin: 0em;">regards,
Hans</pre><br>
<tt>org.eclipse.persistence.exceptions.DatabaseException: Internal Exception:<br>
java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got<br>
CLOB Error Code: 932 Call: SELECT DISTINCT t1.ID, t1.EXPLICITVERSION,<br>
t1.STRINGVALUE, t1.UUID, .....<br>
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) </tt><br>
<br>
<tt>_____________________________________________________________<br>
DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon f&#xFC;r 
16,99 Euro/mtl.!* Hier klicken: <a  href="http://produkte.web.de/go/02/">http://produkte.web.de/go/02/</a></tt><br>
<br>
<tt><br>      
</tt></blockquote><tt>-----<br>
<a  href="http://wiki.eclipse.org/User:James.sutherland.oracle.com">http://wiki.eclipse.org/User:James.sutherland.oracle.com</a> James Sutherland 
<a  href="http://www.eclipse.org/eclipselink/">http://www.eclipse.org/eclipselink/</a><br>
 EclipseLink ,  <a  href="http://www.oracle.com/technology/products/ias/toplink/">http://www.oracle.com/technology/products/ias/toplink/</a><br>
TopLink 
Wiki:  <a  href="http://wiki.eclipse.org/EclipseLink">http://wiki.eclipse.org/EclipseLink</a> EclipseLink , 
<a  href="http://wiki.oracle.com/page/TopLink">http://wiki.oracle.com/page/TopLink</a> TopLink 
Forums:  <a  href="http://forums.oracle.com/forums/forum.jspa?forumID=48">http://forums.oracle.com/forums/forum.jspa?forumID=48</a> TopLink , 
<a  href="http://www.nabble.com/EclipseLink-f26430.html">http://www.nabble.com/EclipseLink-f26430.html</a> EclipseLink 
Book:  <a  href="http://en.wikibooks.org/wiki/Java_Persistence">http://en.wikibooks.org/wiki/Java_Persistence</a> Java Persistence 
--<br>
View this message in context: <a  href="http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html">http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html</a><br>
Sent from the EclipseLink - Users mailing list archive at Nabble.com.</tt><br>
<br>
<pre style="margin: 0em;">_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a></pre><br>
<tt>    
</tt></blockquote><pre style="margin: 0em;"><br></pre><br>
<tt>_____________________________________________________________<br>
DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon f&#xFC;r 
16,99 Euro/mtl.!* Hier klicken: <a  href="http://produkte.web.de/go/02/">http://produkte.web.de/go/02/</a></tt><br>
<br>
<pre style="margin: 0em;"><br></pre><br>
<pre style="margin: 0em;">------------------------------</pre><br>
<pre style="margin: 0em;">Message: 2
Date: Wed, 18 Nov 2009 03:08:19 -0800 (PST)
From: dhermanns &lt;d.hermanns@xxxxxx&gt;
Subject: Re: [eclipselink-users] Defining persistence.xml
	programmatically?
To: eclipselink-users@xxxxxxxxxxx
Message-ID: &lt;26405973.post@xxxxxxxxxxxxxxx&gt;
Content-Type: text/plain; charset=us-ascii</pre><br>
<pre style="margin: 0em;"><br>Thanks for the hint.
I filed it and you can find it here now:</pre><br>
<pre style="margin: 0em;"><a  href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295427">https://bugs.eclipse.org/bugs/show_bug.cgi?id=295427</a></pre><br>
<pre style="margin: 0em;">Hopefully i was able to express what we would really appreciate to have ;)</pre><br>
<tt><br>Shaun Smith wrote:<br>
  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>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: 
<a  href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink">https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink</a></tt><br>
<br>
<pre style="margin: 0em;">    Shaun</pre><br>
<tt>    
</tt></blockquote><tt><br>  
</tt></blockquote><pre style="margin: 0em;"><br>--
Oracle &lt;<a  href="http://www.oracle.com">http://www.oracle.com</a>&gt;
Reinhard Girstenbrei | Senior Principal Technical Support Engineer
Phone: +498914302318 | Mobile: +491775941318
Oracle Oracle Customer Service</pre><br>
<pre style="margin: 0em;">ORACLE Deutschland GmbH | Riesstr. 25 | 80992 M&#xFC;nchen</pre><br>
<tt>ORACLE Deutschland GmbH, Hauptverwaltung: Riesstra&#xDF;e 25, D-80992 M&#xFC;nchen<br>
Gesch&#xE4;ftsf&#xFC;hrer: J&#xFC;rgen Kunz, Registergericht: Amtsgericht M&#xFC;nchen, HRB 
82775<br>
Green Oracle &lt;<a  href="http://www.oracle.com/commitment">http://www.oracle.com/commitment</a>&gt; 	Oracle is committed to 
developing practices and products that help protect the environment</tt><br>
<br>
<br>
]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 17:13:26 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03742.html</guid>
		<author>reinhard.girstenbrei@xxxxxxx (Reinhard Girstenbrei)</author>
	</item>
	<item>
		<title>Re: [eclipselink-users] ReadAllQuery fetch all</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03741.html</link>
		<description>_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users _______________________________________________ eclipselink-users mailing list eclipseli...</description>
		<content:encoded><![CDATA[<pre style="margin: 0em;">Hello Martin,</pre><br>
<tt>I do not believe joining (or batch reading, another option) on a 
collection mapping will work when using a cursor.  Joining will cause 
multiple rows to be associated to the object, but the cursor will 
prevent going through the entire result set to build the object, so the 
returned objects will be based on a single row - and so collections will 
be incomplete.  Batching may work, but since the batch query to bring in 
references is based on the original query, it negates the value of using 
a cursor as all the collection objects will be read in at once. </tt><br>
<br>
<tt>What I would suggest instead is using pagination to read in batches - 
for instance ordering results and setting the first row/max results on 
the query object to return a manageable size of results.  A fetch join 
can then be used since all rows returned will be used to create the objects.</tt><br>
<br>
<pre style="margin: 0em;">Best Regards,
Chris</pre><br>
<tt>Janda Martin wrote:
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">Thank you, I tried &quot;addJoinedAttribute&quot; but theres problem. It doesn't work. It changed generated SQL command to use &quot;select distinct e ...&quot; instead of &quot;select o ...&quot;.</pre><br>
<pre style="margin: 0em;">&lt;entityClass&gt; has 4 lazy,optional OneToMany mappings that I nead to be fetched.</pre><br>
<pre style="margin: 0em;">    @OneToMany(mappedBy = &quot;datas&quot;, cascade = CascadeType.ALL)
    @OrderBy(&quot;dataType, azimut&quot;)
    private List&lt;DData&gt; dDataCollection;</pre><br>
<pre style="margin: 0em;"><br>ReadAllQuery readAllQuery = new ReadAllQuery(&lt;entityClass&gt;);
readAllQuery.setJPQLString(&quot;select object(o) from &lt;table&gt;&quot;);</pre><br>
<pre style="margin: 0em;">ScrollableCursorPolicy policy = new ScrollableCursorPolicy();
policy.setPageSize(200);
policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_INSENSITIVE);
policy.setResultSetConcurrency(ScrollableCursorPolicy.CONCUR_READ_ONLY);</pre><br>
<pre style="margin: 0em;">readAllQuery.useScrollableCursor(policy);</pre><br>
<pre style="margin: 0em;">// your suggestion
readAllQuery.addJoinedAttribute(readAllQuery.getExpressionBuilder().anyOf(&quot;dDataCollection&quot;));
// or - second one uses &quot;get&quot; instead of &quot;anyOf&quot; - throws exception
readAllQuery.addJoinedAttribute(&quot;dDataCollection&quot;);
// select distinct ... is generated on query execution</pre><br>
<pre style="margin: 0em;">ScrollableCursor scrollableCursor = (ScrollableCursor) uow.executeQuery(readAllQuery);</pre><br>
<pre style="margin: 0em;"><br>I've tried FetchGroup but I get exception that FetchGroupManager isn't set/installed.</pre><br>
<pre style="margin: 0em;">Correctly and as I expect works only fetch = EAGER. There is generated new select DData for every entity.</pre><br>
<pre style="margin: 0em;">It would be great to have some kind of QueryHint/boolean property on DatabaseQuery to disable lazy loading.</pre><br>
<pre style="margin: 0em;">  Please can you give me another advice how to make it. I think that my problem is typical for Java SE applications when you need select some entities from database. Close all connections and run some computation on selected entities.</pre><br>
<pre style="margin: 0em;">  Martin</pre><br>
<pre style="margin: 0em;">----- Original Message -----
From: &quot;Tom Ware&quot; &lt;tom.ware@xxxxxxxxxx&gt;
To: &quot;EclipseLink User Discussions&quot; &lt;eclipselink-users@xxxxxxxxxxx&gt;
Sent: Tuesday, November 17, 2009 3:09:44 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: Re: [eclipselink-users] ReadAllQuery fetch all</pre><br>
<pre style="margin: 0em;">Hi Martin,</pre><br>
<tt>   If you are using JPQL, JPQL allows you to specify fetch joins that will cause 
relationships to be automatically loaded.  Have you tried that?</tt><br>
<br>
<tt>   If you are using EclipseLink expressions, there is an addJoinedAttribute 
method you can use on your query.</tt><br>
<br>
<pre style="margin: 0em;">-Tom</pre><br>
<tt>Martin Janda wrote:<br>
  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>Hello,<br>
  can you help me? please. I have Entity with lazy mappings. I need to 
read all Entity attributes Eager&amp;Lazy trough ReadAllQuery 
(ScrollableCursor) and detach them. I need to use Entities after closing 
EM and EMF. So they can no longer fetch lazy mappings.<br>
I need to work with selected Entities from JTable (needs lazy) in 
another context (needs all attributes including lazy mappings).<br>
Is there any way how to do it in EclipseLink 1.1.3 Java SE, I prefer 
annotations or direct methods in EM/EMF/UOW.<br>
Thank you very much.<br>
   Martin</tt><br>
<br>
<tt>PS Sorry for my english<br>
_______________________________________________<br>
eclipselink-users mailing list<br>
eclipselink-users@xxxxxxxxxxx<br>
<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a><br>
    
</tt></blockquote><tt>_______________________________________________<br>
eclipselink-users mailing list<br>
eclipselink-users@xxxxxxxxxxx<br>
<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a><br>
_______________________________________________<br>
eclipselink-users mailing list<br>
eclipselink-users@xxxxxxxxxxx<br>
<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a><br>
  
</tt></blockquote><br>
]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 14:03:24 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03741.html</guid>
		<author>christopher.delahunt@xxxxxxx (christopher delahunt)</author>
	</item>
	<item>
		<title>Re: [eclipselink-users] ReadAllQuery fetch all</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03740.html</link>
		<description> _______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users </description>
		<content:encoded><![CDATA[<pre>Thank you, I tried &quot;addJoinedAttribute&quot; but theres problem. It doesn't work. It changed generated SQL command to use &quot;select distinct e ...&quot; instead of &quot;select o ...&quot;.

&lt;entityClass&gt; has 4 lazy,optional OneToMany mappings that I nead to be fetched.

    @OneToMany(mappedBy = &quot;datas&quot;, cascade = CascadeType.ALL)
    @OrderBy(&quot;dataType, azimut&quot;)
    private List&lt;DData&gt; dDataCollection;


ReadAllQuery readAllQuery = new ReadAllQuery(&lt;entityClass&gt;);
readAllQuery.setJPQLString(&quot;select object(o) from &lt;table&gt;&quot;);

ScrollableCursorPolicy policy = new ScrollableCursorPolicy();
policy.setPageSize(200);
policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_INSENSITIVE);
policy.setResultSetConcurrency(ScrollableCursorPolicy.CONCUR_READ_ONLY);

readAllQuery.useScrollableCursor(policy);

// your suggestion
readAllQuery.addJoinedAttribute(readAllQuery.getExpressionBuilder().anyOf(&quot;dDataCollection&quot;));
// or - second one uses &quot;get&quot; instead of &quot;anyOf&quot; - throws exception
readAllQuery.addJoinedAttribute(&quot;dDataCollection&quot;);
// select distinct ... is generated on query execution

ScrollableCursor scrollableCursor = (ScrollableCursor) uow.executeQuery(readAllQuery);


I've tried FetchGroup but I get exception that FetchGroupManager isn't set/installed.

Correctly and as I expect works only fetch = EAGER. There is generated new select DData for every entity.

It would be great to have some kind of QueryHint/boolean property on DatabaseQuery to disable lazy loading.

  Please can you give me another advice how to make it. I think that my problem is typical for Java SE applications when you need select some entities from database. Close all connections and run some computation on selected entities.

  Martin

----- Original Message -----
From: &quot;Tom Ware&quot; &lt;tom.ware@xxxxxxxxxx&gt;
To: &quot;EclipseLink User Discussions&quot; &lt;eclipselink-users@xxxxxxxxxxx&gt;
Sent: Tuesday, November 17, 2009 3:09:44 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: Re: [eclipselink-users] ReadAllQuery fetch all

Hi Martin,

   If you are using JPQL, JPQL allows you to specify fetch joins that will cause 
relationships to be automatically loaded.  Have you tried that?

   If you are using EclipseLink expressions, there is an addJoinedAttribute 
method you can use on your query.

-Tom

Martin Janda wrote:
&gt; Hello,
&gt;   can you help me? please. I have Entity with lazy mappings. I need to 
&gt; read all Entity attributes Eager&amp;Lazy trough ReadAllQuery 
&gt; (ScrollableCursor) and detach them. I need to use Entities after closing 
&gt; EM and EMF. So they can no longer fetch lazy mappings.
&gt; I need to work with selected Entities from JTable (needs lazy) in 
&gt; another context (needs all attributes including lazy mappings).
&gt; Is there any way how to do it in EclipseLink 1.1.3 Java SE, I prefer 
&gt; annotations or direct methods in EM/EMF/UOW.
&gt; Thank you very much.
&gt;    Martin
&gt; 
&gt; PS Sorry for my english
&gt; _______________________________________________
&gt; eclipselink-users mailing list
&gt; eclipselink-users@xxxxxxxxxxx
&gt; <a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a>
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a>

</pre>]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 13:18:40 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03740.html</guid>
		<author>jandam@xxxxxxx (Janda Martin)</author>
	</item>
	<item>
		<title>Re: [eclipselink-users] Defining persistence.xml programmatically?</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03739.html</link>
		<description> </description>
		<content:encoded><![CDATA[<pre>
Thanks for the hint.
I filed it and you can find it here now:

<a  href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295427">https://bugs.eclipse.org/bugs/show_bug.cgi?id=295427</a>

Hopefully i was able to express what we would really appreciate to have ;)


Shaun Smith wrote:
&gt; 
&gt; You can enter a bug/enhancement request in Eclipse's bugzilla.  You'll 
&gt; need to create an account before you can enter a bug.  EclipseLink is an 
&gt; RT project and here's a quick link to entering an EclipseLink bug: 
&gt; <a  href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink">https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink</a>
&gt; 
&gt;     Shaun
&gt; 

-- 
View this message in context: <a  href="http://old.nabble.com/Defining-persistence.xml-programatically--tp16402511p26405973.html">http://old.nabble.com/Defining-persistence.xml-programatically--tp16402511p26405973.html</a>
Sent from the EclipseLink - Users mailing list archive at Nabble.com.


</pre>]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 11:08:19 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03739.html</guid>
		<author>d.hermanns@xxxxxxx (dhermanns)</author>
	</item>
	<item>
		<title>Re: [eclipselink-users] IndirectMap.containsKey leads to Exception because DISTINCT on @Lob-Field</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03738.html</link>
		<description>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 Ma...</description>
		<content:encoded><![CDATA[<pre>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 = &quot;typeId&quot;)
    @XStreamAlias(&quot;customFields&quot;)
    private Map&lt;CustomFieldType, CustomFieldValue&gt; customFields;

and the CustomFieldValue class contains the Clob Field
   @Lob
    @Column(nullable = true)
    @XStreamAlias(&quot;stringValue&quot;)
    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



&gt; -----Urspr&#xFC;ngliche Nachricht-----
&gt; Von: &quot;James Sutherland&quot; &lt;jamesssss@xxxxxxxxx&gt;
&gt; Gesendet: 17.11.09 19:42:42
&gt; An: eclipselink-users@xxxxxxxxxxx
&gt; Betreff: Re: [eclipselink-users] IndirectMap.containsKey leads to Exception because DISTINCT on @Lob-Field


&gt; 
&gt; The distinct is used because you are using batch reading on the query.  If
&gt; you do not set batch reading on the query then you will not have the issue. 
&gt; Batch reading uses a distinct to avoid fetching duplicate data.  You can
&gt; disable the usage of the distinct by setting dontUseDistinct() on the
&gt; original batch query.  But then you will be selecting duplicate potentially.
&gt; 
&gt; You could also try moving the Lob to another table, or use a fetch group
&gt; (LAZY) on the Lob to avoid selecting it by default.
&gt; 
&gt; We could probably try to auto-detect a Lob field in the descriptor and not
&gt; add the distinct, so you could log a bug for that.
&gt; 
&gt; 
&gt; Hans Harz-2 wrote:
&gt; &gt; 
&gt; &gt; Hi all,
&gt; &gt; 
&gt; &gt; I encountered a problem in our application. Maybe some of you can help me.
&gt; &gt; 
&gt; &gt; Using 
&gt; &gt; - EclipseLink 1.1.3
&gt; &gt; - Given a class A with a @Lob Field String stringValue;
&gt; &gt; - Given class B with 
&gt; &gt;     @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
&gt; &gt;     @MapKey(name = &quot;field&quot;)
&gt; &gt;     private Map&lt;AType, A&gt; As;
&gt; &gt; 
&gt; &gt; When I call As.containsKey(someAType) on the lazy loaded map 
&gt; &gt; Then a Query with a DISTINCT is created.
&gt; &gt; SELECT DISTINCT ...,t0.stringValue,...
&gt; &gt; this leads to the following exception on oracle databases (and we made a
&gt; &gt; test with DB2 and it also fails)
&gt; &gt; ORA-00932: inconsistent datatypes: expected - got CLOB
&gt; &gt; 
&gt; &gt; This is because DISTINCT queries are not allowed on BLOB or CLOB fields. 
&gt; &gt; Is this expected behavior?
&gt; &gt; Did we miss a restriction of eclipselink? 
&gt; &gt; Is there a way to not generate the query without DISTINCT?
&gt; &gt; 
&gt; &gt; In toplink we never had this problem, so it seems that toplink did not
&gt; &gt; generate the DISTINCT.
&gt; &gt; 
&gt; &gt; Here is the Stack Trace.
&gt; &gt; 
&gt; &gt; regards,
&gt; &gt; Hans
&gt; &gt; 
&gt; &gt; org.eclipse.persistence.exceptions.DatabaseException: Internal Exception:
&gt; &gt; java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got
&gt; &gt; CLOB Error Code: 932 Call: SELECT DISTINCT t1.ID, t1.EXPLICITVERSION,
&gt; &gt; t1.STRINGVALUE, t1.UUID, .....
&gt; &gt; org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:332) 
&gt; &gt; org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:667) 
&gt; &gt; org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:512) 
&gt; &gt; org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:536) 
&gt; &gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205) 
&gt; &gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191) 
&gt; &gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:262) 
&gt; &gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:599) 
&gt; &gt; org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2518) 
&gt; &gt; org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2476) 
&gt; &gt; org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:481) 
&gt; &gt; org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:928) 
&gt; &gt; org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:664) 
&gt; &gt; org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:889) 
&gt; &gt; org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:458) 
&gt; &gt; org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2244) 
&gt; &gt; org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181) 
&gt; &gt; org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1165) 
&gt; &gt; org.eclipse.persistence.mappings.ManyToManyMapping.extractResultFromBatchQuery(ManyToManyMapping.java:231) 
&gt; &gt; org.eclipse.persistence.internal.indirection.BatchValueHolder.instantiate(BatchValueHolder.java:58) 
&gt; &gt; org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:71) 
&gt; &gt; org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83) 
&gt; &gt; org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:161) 
&gt; &gt; org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:230) 
&gt; &gt; org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83) 
&gt; &gt; org.eclipse.persistence.indirection.IndirectMap.buildDelegate(IndirectMap.java:110) 
&gt; &gt; org.eclipse.persistence.indirection.IndirectMap.getDelegate(IndirectMap.java:316) 
&gt; &gt; org.eclipse.persistence.indirection.IndirectMap.containsKey(IndirectMap.java:165) 
&gt; &gt; 
&gt; &gt; _____________________________________________________________
&gt; &gt; DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon f&#xFC;r 
&gt; &gt; 16,99 Euro/mtl.!* Hier klicken: <a  href="http://produkte.web.de/go/02/">http://produkte.web.de/go/02/</a>
&gt; &gt; 
&gt; &gt; 
&gt; 
&gt; 
&gt; -----
&gt; <a  href="http://wiki.eclipse.org/User:James.sutherland.oracle.com">http://wiki.eclipse.org/User:James.sutherland.oracle.com</a> James Sutherland 
&gt; <a  href="http://www.eclipse.org/eclipselink/">http://www.eclipse.org/eclipselink/</a>
&gt;  EclipseLink ,  <a  href="http://www.oracle.com/technology/products/ias/toplink/">http://www.oracle.com/technology/products/ias/toplink/</a>
&gt; TopLink 
&gt; Wiki:  <a  href="http://wiki.eclipse.org/EclipseLink">http://wiki.eclipse.org/EclipseLink</a> EclipseLink , 
&gt; <a  href="http://wiki.oracle.com/page/TopLink">http://wiki.oracle.com/page/TopLink</a> TopLink 
&gt; Forums:  <a  href="http://forums.oracle.com/forums/forum.jspa?forumID=48">http://forums.oracle.com/forums/forum.jspa?forumID=48</a> TopLink , 
&gt; <a  href="http://www.nabble.com/EclipseLink-f26430.html">http://www.nabble.com/EclipseLink-f26430.html</a> EclipseLink 
&gt; Book:  <a  href="http://en.wikibooks.org/wiki/Java_Persistence">http://en.wikibooks.org/wiki/Java_Persistence</a> Java Persistence 
&gt; -- 
&gt; View this message in context: <a  href="http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html">http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html</a>
&gt; Sent from the EclipseLink - Users mailing list archive at Nabble.com.
&gt; 
&gt; _______________________________________________
&gt; eclipselink-users mailing list
&gt; eclipselink-users@xxxxxxxxxxx
&gt; <a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a>
&gt; 


_____________________________________________________________
DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon f&#xFC;r 
16,99 Euro/mtl.!* Hier klicken: <a  href="http://produkte.web.de/go/02/">http://produkte.web.de/go/02/</a>


</pre>]]></content:encoded>
		<pubDate>Wed, 18 Nov 2009 10:21:35 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03738.html</guid>
		<author>hansharz_eclipselink@xxxxxxx (Hans Harz)</author>
	</item>


	<item>
		<title>[eclipselink-users] EclipseLink 1.1.3: object persisted is not	considered registered at commit time</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03737.html</link>
		<description>I am using the EclipseLink 1.1.3, specifically the eclipselink-1.1.3.v20091002-r5404.zip distribution. I have a disconnected set of new and existing objects that I want to reattach to a clear()ed persistence manager via persist() or merge() as appropriate,...</description>
		<content:encoded><![CDATA[<pre>I am using the EclipseLink 1.1.3, specifically the
eclipselink-1.1.3.v20091002-r5404.zip distribution.

I have a disconnected set of new and existing objects that I want to
reattach to a clear()ed persistence manager via persist() or merge()
as appropriate, and then commit().  Basically, we have our own simple
JPA-API-based unit of work implementation which tracks changes to
disconnected objects and then reattaches and commits those objects at
an commit time.

This methodology has worked fine in the past for similar situations,
but today I'm hitting a problem where a new object which was
persist()ed is being flagged as unpersisted in
discoverAndPersistUnregisteredNewObjects() during commit().

java.lang.IllegalStateException: During synchronization a new object
was found through a relationship that was not marked cascade PERSIST:
[toString() representation of my entity].

Thread [btpool0-3] (Suspended (exception IllegalStateException))	
	RepeatableWriteUnitOfWork(UnitOfWorkImpl).discoverAndPersistUnregisteredNewObjects(Object,
boolean, Map, Map, Map) line: 4010
	OneToOneMapping(ObjectReferenceMapping).cascadeDiscoverAndPersistUnregisteredNewObjects(Object,
Map, Map, Map, UnitOfWorkImpl) line: 743
	ObjectBuilder.cascadeDiscoverAndPersistUnregisteredNewObjects(Object,
Map, Map, Map, UnitOfWorkImpl) line: 1511
	RepeatableWriteUnitOfWork(UnitOfWorkImpl).discoverAndPersistUnregisteredNewObjects(Object,
boolean, Map, Map, Map) line: 4013
	RepeatableWriteUnitOfWork.discoverUnregisteredNewObjects(Map, Map,
Map, Map) line: 206
	RepeatableWriteUnitOfWork(UnitOfWorkImpl).calculateChanges(Map,
UnitOfWorkChangeSet, boolean) line: 628
	RepeatableWriteUnitOfWork(UnitOfWorkImpl).commitToDatabaseWithChangeSet(boolean)
line: 1387
	RepeatableWriteUnitOfWork.commitRootUnitOfWork() line: 181	
	RepeatableWriteUnitOfWork(UnitOfWorkImpl).commitAndResume() line: 1060	
	EntityTransactionImpl.commitInternal() line: 84	
	EntityTransactionImpl.commit() line: 63	

This is the behavior I am seeing.  When I call persist() with this
specific object instance and trace through the code to
RepeatableWriteUnitOfWork(UnitOfWorkImpl).checkIfAlreadyRegistered, I
see that a copy of the object is already considered registered,
although not the specific instance I'm working with.  [id instance
values shown from the eclipse debugger]

Argument:
	dataEntity = com.gvea.applications.cis.entity.jpa.JpaReceiptSource  (id=2510)	


    RepeatableWriteUnitOfWork(UnitOfWorkImpl).checkIfAlreadyRegistered(Object,
ClassDescriptor) line: 765
    RepeatableWriteUnitOfWork(UnitOfWorkImpl).registerNewObjectForPersist(Object,
Map) line: 4039
    EntityManagerImpl.persist(Object) line: 255	

        if (hasNewObjects()) {
            registeredObject = getNewObjectsOriginalToClone().get(object);

Values after checking getNewObjectsOriginalToClone() map:

    this = org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork
 (id=2859)
    object = com.gvea.applications.cis.entity.jpa.JpaReceiptSource  (id=2510)	
    registeredObject =
com.gvea.applications.cis.entity.jpa.JpaReceiptSource  (id=2868)

As you can see, the copy (id=2868) is detected as registered, not the
original object being persisted.

But then when I go to commit(), I get the above IllegalStateException
for (id=2510) since the code appears to only check getCloneMapping()
and not getNewObjectsOriginalToClone() like the persist method does.
[stack trace above]

if (!isObjectRegistered(object)) {
[...]
            } else {
                // It is new but not referenced by a cascade persist
mapping, throw an error.
                throw new
IllegalStateException(ExceptionLocalization.buildMessage(&quot;new_object_found_during_commit&quot;,
new Object[]{object}));
            }

this = org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork
 (id=2859)
object = com.gvea.applications.cis.entity.jpa.JpaReceiptSource  (id=2510)

</pre>]]></content:encoded>
		<pubDate>Tue, 17 Nov 2009 22:51:41 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03737.html</guid>
		<author>mkienenb@xxxxxxx (Mike Kienenberger)</author>
	</item>
	<item>
		<title>Re: [eclipselink-users] IndirectMap.containsKey leads to Exception	because DISTINCT on @Lob-Field</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03736.html</link>
		<description> ----- 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:/...</description>
		<content:encoded><![CDATA[<pre>
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:
&gt; 
&gt; Hi all,
&gt; 
&gt; I encountered a problem in our application. Maybe some of you can help me.
&gt; 
&gt; Using 
&gt; - EclipseLink 1.1.3
&gt; - Given a class A with a @Lob Field String stringValue;
&gt; - Given class B with 
&gt;     @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
&gt;     @MapKey(name = &quot;field&quot;)
&gt;     private Map&lt;AType, A&gt; As;
&gt; 
&gt; When I call As.containsKey(someAType) on the lazy loaded map 
&gt; Then a Query with a DISTINCT is created.
&gt; SELECT DISTINCT ...,t0.stringValue,...
&gt; this leads to the following exception on oracle databases (and we made a
&gt; test with DB2 and it also fails)
&gt; ORA-00932: inconsistent datatypes: expected - got CLOB
&gt; 
&gt; This is because DISTINCT queries are not allowed on BLOB or CLOB fields. 
&gt; Is this expected behavior?
&gt; Did we miss a restriction of eclipselink? 
&gt; Is there a way to not generate the query without DISTINCT?
&gt; 
&gt; In toplink we never had this problem, so it seems that toplink did not
&gt; generate the DISTINCT.
&gt; 
&gt; Here is the Stack Trace.
&gt; 
&gt; regards,
&gt; Hans
&gt; 
&gt; org.eclipse.persistence.exceptions.DatabaseException: Internal Exception:
&gt; java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got
&gt; CLOB Error Code: 932 Call: SELECT DISTINCT t1.ID, t1.EXPLICITVERSION,
&gt; t1.STRINGVALUE, t1.UUID, .....
&gt; org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:332) 
&gt; org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:667) 
&gt; org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:512) 
&gt; org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:536) 
&gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205) 
&gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191) 
&gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:262) 
&gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:599) 
&gt; org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2518) 
&gt; org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2476) 
&gt; org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:481) 
&gt; org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:928) 
&gt; org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:664) 
&gt; org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:889) 
&gt; org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:458) 
&gt; org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2244) 
&gt; org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181) 
&gt; org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1165) 
&gt; org.eclipse.persistence.mappings.ManyToManyMapping.extractResultFromBatchQuery(ManyToManyMapping.java:231) 
&gt; org.eclipse.persistence.internal.indirection.BatchValueHolder.instantiate(BatchValueHolder.java:58) 
&gt; org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:71) 
&gt; org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83) 
&gt; org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:161) 
&gt; org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:230) 
&gt; org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83) 
&gt; org.eclipse.persistence.indirection.IndirectMap.buildDelegate(IndirectMap.java:110) 
&gt; org.eclipse.persistence.indirection.IndirectMap.getDelegate(IndirectMap.java:316) 
&gt; org.eclipse.persistence.indirection.IndirectMap.containsKey(IndirectMap.java:165) 
&gt; 
&gt; _____________________________________________________________
&gt; DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon f&#xC3;r 
&gt; 16,99 Euro/mtl.!* Hier klicken: <a  href="http://produkte.web.de/go/02/">http://produkte.web.de/go/02/</a>
&gt; 
&gt; 


-----
<a  href="http://wiki.eclipse.org/User:James.sutherland.oracle.com">http://wiki.eclipse.org/User:James.sutherland.oracle.com</a> James Sutherland 
<a  href="http://www.eclipse.org/eclipselink/">http://www.eclipse.org/eclipselink/</a>
 EclipseLink ,  <a  href="http://www.oracle.com/technology/products/ias/toplink/">http://www.oracle.com/technology/products/ias/toplink/</a>
TopLink 
Wiki:  <a  href="http://wiki.eclipse.org/EclipseLink">http://wiki.eclipse.org/EclipseLink</a> EclipseLink , 
<a  href="http://wiki.oracle.com/page/TopLink">http://wiki.oracle.com/page/TopLink</a> TopLink 
Forums:  <a  href="http://forums.oracle.com/forums/forum.jspa?forumID=48">http://forums.oracle.com/forums/forum.jspa?forumID=48</a> TopLink , 
<a  href="http://www.nabble.com/EclipseLink-f26430.html">http://www.nabble.com/EclipseLink-f26430.html</a> EclipseLink 
Book:  <a  href="http://en.wikibooks.org/wiki/Java_Persistence">http://en.wikibooks.org/wiki/Java_Persistence</a> Java Persistence 
-- 
View this message in context: <a  href="http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html">http://old.nabble.com/IndirectMap.containsKey-leads-to-Exception-because-DISTINCT-on-%40Lob-Field-tp26390360p26395252.html</a>
Sent from the EclipseLink - Users mailing list archive at Nabble.com.


</pre>]]></content:encoded>
		<pubDate>Tue, 17 Nov 2009 18:41:49 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03736.html</guid>
		<author>jamesssss@xxxxxxx (James Sutherland)</author>
	</item>
	<item>
		<title>[eclipselink-users] Re: IndirectMap.containsKey leads to Exception because DISTINCT, on @Lob-Field (Reinhard Girstenbrei)</title>
		<link>http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03735.html</link>
		<description> I get filter criteria from smartgwt, which is a gwt frontend. I need ejbql because it sends filtering criterias in a Map&amp;lt;String,String&amp;gt;. I don't want to use an unecessary string parser, simply put criteria text into the sql. For a test I make a simple que...</description>
		<content:encoded><![CDATA[<tt>Hi Hans,<br>
Oracle Database Server does not allow to use the DISTINCT clause if 
there is a select list item of data type LOB.<br>
You are using the batch reading which generates queries including a 
DISTINCT clause.<br>
Now, as you have an attributed mapped to a LOB you run into this problem.<br>
Your can resolve this problem by not using batch reading.</tt><br>
<br>
<tt>If you have access to &quot;My Oracle Support&quot; (formerly known as Metalink) 
you have access to the following enhancement request:</tt><br>
<br>
<tt>Bug 6646443 - ALLOW *BATCH* *READING* OF *LOB* COLUMNS IN ONETOMANY AND 
MANYTOMANY RELATIONSHIPS</tt><br>
<br>
<pre style="margin: 0em;">I have not found an enhancement request for such feature on bugzilla yet.</pre><br>
<tt>You can open a new SR if you have a valid support contract to vote for 
this enhancement request or open an enhancement request at bugzilla.<br>
<a  href="https://bugs.eclipse.org/bugs/">https://bugs.eclipse.org/bugs/</a><br>
Classification: RT<br>
Product: EclipseLink<br>
Component: Foundation</tt><br>
<br>
<pre style="margin: 0em;">Greetings,
Reinhard</pre><br>
<tt>eclipselink-users-request@xxxxxxxxxxx wrote:
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">Send eclipselink-users mailing list submissions to
	eclipselink-users@xxxxxxxxxxx</pre><br>
<pre style="margin: 0em;">To subscribe or unsubscribe via the World Wide Web, visit
	<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a>
or, via email, send a message with subject or body 'help' to
	eclipselink-users-request@xxxxxxxxxxx</pre><br>
<pre style="margin: 0em;">You can reach the person managing the list at
	eclipselink-users-owner@xxxxxxxxxxx</pre><br>
<pre style="margin: 0em;">When replying, please edit your Subject line so it is more specific
than &quot;Re: Contents of eclipselink-users digest...&quot;</pre><br>
<pre style="margin: 0em;"><br>Today's Topics:</pre><br>
<pre style="margin: 0em;">   1. Postgres arrays (Mike Traum)
   2. Re: Postgres arrays (Mike Traum)
   3. ReadAllQuery fetch all (Martin Janda)
   4. IndirectMap.containsKey leads to Exception because DISTINCT
      on @Lob-Field (Hans Harz)
   5. Re: ReadAllQuery fetch all (Tom Ware)
   6. Re: how can I reference a foreign key in ejbql	where
      condition? (James Sutherland)
   7. Re: How eclipselink handles Sequences? (James Sutherland)</pre><br>
<pre style="margin: 0em;"><br>----------------------------------------------------------------------</pre><br>
<pre style="margin: 0em;">Message: 1
Date: Mon, 16 Nov 2009 09:31:00 -0800
From: Mike Traum &lt;Mike.Traum@xxxxxxxx&gt;
Subject: [eclipselink-users] Postgres arrays
To: EclipseLink User Discussions &lt;eclipselink-users@xxxxxxxxxxx&gt;
Message-ID: &lt;4B018C54.502@xxxxxxxx&gt;
Content-Type: text/plain; charset=ISO-8859-1; format=flowed</pre><br>
<tt>Hi,<br>
I'm trying to get a mapping for postgres arrays working. I'm using a 
Converter and thus far (without a lot of testing), inserting an array 
seems to work fine. But, when reading that array, eclipselink (1.2) 
throws the following exception before we even get to the Converter:<br>
java.lang.ClassCastException: [D cannot be cast to [Ljava.lang.Object;<br>
    at 
org.eclipse.persistence.mappings.structures.ObjectRelationalDataTypeDescriptor.buildArrayObjectFromArray(ObjectRelationalDataTypeDescriptor.java:326)<br>
...</tt><br>
<br>
<tt>The problem seems to be that eclipselink is attempting to cast 
java.sql.Array.getArray() to Object[], but postgres returns an array of 
primitives. This seems like an eclipselink bug, no? Any idea for a 
workaround?</tt><br>
<br>
<pre style="margin: 0em;">Thanks,
Mike</pre><br>
<pre style="margin: 0em;"><br></pre><br>
<pre style="margin: 0em;">------------------------------</pre><br>
<pre style="margin: 0em;">Message: 2
Date: Mon, 16 Nov 2009 13:30:31 -0800
From: Mike Traum &lt;Mike.Traum@xxxxxxxx&gt;
Subject: [eclipselink-users] Re: Postgres arrays
To: EclipseLink User Discussions &lt;eclipselink-users@xxxxxxxxxxx&gt;
Message-ID: &lt;4B01C477.1090207@xxxxxxxx&gt;
Content-Type: text/plain; charset=ISO-8859-1; format=flowed</pre><br>
<tt>I seem to have worked out my issues. I upgraded the jdbc driver from 
postgresql-8.2-506.jdbc3.jar to postgresql-8.4-701.jdbc4.jar and 
postgres now returns the boxed types instead of the primitive arrays.</tt><br>
<br>
<pre style="margin: 0em;">mike</pre><br>
<tt>Mike Traum wrote:<br>
  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>Hi,<br>
I'm trying to get a mapping for postgres arrays working. I'm using a 
Converter and thus far (without a lot of testing), inserting an array 
seems to work fine. But, when reading that array, eclipselink (1.2) 
throws the following exception before we even get to the Converter:<br>
java.lang.ClassCastException: [D cannot be cast to [Ljava.lang.Object;<br>
   at 
org.eclipse.persistence.mappings.structures.ObjectRelationalDataTypeDescriptor.buildArrayObjectFromArray(ObjectRelationalDataTypeDescriptor.java:326) </tt><br>
<br>
<pre style="margin: 0em;">...</pre><br>
<tt>The problem seems to be that eclipselink is attempting to cast 
java.sql.Array.getArray() to Object[], but postgres returns an array 
of primitives. This seems like an eclipselink bug, no? Any idea for a 
workaround?</tt><br>
<br>
<pre style="margin: 0em;">Thanks,
Mike</pre><br>
<tt><br>    
</tt></blockquote><pre style="margin: 0em;"><br></pre><br>
<pre style="margin: 0em;">------------------------------</pre><br>
<pre style="margin: 0em;">Message: 3
Date: Mon, 16 Nov 2009 23:02:08 +0100
From: Martin Janda &lt;jandam@xxxxxxxxxx&gt;
Subject: [eclipselink-users] ReadAllQuery fetch all
To: EclipseLink Users &lt;eclipselink-users@xxxxxxxxxxx&gt;
Message-ID: &lt;5B79C16E-9C64-4786-B33B-4A5CD86B6E61@xxxxxxxxxx&gt;
Content-Type: text/plain;	charset=us-ascii;	format=flowed;	delsp=yes</pre><br>
<tt>Hello,<br>
   can you help me? please. I have Entity with lazy mappings. I need  
to read all Entity attributes Eager&amp;Lazy trough ReadAllQuery  
(ScrollableCursor) and detach them. I need to use Entities after  
closing EM and EMF. So they can no longer fetch lazy mappings.<br>
I need to work with selected Entities from JTable (needs lazy) in  
another context (needs all attributes including lazy mappings).<br>
Is there any way how to do it in EclipseLink 1.1.3 Java SE, I prefer  
annotations or direct methods in EM/EMF/UOW.<br>
Thank you very much.<br>
    Martin</tt><br>
<br>
<pre style="margin: 0em;">PS Sorry for my english</pre><br>
<pre style="margin: 0em;"><br>------------------------------</pre><br>
<pre style="margin: 0em;">Message: 4
Date: Tue, 17 Nov 2009 14:58:09 +0100
From: Hans Harz &lt;hansharz_eclipselink@xxxxxx&gt;
Subject: [eclipselink-users] IndirectMap.containsKey leads to
	Exception because DISTINCT on @Lob-Field
To: eclipselink-users@xxxxxxxxxxx
Message-ID: &lt;1852227376@xxxxxx&gt;
Content-Type: text/plain; charset=iso-8859-15</pre><br>
<pre style="margin: 0em;">Hi all,</pre><br>
<pre style="margin: 0em;">I encountered a problem in our application. Maybe some of you can help me.</pre><br>
<tt>Using 
- EclipseLink 1.1.3<br>
- Given a class A with a @Lob Field String stringValue;<br>
- Given class B with 
    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE})<br>
    @MapKey(name = &quot;field&quot;)<br>
    private Map&lt;AType, A&gt; As;</tt><br>
<br>
<tt>When I call As.containsKey(someAType) on the lazy loaded map 
Then a Query with a DISTINCT is created.<br>
SELECT DISTINCT ...,t0.stringValue,...<br>
this leads to the following exception on oracle databases (and we made a test with DB2 and it also fails)<br>
ORA-00932: inconsistent datatypes: expected - got CLOB</tt><br>
<br>
<tt>This is because DISTINCT queries are not allowed on BLOB or CLOB fields. 
Is this expected behavior?<br>
Did we miss a restriction of eclipselink? 
Is there a way to not generate the query without DISTINCT?</tt><br>
<br>
<pre style="margin: 0em;">In toplink we never had this problem, so it seems that toplink did not generate the DISTINCT.</pre><br>
<pre style="margin: 0em;">Here is the Stack Trace.</pre><br>
<pre style="margin: 0em;">regards,
Hans</pre><br>
<tt>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, .....<br>
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) </tt><br>
<br>
<tt>_____________________________________________________________<br>
DSL-Preisknaller: DSL-Komplettpakete von WEB.DE schon f&#xFC;r 
16,99 Euro/mtl.!* Hier klicken: <a  href="http://produkte.web.de/go/02/">http://produkte.web.de/go/02/</a></tt><br>
<br>
<pre style="margin: 0em;"><br></pre><br>
<pre style="margin: 0em;">------------------------------</pre><br>
<pre style="margin: 0em;">Message: 5
Date: Tue, 17 Nov 2009 09:09:44 -0500
From: Tom Ware &lt;tom.ware@xxxxxxxxxx&gt;
Subject: Re: [eclipselink-users] ReadAllQuery fetch all
To: EclipseLink User Discussions &lt;eclipselink-users@xxxxxxxxxxx&gt;
Message-ID: &lt;4B02AEA8.5020103@xxxxxxxxxx&gt;
Content-Type: text/plain; charset=ISO-8859-1; format=flowed</pre><br>
<pre style="margin: 0em;">Hi Martin,</pre><br>
<tt>   If you are using JPQL, JPQL allows you to specify fetch joins that will cause 
relationships to be automatically loaded.  Have you tried that?</tt><br>
<br>
<tt>   If you are using EclipseLink expressions, there is an addJoinedAttribute 
method you can use on your query.</tt><br>
<br>
<pre style="margin: 0em;">-Tom</pre><br>
<tt>Martin Janda wrote:<br>
  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>Hello,<br>
  can you help me? please. I have Entity with lazy mappings. I need to 
read all Entity attributes Eager&amp;Lazy trough ReadAllQuery 
(ScrollableCursor) and detach them. I need to use Entities after closing 
EM and EMF. So they can no longer fetch lazy mappings.<br>
I need to work with selected Entities from JTable (needs lazy) in 
another context (needs all attributes including lazy mappings).<br>
Is there any way how to do it in EclipseLink 1.1.3 Java SE, I prefer 
annotations or direct methods in EM/EMF/UOW.<br>
Thank you very much.<br>
   Martin</tt><br>
<br>
<tt>PS Sorry for my english<br>
_______________________________________________<br>
eclipselink-users mailing list<br>
eclipselink-users@xxxxxxxxxxx<br>
<a  href="https://dev.eclipse.org/mailman/listinfo/eclipselink-users">https://dev.eclipse.org/mailman/listinfo/eclipselink-users</a><br>
    
</tt></blockquote><pre style="margin: 0em;"><br></pre><br>
<pre style="margin: 0em;">------------------------------</pre><br>
<pre style="margin: 0em;">Message: 6
Date: Tue, 17 Nov 2009 06:38:39 -0800 (PST)
From: James Sutherland &lt;jamesssss@xxxxxxxxx&gt;
Subject: Re: [eclipselink-users] how can I reference a foreign key in
	ejbql	where condition?
To: eclipselink-users@xxxxxxxxxxx
Message-ID: &lt;26391063.post@xxxxxxxxxxxxxxx&gt;
Content-Type: text/plain; charset=us-ascii</pre><br>
<pre style="margin: 0em;"><br>Why are you using a ReadAllQuery, if you are using JPA and JPQL?  Just create
a JPA Query,</pre><br>
<pre style="margin: 0em;">Query query = em.createQuery(&quot;Select Object(entity) from ChairImpl entity
where  entity.institute=:institute&quot;);
query.setParameter(&quot;institute&quot;, new Integer(10));
List result = query.getResultList();</pre><br>
<pre style="margin: 0em;">If you need to use a ReadAllQuery with EJBQL then you cannot use
addArgumentValue(), as it seems to have issues, you will need to execute it
as a parametrized query.</pre><br>
<tt>i.e.<br>
ReadAllQuery query = new ReadAllQuery(ChairImpl.getClass());<br>
   query.setEJBQLString(&quot;Select Object(entity) from ChairImpl entity where 
entity.institute=?1&quot;);<br>
   query.addArgument(&quot;1&quot;);<br>
   EntityManager em = this.getEntityManager();<br>
   Query query = JpaHelper.createQuery(query, em);<br>
   query.setParameter(&quot;1&quot;, new Integer(10));<br>
   List result = query.getResultList();</tt><br>
<br>
<tt><br>zamek42 wrote:<br>
  
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><tt>hello James, </tt><br>
<br>
<pre style="margin: 0em;">thx for response.</pre><br>
<tt>James Sutherland wrote:<br>
    
</tt><blockquote style="border-left: #5555EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">Are you using JPA?  EJBQL/JPQL is normally used from JPA using the JPA
Query interface.</pre><br>
<pre style="margin: 0em;">For using EJBQL/JPQL with an EclipseLink ReadAllQuery you need to set the
argument names and values.</pre><br>
<pre style="margin: 0em;">i.e.
query.setEJBQLString(&quot;Select OBJECT(sg) from sg sg where sg.foreignField
= ?1&quot;);
query.addArgument(&quot;1&quot;);
query.addArgumentValue(id);</pre><br>
<tt><br>      
</tt></blockquote><pre style="margin: 0em;">I get filter criteria from smartgwt, which is a gwt frontend. I need ejbql
because it sends filtering criterias in a Map&lt;String,String&gt;. I don't want
to use an unecessary string parser, simply put criteria text into the sql.
For a test I make a simple query:</pre><br>
<tt>   ReadAllQuery query = new ReadAllQuery(ChairImpl.getClass());<br>
   query.setEJBQLString(&quot;Select Object(entity) from ChairImpl entity where 
entity.institute=?1&quot;);<br>
   query.addArgument(&quot;1&quot;);<br>
   query.addArgumentValue(new Integer(10));<br>
   EntityManager em = this.getEntityManager();<br>
   List result = JpaHelper.createQuery(query, em).getResultList();</tt><br>
<br>
<pre style="margin: 0em;">this throws an error:
java.lang.IllegalStateException: Query argument 1 not found in the list of
parameters provided during query execution.</pre><br>
<pre style="margin: 0em;">ChairImpl has an attribute named institute:
   @ManyToOne
    @JoinColumn(nullable=false)
    public InstituteImpl getInstitute() {
        return institute;
    }</pre><br>
<pre style="margin: 0em;">    public void setInstitute(InstituteImpl institute) {
        this.institute = institute;
    }</pre><br>
<pre style="margin: 0em;">What do I mistake?</pre><br>
<pre style="margin: 0em;">Perhaps JpaHelper.createQuery is unecessary? How can I use readAllQuery
from glassfish directly?</pre><br>
<tt>thx 
Zamek</tt><br>
<br>
<tt>    
</tt></blockquote><pre style="margin: 0em;"><br></pre><br>
<tt>-----<br>
<a  href="http://wiki.eclipse.org/User:James.sutherland.oracle.com">http://wiki.eclipse.org/User:James.sutherland.oracle.com</a> James Sutherland 
<a  href="http://www.eclipse.org/eclipselink/">http://www.eclipse.org/eclipselink/</a><br>
 EclipseLink ,  <a  href="http://www.oracle.com/technology/products/ias/toplink/">http://www.oracle.com/technology/products/ias/toplink/</a><br>
TopLink 
Wiki:  <a  href="http://wiki.eclipse.org/EclipseLink">http://wiki.eclipse.org/EclipseLink</a> EclipseLink , 
<a  href="http://wiki.oracle.com/page/TopLink">http://wiki.oracle.com/page/TopLink</a> TopLink 
Forums:  <a  href="http://forums.oracle.com/forums/forum.jspa?forumID=48">http://forums.oracle.com/forums/forum.jspa?forumID=48</a> TopLink , 
<a  href="http://www.nabble.com/EclipseLink-f26430.html">http://www.nabble.com/EclipseLink-f26430.html</a> EclipseLink 
Book:  <a  href="http://en.wikibooks.org/wiki/Java_Persistence">http://en.wikibooks.org/wiki/Java_Persistence</a> Java Persistence 
  
</tt></blockquote><pre style="margin: 0em;"><br>--
Oracle &lt;<a  href="http://www.oracle.com">http://www.oracle.com</a>&gt;
Reinhard Girstenbrei | Senior Principal Technical Support Engineer
Phone: +498914302318 | Mobile: +491775941318
Oracle Oracle Customer Service</pre><br>
<pre style="margin: 0em;">ORACLE Deutschland GmbH | Riesstr. 25 | 80992 M&#xFC;nchen</pre><br>
<tt>ORACLE Deutschland GmbH, Hauptverwaltung: Riesstra&#xDF;e 25, D-80992 M&#xFC;nchen<br>
Gesch&#xE4;ftsf&#xFC;hrer: J&#xFC;rgen Kunz, Registergericht: Amtsgericht M&#xFC;nchen, HRB 
82775<br>
Green Oracle &lt;<a  href="http://www.oracle.com/commitment">http://www.oracle.com/commitment</a>&gt; 	Oracle is committed to 
developing practices and products that help protect the environment</tt><br>
<br>
<br>
]]></content:encoded>
		<pubDate>Tue, 17 Nov 2009 17:35:08 GMT</pubDate>
		<guid isPermaLink="true">http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03735.html</guid>
		<author>reinhard.girstenbrei@xxxxxxx (Reinhard Girstenbrei)</author>
	</item>

 
	</channel>
	</rss>
<!-- MHonArc v2.6.10 -->
