<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
	<id>tag:n2.nabble.com,2006:forum-208411</id>
	<title>Nabble - OpenJPA Users</title>
	<updated>2009-11-07T20:41:47Z</updated>
	<link rel="self" type="application/atom+xml" href="http://n2.nabble.com/OpenJPA-Users-f208411.xml" />
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/OpenJPA-Users-f208411.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:n2.nabble.com,2006:post-3967042</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T20:41:47Z</published>
	<updated>2009-11-07T20:41:47Z</updated>
	<author>
		<name>rtselvan</name>
	</author>
	<content type="html">Correct, you need to create a separate instance of the EntityManagerFactory for each organization by passing in the datasource name. it means that you create the factory.createEntityManager() for each thread based on the factory.
&lt;br&gt;&lt;br&gt;here is where you apply the solution that Michael and Milosz were taking about.
&lt;br&gt;&lt;br&gt;eg:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntityManagerFactory emf = factories.get(client); 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (emf == null) 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, String&amp;gt; props = new HashMap&amp;lt;String, String&amp;gt;();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.jtaDataSource&amp;quot;, &amp;quot;jdbc/&amp;quot; + client + &amp;quot;db&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; emf = Persistence.createEntityManagerFactory(&amp;quot;pu&amp;quot;, props);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; factories.put(client, emf);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntityManager em = emf.createEntityManager();
&lt;br&gt;&lt;br&gt;also, you need to create the data sources programmatically if you adding new organizations while application is live. &amp;nbsp;If you are interested here is an example of it.
&lt;br&gt;&lt;br&gt;&amp;lt;pre&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String dsName = String.format(&amp;quot;%1$sDb&amp;quot;, clientCode);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Resource res = new Resource(dsName, &amp;quot;javax.sql.DataSource&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; res.setJndi(dsName);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Properties props = res.getProperties();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;JdbcDriver&amp;quot;, &amp;quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;JdbcUrl&amp;quot;, String.format(&amp;quot;jdbc:sqlserver://172.19.101.12;databaseName=%1$s_db&amp;quot;, clientCode));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;UserName&amp;quot;, &amp;quot;sa&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;Password&amp;quot;, &amp;quot;whatever&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;JtaManaged&amp;quot;, &amp;quot;true&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assembler component = SystemInstance.get().getComponent(Assembler.class);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; component.createResource(new ConfigurationFactory().configureService(res, ResourceInfo.class));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thread.yield();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (OpenEJBException e) 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw e;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;lt;/pre&amp;gt;
&lt;br&gt;&lt;br&gt;Hope that it helps 
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Daryl Stultz wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;On Sat, Nov 7, 2009 at 7:53 PM, rtselvan &amp;lt;rtselvan@gmail.com&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There may be some difference in what you are doing though. I have one only
&lt;br&gt;&amp;gt; persistence unit in the XML file and connecting to different database based
&lt;br&gt;&amp;gt; on the user/organization. This avoids to creating a lot of persistence unit
&lt;br&gt;&amp;gt; and as well, ability to add additional organization without having change
&lt;br&gt;&amp;gt; the persistence unit xml file.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;Yeah, I definitely want to be able to add and drop organizations while the
&lt;br&gt;application is live, thus no changes to persistence.xml. But isn't a one to
&lt;br&gt;one correspondence between persistence unit and database implied? How does
&lt;br&gt;JPA know the difference between 2 entities of the same class with the same
&lt;br&gt;ID but from different databases?
&lt;br&gt;&lt;br&gt;I'm using a DataSource to get connections from my connection pool, I can see
&lt;br&gt;clearly how I can choose a connection from different databases, but I would
&lt;br&gt;think JPA would get very confused if I did that.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:daryl@6degrees.com
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3967042.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3966799"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3966799</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T18:50:57Z</published>
	<updated>2009-11-07T18:50:57Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Sat, Nov 7, 2009 at 7:53 PM, rtselvan &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3966799&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There may be some difference in what you are doing though. I have one only
&lt;br&gt;&amp;gt; persistence unit in the XML file and connecting to different database based
&lt;br&gt;&amp;gt; on the user/organization. This avoids to creating a lot of persistence unit
&lt;br&gt;&amp;gt; and as well, ability to add additional organization without having change
&lt;br&gt;&amp;gt; the persistence unit xml file.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;Yeah, I definitely want to be able to add and drop organizations while the
&lt;br&gt;application is live, thus no changes to persistence.xml. But isn't a one to
&lt;br&gt;one correspondence between persistence unit and database implied? How does
&lt;br&gt;JPA know the difference between 2 entities of the same class with the same
&lt;br&gt;ID but from different databases?
&lt;br&gt;&lt;br&gt;I'm using a DataSource to get connections from my connection pool, I can see
&lt;br&gt;clearly how I can choose a connection from different databases, but I would
&lt;br&gt;think JPA would get very confused if I did that.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3966799&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3966799.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3966405"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3966405</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T16:53:18Z</published>
	<updated>2009-11-07T16:53:18Z</updated>
	<author>
		<name>rtselvan</name>
	</author>
	<content type="html">There may be some difference in what you are doing though. I have one only persistence unit in the XML file and connecting to different database based on the user/organization. This avoids to creating a lot of persistence unit and as well, ability to add additional organization without having change the persistence unit xml file.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Daryl Stultz wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;On Fri, Nov 6, 2009 at 8:10 PM, rtselvan &amp;lt;rtselvan@gmail.com&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; My application is a multi-tenant app, I would need to override the
&lt;br&gt;&amp;gt; datasource
&lt;br&gt;&amp;gt; at runtime when creating the entitymanager factory based on the client
&lt;br&gt;&amp;gt; code/name.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Does OpenJPA support that?
&lt;br&gt;&lt;br&gt;&lt;br&gt;In a month or two I will be modifying my application to do just this sort of
&lt;br&gt;thing. I assume by &amp;quot;multi-tenant&amp;quot; you mean someone will login as a user
&lt;br&gt;under one of many organizations and the user will then have access to one of
&lt;br&gt;many persistence units that correspond to the organizations? I have much
&lt;br&gt;more to do than selecting the right persistence unit / em factory, but I'm
&lt;br&gt;interested in whatever you come up with. I hadn't considered that OpenJPA
&lt;br&gt;might support it, I figured I'd have to instantiate all the factories when
&lt;br&gt;the app starts up, then use the URL the user accesses the app with to map to
&lt;br&gt;the right factory. It actually seems fairly easy, but if OpenJPA supports
&lt;br&gt;some mechanism already, all the better.
&lt;br&gt;&lt;br&gt;I currently use a static factory with a ThreadLocal entity manager. So I
&lt;br&gt;want my business logic to continue to be able to pick the entity manager
&lt;br&gt;from the current thread. This means I need to set up the ThreadLocal state
&lt;br&gt;at the beginning of the event thread to be able to create an entity manager
&lt;br&gt;from the right factory, presumably by mapping the URL to the factory.
&lt;br&gt;&lt;br&gt;Those are my thoughts thus far.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:daryl@6degrees.com
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3966405.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3965360"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3967018</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T20:29:59Z</published>
	<updated>2009-11-07T20:29:59Z</updated>
	<author>
		<name>rtselvan</name>
	</author>
	<content type="html">It works great! It was identical to hibernate JPA implementation.
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;rtselvan wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Thanks Guys! 
&lt;br&gt;&lt;br&gt;Let me try that, it looks pretty simple
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Michael Dick wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Adding to Milosz response.
&lt;br&gt;&lt;br&gt;The property keys that you want are javax.persistence.jtaDataSource and
&lt;br&gt;javax.persistence.nonJtaDataSource (for jta-data-source and
&lt;br&gt;non-jta-data-source respectively)
&lt;br&gt;&lt;br&gt;For example :
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, Object&amp;gt; props = new HashMap&amp;lt;String, Object&amp;gt;();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.jtaDataSource&amp;quot;, &amp;quot;jdbc/override&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.nonJtaDataSource&amp;quot;,
&lt;br&gt;&amp;quot;jdbc/overrideNonJTA&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntityManagerFactory emf =
&lt;br&gt;Persistence.createEntityManagerFactory(getPersistenceUnitName(), props);
&lt;br&gt;&lt;br&gt;In earlier versions of OpenJPA you can use openjpa.ConnectionFactoryName for
&lt;br&gt;jta-data-source and openjpa.ConnectionFactory2Name for non-jta-data-source.
&lt;br&gt;&lt;br&gt;Hope this helps,
&lt;br&gt;-mike
&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 2:41 PM, Miłosz Tylenda &amp;lt;mtylenda@o2.pl&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Hello!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; My application is a multi-tenant app, I would need to override the
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; datasource
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; at runtime when creating the entitymanager factory based on the client
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; code/name.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Does OpenJPA support that?
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; In a month or two I will be modifying my application to do just this sort
&lt;br&gt;&amp;gt; of
&lt;br&gt;&amp;gt; &amp;gt; thing. I assume by &amp;quot;multi-tenant&amp;quot; you mean someone will login as a user
&lt;br&gt;&amp;gt; &amp;gt; under one of many organizations and the user will then have access to one
&lt;br&gt;&amp;gt; of
&lt;br&gt;&amp;gt; &amp;gt; many persistence units that correspond to the organizations? I have much
&lt;br&gt;&amp;gt; &amp;gt; more to do than selecting the right persistence unit / em factory, but
&lt;br&gt;&amp;gt; I'm
&lt;br&gt;&amp;gt; &amp;gt; interested in whatever you come up with. I hadn't considered that OpenJPA
&lt;br&gt;&amp;gt; &amp;gt; might support it, I figured I'd have to instantiate all the factories
&lt;br&gt;&amp;gt; when
&lt;br&gt;&amp;gt; &amp;gt; the app starts up, then use the URL the user accesses the app with to map
&lt;br&gt;&amp;gt; to
&lt;br&gt;&amp;gt; &amp;gt; the right factory. It actually seems fairly easy, but if OpenJPA supports
&lt;br&gt;&amp;gt; &amp;gt; some mechanism already, all the better.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Have you tried calling Persistence.createEntityManagerFactory(String, Map)?
&lt;br&gt;&amp;gt; The second parameter should allow you to override any value you have set in
&lt;br&gt;&amp;gt; persistence.xml, so in particular, the data source name.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Regards,
&lt;br&gt;&amp;gt; Milosz
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3967018.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3966416"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3966416</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T16:55:27Z</published>
	<updated>2009-11-07T16:55:27Z</updated>
	<author>
		<name>rtselvan</name>
	</author>
	<content type="html">Thanks Guys! 
&lt;br&gt;&lt;br&gt;Let me try that, it looks pretty simple
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Michael Dick wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Adding to Milosz response.
&lt;br&gt;&lt;br&gt;The property keys that you want are javax.persistence.jtaDataSource and
&lt;br&gt;javax.persistence.nonJtaDataSource (for jta-data-source and
&lt;br&gt;non-jta-data-source respectively)
&lt;br&gt;&lt;br&gt;For example :
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, Object&amp;gt; props = new HashMap&amp;lt;String, Object&amp;gt;();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.jtaDataSource&amp;quot;, &amp;quot;jdbc/override&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.nonJtaDataSource&amp;quot;,
&lt;br&gt;&amp;quot;jdbc/overrideNonJTA&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntityManagerFactory emf =
&lt;br&gt;Persistence.createEntityManagerFactory(getPersistenceUnitName(), props);
&lt;br&gt;&lt;br&gt;In earlier versions of OpenJPA you can use openjpa.ConnectionFactoryName for
&lt;br&gt;jta-data-source and openjpa.ConnectionFactory2Name for non-jta-data-source.
&lt;br&gt;&lt;br&gt;Hope this helps,
&lt;br&gt;-mike
&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 2:41 PM, Miłosz Tylenda &amp;lt;mtylenda@o2.pl&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Hello!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; My application is a multi-tenant app, I would need to override the
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; datasource
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; at runtime when creating the entitymanager factory based on the client
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; code/name.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Does OpenJPA support that?
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; In a month or two I will be modifying my application to do just this sort
&lt;br&gt;&amp;gt; of
&lt;br&gt;&amp;gt; &amp;gt; thing. I assume by &amp;quot;multi-tenant&amp;quot; you mean someone will login as a user
&lt;br&gt;&amp;gt; &amp;gt; under one of many organizations and the user will then have access to one
&lt;br&gt;&amp;gt; of
&lt;br&gt;&amp;gt; &amp;gt; many persistence units that correspond to the organizations? I have much
&lt;br&gt;&amp;gt; &amp;gt; more to do than selecting the right persistence unit / em factory, but
&lt;br&gt;&amp;gt; I'm
&lt;br&gt;&amp;gt; &amp;gt; interested in whatever you come up with. I hadn't considered that OpenJPA
&lt;br&gt;&amp;gt; &amp;gt; might support it, I figured I'd have to instantiate all the factories
&lt;br&gt;&amp;gt; when
&lt;br&gt;&amp;gt; &amp;gt; the app starts up, then use the URL the user accesses the app with to map
&lt;br&gt;&amp;gt; to
&lt;br&gt;&amp;gt; &amp;gt; the right factory. It actually seems fairly easy, but if OpenJPA supports
&lt;br&gt;&amp;gt; &amp;gt; some mechanism already, all the better.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Have you tried calling Persistence.createEntityManagerFactory(String, Map)?
&lt;br&gt;&amp;gt; The second parameter should allow you to override any value you have set in
&lt;br&gt;&amp;gt; persistence.xml, so in particular, the data source name.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Regards,
&lt;br&gt;&amp;gt; Milosz
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3966416.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3965762"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965762</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T13:28:03Z</published>
	<updated>2009-11-07T13:28:03Z</updated>
	<author>
		<name>Michael Dick</name>
	</author>
	<content type="html">Adding to Milosz response.
&lt;br&gt;&lt;br&gt;The property keys that you want are javax.persistence.jtaDataSource and
&lt;br&gt;javax.persistence.nonJtaDataSource (for jta-data-source and
&lt;br&gt;non-jta-data-source respectively)
&lt;br&gt;&lt;br&gt;For example :
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, Object&amp;gt; props = new HashMap&amp;lt;String, Object&amp;gt;();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.jtaDataSource&amp;quot;, &amp;quot;jdbc/override&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; props.put(&amp;quot;javax.persistence.nonJtaDataSource&amp;quot;,
&lt;br&gt;&amp;quot;jdbc/overrideNonJTA&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntityManagerFactory emf =
&lt;br&gt;Persistence.createEntityManagerFactory(getPersistenceUnitName(), props);
&lt;br&gt;&lt;br&gt;In earlier versions of OpenJPA you can use openjpa.ConnectionFactoryName for
&lt;br&gt;jta-data-source and openjpa.ConnectionFactory2Name for non-jta-data-source.
&lt;br&gt;&lt;br&gt;Hope this helps,
&lt;br&gt;-mike
&lt;br&gt;&lt;br&gt;On Sat, Nov 7, 2009 at 2:41 PM, Miłosz Tylenda &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965762&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; My application is a multi-tenant app, I would need to override the
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; datasource
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; at runtime when creating the entitymanager factory based on the client
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; code/name.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Does OpenJPA support that?
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; In a month or two I will be modifying my application to do just this sort
&lt;br&gt;&amp;gt; of
&lt;br&gt;&amp;gt; &amp;gt; thing. I assume by &amp;quot;multi-tenant&amp;quot; you mean someone will login as a user
&lt;br&gt;&amp;gt; &amp;gt; under one of many organizations and the user will then have access to one
&lt;br&gt;&amp;gt; of
&lt;br&gt;&amp;gt; &amp;gt; many persistence units that correspond to the organizations? I have much
&lt;br&gt;&amp;gt; &amp;gt; more to do than selecting the right persistence unit / em factory, but
&lt;br&gt;&amp;gt; I'm
&lt;br&gt;&amp;gt; &amp;gt; interested in whatever you come up with. I hadn't considered that OpenJPA
&lt;br&gt;&amp;gt; &amp;gt; might support it, I figured I'd have to instantiate all the factories
&lt;br&gt;&amp;gt; when
&lt;br&gt;&amp;gt; &amp;gt; the app starts up, then use the URL the user accesses the app with to map
&lt;br&gt;&amp;gt; to
&lt;br&gt;&amp;gt; &amp;gt; the right factory. It actually seems fairly easy, but if OpenJPA supports
&lt;br&gt;&amp;gt; &amp;gt; some mechanism already, all the better.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Have you tried calling Persistence.createEntityManagerFactory(String, Map)?
&lt;br&gt;&amp;gt; The second parameter should allow you to override any value you have set in
&lt;br&gt;&amp;gt; persistence.xml, so in particular, the data source name.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Regards,
&lt;br&gt;&amp;gt; Milosz
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3965762.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3965630"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965630</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T12:41:17Z</published>
	<updated>2009-11-07T12:41:17Z</updated>
	<author>
		<name>Miłosz Tylenda</name>
	</author>
	<content type="html">Hello!
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; My application is a multi-tenant app, I would need to override the
&lt;br&gt;&amp;gt; &amp;gt; datasource
&lt;br&gt;&amp;gt; &amp;gt; at runtime when creating the entitymanager factory based on the client
&lt;br&gt;&amp;gt; &amp;gt; code/name.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Does OpenJPA support that?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; In a month or two I will be modifying my application to do just this sort of
&lt;br&gt;&amp;gt; thing. I assume by &amp;quot;multi-tenant&amp;quot; you mean someone will login as a user
&lt;br&gt;&amp;gt; under one of many organizations and the user will then have access to one of
&lt;br&gt;&amp;gt; many persistence units that correspond to the organizations? I have much
&lt;br&gt;&amp;gt; more to do than selecting the right persistence unit / em factory, but I'm
&lt;br&gt;&amp;gt; interested in whatever you come up with. I hadn't considered that OpenJPA
&lt;br&gt;&amp;gt; might support it, I figured I'd have to instantiate all the factories when
&lt;br&gt;&amp;gt; the app starts up, then use the URL the user accesses the app with to map to
&lt;br&gt;&amp;gt; the right factory. It actually seems fairly easy, but if OpenJPA supports
&lt;br&gt;&amp;gt; some mechanism already, all the better.
&lt;/div&gt;&lt;br&gt;Have you tried calling Persistence.createEntityManagerFactory(String, Map)? The second parameter should allow you to override any value you have set in persistence.xml, so in particular, the data source name.
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Milosz
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3965630.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3965360"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965360</id>
	<title>Re: overriding datasource in the persistent unit</title>
	<published>2009-11-07T11:20:48Z</published>
	<updated>2009-11-07T11:20:48Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Fri, Nov 6, 2009 at 8:10 PM, rtselvan &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965360&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; My application is a multi-tenant app, I would need to override the
&lt;br&gt;&amp;gt; datasource
&lt;br&gt;&amp;gt; at runtime when creating the entitymanager factory based on the client
&lt;br&gt;&amp;gt; code/name.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Does OpenJPA support that?
&lt;br&gt;&lt;br&gt;&lt;br&gt;In a month or two I will be modifying my application to do just this sort of
&lt;br&gt;thing. I assume by &amp;quot;multi-tenant&amp;quot; you mean someone will login as a user
&lt;br&gt;under one of many organizations and the user will then have access to one of
&lt;br&gt;many persistence units that correspond to the organizations? I have much
&lt;br&gt;more to do than selecting the right persistence unit / em factory, but I'm
&lt;br&gt;interested in whatever you come up with. I hadn't considered that OpenJPA
&lt;br&gt;might support it, I figured I'd have to instantiate all the factories when
&lt;br&gt;the app starts up, then use the URL the user accesses the app with to map to
&lt;br&gt;the right factory. It actually seems fairly easy, but if OpenJPA supports
&lt;br&gt;some mechanism already, all the better.
&lt;br&gt;&lt;br&gt;I currently use a static factory with a ThreadLocal entity manager. So I
&lt;br&gt;want my business logic to continue to be able to pick the entity manager
&lt;br&gt;from the current thread. This means I need to set up the ThreadLocal state
&lt;br&gt;at the beginning of the event thread to be able to create an entity manager
&lt;br&gt;from the right factory, presumably by mapping the URL to the factory.
&lt;br&gt;&lt;br&gt;Those are my thoughts thus far.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965360&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3965360.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3962382"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3962382</id>
	<title>overriding datasource in the persistent unit</title>
	<published>2009-11-06T17:10:53Z</published>
	<updated>2009-11-06T17:10:53Z</updated>
	<author>
		<name>rtselvan</name>
	</author>
	<content type="html">My application is a multi-tenant app, I would need to override the datasource at runtime when creating the entitymanager factory based on the client code/name. There would be only one persistent unit but at runtime different database connection to be used.
&lt;br&gt;&lt;br&gt;Does OpenJPA support that? Hibernate supports it and I have tested it successfully but I would like to use OpenJPA due to the light weight nature of it.
&lt;br&gt;&lt;br&gt;Any ideas?
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;/selvan</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/overriding-datasource-in-the-persistent-unit-tp3962382p3962382.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3961317</id>
	<title>ClassCast Exception when doing a merge on a detached object</title>
	<published>2009-11-06T13:06:46Z</published>
	<updated>2009-11-06T13:06:46Z</updated>
	<author>
		<name>vinay.venkat</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;I'm using Open jpa 1.0.1 and webshpere 6.1. I'm running into a unique problem when executing a merge on a detached obect. I have a parent class and two subclasses.
&lt;br&gt;&lt;br&gt;one of subclasses has a couple of one to many relationships as well. 
&lt;br&gt;&lt;br&gt;I do a select on the parent, the actual instance could be any of the subclass. the object is then sent over to the client, the client updates the object and i then merge it back.
&lt;br&gt;&lt;br&gt;I then see this exception 
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;Caused by: java.lang.Exception: java.lang.ClassCastException: parent incompatible with child&lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:242)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.PersistenceException.writeObject(PersistenceException.java:100)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at sun.reflect.GeneratedMethodAccessor475.invoke(Unknown Source)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;the exception happens only when the subclass with the one-to-many relations has to be updated
&lt;br&gt;&lt;br&gt;can anyone tell me why this might be happening? all the classes are versioned on a timestamp
&lt;br&gt;&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;Vinay</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/ClassCast-Exception-when-doing-a-merge-on-a-detached-object-tp3961317p3961317.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3961448</id>
	<title>Re: AW: Nullable column</title>
	<published>2009-11-06T13:29:48Z</published>
	<updated>2009-11-06T13:29:48Z</updated>
	<author>
		<name>Fay Wang</name>
	</author>
	<content type="html">Is your table pre-generated? Can you drop table and add this to your persistence.xml to let openjpa generate the table for you?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;openjpa.jdbc.SynchronizeMappings&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value=&amp;quot;buildSchema&amp;quot; /&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;----- Original Message ----
&lt;br&gt;From: &amp;quot;Scherer, Annette&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &amp;quot;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;Sent: Fri, November 6, 2009 12:19:53 PM
&lt;br&gt;Subject: AW: Nullable column
&lt;br&gt;&lt;br&gt;No, not an Id field 
&lt;br&gt;&lt;br&gt;&lt;br&gt;Annette Scherer
&lt;br&gt;Abteilung Informatik
&lt;br&gt;&lt;br&gt;HUK-COBURG
&lt;br&gt;Bahnhofsplatz
&lt;br&gt;96444 Coburg
&lt;br&gt;Telefon &amp;nbsp;09561 96-1718
&lt;br&gt;Telefax &amp;nbsp;09561 96-3671
&lt;br&gt;E-Mail &amp;nbsp;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;Internet www.HUK.de
&lt;br&gt;=============================================================
&lt;br&gt;HUK-COBURG Haftpflicht-Unterstützungs-Kasse kraftfahrender Beamter Deutschlands a. G. in Coburg
&lt;br&gt;Reg.-Gericht Coburg HRB 100; St.-Nr. 9212/101/00021
&lt;br&gt;Sitz der Gesellschaft: Bahnhofsplatz, 96444 Coburg
&lt;br&gt;Vorsitzender des Aufsichtsrats: Werner Strohmayr.
&lt;br&gt;Vorstand: Dr. Wolfgang Weiler (Sprecher), Wolfgang Flaßhoff, Stefan Gronbach, Klaus-Jürgen Heitmann, Dr. Christian Hofer.
&lt;br&gt;=============================================================
&lt;br&gt;&lt;br&gt;&lt;br&gt;-----Ursprüngliche Nachricht-----
&lt;br&gt;Von: Fay Wang [mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;] 
&lt;br&gt;Gesendet: Freitag, 6. November 2009 21:00
&lt;br&gt;An: &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;Betreff: Re: Nullable column
&lt;br&gt;&lt;br&gt;Hi Annette,
&lt;br&gt;&amp;nbsp; &amp;nbsp;Is the field materialNummer an Id field?
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Fay 
&lt;br&gt;&lt;br&gt;&lt;br&gt;----- Original Message ----
&lt;br&gt;From: &amp;quot;Scherer, Annette&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &amp;quot;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961448&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;Sent: Fri, November 6, 2009 11:26:59 AM
&lt;br&gt;Subject: Nullable column
&lt;br&gt;&lt;br&gt;Hi all,
&lt;br&gt;&lt;br&gt;I annotated a Column like this, hoping to succed in inserting a null value to that column
&lt;br&gt;@Column(nullable=true)
&lt;br&gt;private String materialNummer;
&lt;br&gt;&lt;br&gt;It doesn't work. 
&lt;br&gt;I get the exception below.
&lt;br&gt;What can I do?
&lt;br&gt;&lt;br&gt;&lt;br&gt;thank you for help
&lt;br&gt;Annette
&lt;br&gt;&lt;br&gt;&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; executing prepstmnt 1712481810 SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES
&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 241307234 SELECT SEQUENCE_VALUE FROM T7.OPENJPA_SEQUENCE_TABLE WHERE ID = ? &amp;nbsp;FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 0]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 677128284 UPDATE T7.OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ? AND SEQUENCE_VALUE = ? [params=(long) 174151, (int) 0, (long) 174101]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174101, (String) Toner/Tinte siehe Bemerkungsfeld, (null) null]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174102, (String) Toner, cyan, (String) 20K1400]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;.......
&lt;br&gt;Exception in thread &amp;quot;main&amp;quot; &amp;lt;openjpa-1.2.1-r752877:753278 fatal store error&amp;gt; org.apache.openjpa.persistence.RollbackException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at de.huk.dma.persist.DataPersistorMain.main(DataPersistorMain.java:39)
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 fatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2163)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 1 more
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.SQLCA OUTPUT[Errp=SQLDFMT1, Errd=-2146041828, 28, 0, 0, -957, 0]
&lt;br&gt;Error for batch element #0: DB2 SQL error: SQLCODE: -407, SQLSTATE: 23502, SQLERRMC: TBSPACEID=2, TABLEID=269, COLNO=0
&lt;br&gt;FailedObject: prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4232)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4197)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:503)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:72)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:195)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:63)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:78)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:60)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 8 more
&lt;br&gt;Caused by: com.ibm.db2.jcc.a.dg: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.f.a(f.java:328)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.a(cp.java:2160)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1991)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeBatch(LoggingConnectionDecorator.java:878)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeBatch(JDBCStoreManager.java:1604)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.executeBatch(BatchingPreparedStatementManagerImpl.java:325)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:188)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 13 more
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Nullable-column-tp3960821p3961448.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3961081"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3961081</id>
	<title>AW: Nullable column</title>
	<published>2009-11-06T12:19:53Z</published>
	<updated>2009-11-06T12:19:53Z</updated>
	<author>
		<name>Scherer, Annette</name>
	</author>
	<content type="html">No, not an Id field 
&lt;br&gt;&lt;br&gt;&lt;br&gt;Annette Scherer
&lt;br&gt;Abteilung Informatik
&lt;br&gt;&lt;br&gt;HUK-COBURG
&lt;br&gt;Bahnhofsplatz
&lt;br&gt;96444 Coburg
&lt;br&gt;Telefon &amp;nbsp;09561 96-1718
&lt;br&gt;Telefax &amp;nbsp;09561 96-3671
&lt;br&gt;E-Mail &amp;nbsp; &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961081&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;Internet www.HUK.de
&lt;br&gt;=============================================================
&lt;br&gt;HUK-COBURG Haftpflicht-Unterstützungs-Kasse kraftfahrender Beamter Deutschlands a. G. in Coburg
&lt;br&gt;Reg.-Gericht Coburg HRB 100; St.-Nr. 9212/101/00021
&lt;br&gt;Sitz der Gesellschaft: Bahnhofsplatz, 96444 Coburg
&lt;br&gt;Vorsitzender des Aufsichtsrats: Werner Strohmayr.
&lt;br&gt;Vorstand: Dr. Wolfgang Weiler (Sprecher), Wolfgang Flaßhoff, Stefan Gronbach, Klaus-Jürgen Heitmann, Dr. Christian Hofer.
&lt;br&gt;=============================================================
&lt;br&gt;&lt;br&gt;&lt;br&gt;-----Ursprüngliche Nachricht-----
&lt;br&gt;Von: Fay Wang [mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961081&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;] 
&lt;br&gt;Gesendet: Freitag, 6. November 2009 21:00
&lt;br&gt;An: &lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961081&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;Betreff: Re: Nullable column
&lt;br&gt;&lt;br&gt;Hi Annette,
&lt;br&gt;&amp;nbsp; &amp;nbsp;Is the field materialNummer an Id field?
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Fay 
&lt;br&gt;&lt;br&gt;&lt;br&gt;----- Original Message ----
&lt;br&gt;From: &amp;quot;Scherer, Annette&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961081&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &amp;quot;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961081&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3961081&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;Sent: Fri, November 6, 2009 11:26:59 AM
&lt;br&gt;Subject: Nullable column
&lt;br&gt;&lt;br&gt;Hi all,
&lt;br&gt;&lt;br&gt;I annotated a Column like this, hoping to succed in inserting a null value to that column
&lt;br&gt;@Column(nullable=true)
&lt;br&gt;private String materialNummer;
&lt;br&gt;&lt;br&gt;It doesn't work. 
&lt;br&gt;I get the exception below.
&lt;br&gt;What can I do?
&lt;br&gt;&lt;br&gt;&lt;br&gt;thank you for help
&lt;br&gt;Annette
&lt;br&gt;&lt;br&gt;&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; executing prepstmnt 1712481810 SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES
&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 241307234 SELECT SEQUENCE_VALUE FROM T7.OPENJPA_SEQUENCE_TABLE WHERE ID = ? &amp;nbsp;FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 0]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 677128284 UPDATE T7.OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ? AND SEQUENCE_VALUE = ? [params=(long) 174151, (int) 0, (long) 174101]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174101, (String) Toner/Tinte siehe Bemerkungsfeld, (null) null]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174102, (String) Toner, cyan, (String) 20K1400]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;.......
&lt;br&gt;Exception in thread &amp;quot;main&amp;quot; &amp;lt;openjpa-1.2.1-r752877:753278 fatal store error&amp;gt; org.apache.openjpa.persistence.RollbackException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at de.huk.dma.persist.DataPersistorMain.main(DataPersistorMain.java:39)
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 fatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2163)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 1 more
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.SQLCA OUTPUT[Errp=SQLDFMT1, Errd=-2146041828, 28, 0, 0, -957, 0]
&lt;br&gt;Error for batch element #0: DB2 SQL error: SQLCODE: -407, SQLSTATE: 23502, SQLERRMC: TBSPACEID=2, TABLEID=269, COLNO=0
&lt;br&gt;FailedObject: prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4232)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4197)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:503)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:72)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:195)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:63)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:78)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:60)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 8 more
&lt;br&gt;Caused by: com.ibm.db2.jcc.a.dg: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.f.a(f.java:328)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.a(cp.java:2160)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1991)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeBatch(LoggingConnectionDecorator.java:878)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeBatch(JDBCStoreManager.java:1604)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.executeBatch(BatchingPreparedStatementManagerImpl.java:325)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:188)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 13 more
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Nullable-column-tp3960821p3961081.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3960969"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3960969</id>
	<title>Re: Nullable column</title>
	<published>2009-11-06T12:00:11Z</published>
	<updated>2009-11-06T12:00:11Z</updated>
	<author>
		<name>Fay Wang</name>
	</author>
	<content type="html">Hi Annette,
&lt;br&gt;&amp;nbsp; &amp;nbsp;Is the field materialNummer an Id field?
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Fay 
&lt;br&gt;&lt;br&gt;&lt;br&gt;----- Original Message ----
&lt;br&gt;From: &amp;quot;Scherer, Annette&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3960969&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &amp;quot;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3960969&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;quot; &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3960969&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;Sent: Fri, November 6, 2009 11:26:59 AM
&lt;br&gt;Subject: Nullable column
&lt;br&gt;&lt;br&gt;Hi all,
&lt;br&gt;&lt;br&gt;I annotated a Column like this, hoping to succed in inserting a null value to that column
&lt;br&gt;@Column(nullable=true)
&lt;br&gt;private String materialNummer;
&lt;br&gt;&lt;br&gt;It doesn't work. 
&lt;br&gt;I get the exception below.
&lt;br&gt;What can I do?
&lt;br&gt;&lt;br&gt;&lt;br&gt;thank you for help
&lt;br&gt;Annette
&lt;br&gt;&lt;br&gt;&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; executing prepstmnt 1712481810 SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES
&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 241307234 SELECT SEQUENCE_VALUE FROM T7.OPENJPA_SEQUENCE_TABLE WHERE ID = ? &amp;nbsp;FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 0]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 677128284 UPDATE T7.OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ? AND SEQUENCE_VALUE = ? [params=(long) 174151, (int) 0, (long) 174101]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174101, (String) Toner/Tinte siehe Bemerkungsfeld, (null) null]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174102, (String) Toner, cyan, (String) 20K1400]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;.......
&lt;br&gt;Exception in thread &amp;quot;main&amp;quot; &amp;lt;openjpa-1.2.1-r752877:753278 fatal store error&amp;gt; org.apache.openjpa.persistence.RollbackException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at de.huk.dma.persist.DataPersistorMain.main(DataPersistorMain.java:39)
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 fatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2163)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 1 more
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.SQLCA OUTPUT[Errp=SQLDFMT1, Errd=-2146041828, 28, 0, 0, -957, 0]
&lt;br&gt;Error for batch element #0: DB2 SQL error: SQLCODE: -407, SQLSTATE: 23502, SQLERRMC: TBSPACEID=2, TABLEID=269, COLNO=0
&lt;br&gt;FailedObject: prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4232)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4197)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:503)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:72)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:195)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:63)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:78)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:60)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 8 more
&lt;br&gt;Caused by: com.ibm.db2.jcc.a.dg: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.f.a(f.java:328)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.a(cp.java:2160)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1991)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeBatch(LoggingConnectionDecorator.java:878)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeBatch(JDBCStoreManager.java:1604)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.executeBatch(BatchingPreparedStatementManagerImpl.java:325)
&lt;br&gt;&amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:188)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ... 13 more
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Nullable-column-tp3960821p3960969.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3960821"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3960821</id>
	<title>Nullable column</title>
	<published>2009-11-06T11:26:59Z</published>
	<updated>2009-11-06T11:26:59Z</updated>
	<author>
		<name>Scherer, Annette</name>
	</author>
	<content type="html">Hi all,
&lt;br&gt;&lt;br&gt;I annotated a Column like this, hoping to succed in inserting a null value to that column
&lt;br&gt;@Column(nullable=true)
&lt;br&gt;private String materialNummer;
&lt;br&gt;&lt;br&gt;It doesn't work. 
&lt;br&gt;I get the exception below.
&lt;br&gt;What can I do?
&lt;br&gt;&lt;br&gt;&lt;br&gt;thank you for help
&lt;br&gt;Annette
&lt;br&gt;&lt;br&gt;&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; executing prepstmnt 1712481810 SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES
&lt;br&gt;812 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 243469955&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 241307234 SELECT SEQUENCE_VALUE FROM T7.OPENJPA_SEQUENCE_TABLE WHERE ID = ? &amp;nbsp;FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 0]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; executing prepstmnt 677128284 UPDATE T7.OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ? AND SEQUENCE_VALUE = ? [params=(long) 174151, (int) 0, (long) 174101]
&lt;br&gt;8656 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 2117697081&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174101, (String) Toner/Tinte siehe Bemerkungsfeld, (null) null]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; batching prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [params=(String) 174102, (String) Toner, cyan, (String) 20K1400]
&lt;br&gt;8687 &amp;nbsp;DruckerMaterialAnforderung_DB &amp;nbsp;TRACE &amp;nbsp;[main] openjpa.jdbc.SQL - &amp;lt;t 109577864, conn 1268140950&amp;gt; [0 ms] spent
&lt;br&gt;.......
&lt;br&gt;Exception in thread &amp;quot;main&amp;quot; &amp;lt;openjpa-1.2.1-r752877:753278 fatal store error&amp;gt; org.apache.openjpa.persistence.RollbackException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at de.huk.dma.persist.DataPersistorMain.main(DataPersistorMain.java:39)
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 fatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Das Rollback der Transaktion ist abgeschlossen. Suchen Sie in den verschachtelten Ausnahmen nach Einzelheiten zu den aufgetretenen Fehlern.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2163)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... 1 more
&lt;br&gt;Caused by: &amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt; org.apache.openjpa.persistence.PersistenceException: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.SQLCA OUTPUT[Errp=SQLDFMT1, Errd=-2146041828, 28, 0, 0, -957, 0]
&lt;br&gt;Error for batch element #0: DB2 SQL error: SQLCODE: -407, SQLSTATE: 23502, SQLERRMC: TBSPACEID=2, TABLEID=269, COLNO=0
&lt;br&gt;FailedObject: prepstmnt 294719889 INSERT INTO T7.DRUCK_MATERIAL (id, bezeichner, materialNummer) VALUES (?, ?, ?) [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4232)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4197)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:503)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:72)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:195)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:63)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:78)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:60)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... 8 more
&lt;br&gt;Caused by: com.ibm.db2.jcc.a.dg: Non-atomic batch failure. &amp;nbsp;The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.f.a(f.java:328)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.a(cp.java:2160)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1991)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at com.ibm.db2.jcc.a.cp.executeBatch(cp.java:1010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeBatch(LoggingConnectionDecorator.java:878)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:244)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeBatch(JDBCStoreManager.java:1604)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.executeBatch(BatchingPreparedStatementManagerImpl.java:325)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:188)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... 13 more
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Nullable-column-tp3960821p3960821.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3953515</id>
	<title>Re: left join fetch with long text fields</title>
	<published>2009-11-05T08:59:46Z</published>
	<updated>2009-11-05T08:59:46Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 11:52 AM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953515&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; slow. Is there some way to annotate this field so it is always retrieved in
&lt;br&gt;&amp;gt; the main query? Do I need to put a real limit on it? What would that be?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Setting
&lt;br&gt;length = 1000000000
&lt;br&gt;seems to do the trick (leaving database column as varchar(0)). A billion
&lt;br&gt;characters ought to be enough for my purposes (if JPA does any checking),
&lt;br&gt;but I still wonder if there's a better way.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953515&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/left-join-fetch-with-long-text-fields-tp3953449p3953515.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3953449"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3953449</id>
	<title>left join fetch with long text fields</title>
	<published>2009-11-05T08:52:15Z</published>
	<updated>2009-11-05T08:52:15Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I have entity B with field &amp;quot;myLongText&amp;quot; defined like so:
&lt;br&gt;&lt;br&gt;@Column(name = &amp;quot;mylongtext&amp;quot;, length = -1)
&lt;br&gt;private String myLongText;
&lt;br&gt;&lt;br&gt;In PostgreSQL the column is a varchar(0).
&lt;br&gt;&lt;br&gt;When I retrieve a list of B entities, I get myLongText as expected, selected
&lt;br&gt;in one query. Suppose I have entity A with bCol, a collection of B. If I
&lt;br&gt;select like so:
&lt;br&gt;&lt;br&gt;select distinct o from A as o
&lt;br&gt;left join fetch o.bCol
&lt;br&gt;&lt;br&gt;the value of myLongText is retrieved with an individual query PER B
&lt;br&gt;instance! Naturally this is pretty slow. Is there some way to annotate this
&lt;br&gt;field so it is always retrieved in the main query? Do I need to put a real
&lt;br&gt;limit on it? What would that be?
&lt;br&gt;&lt;br&gt;I think somebody explored this problem recently but I can't remember any key
&lt;br&gt;words from the discussion to search on.
&lt;br&gt;&lt;br&gt;Thanks.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953449&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/left-join-fetch-with-long-text-fields-tp3953449p3953449.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3950657</id>
	<title>MappingTool ignores FK constraints during DELETE</title>
	<published>2009-11-04T23:26:01Z</published>
	<updated>2009-11-04T23:26:01Z</updated>
	<author>
		<name>Dinkar Rao</name>
	</author>
	<content type="html">Hi Folks,
&lt;br&gt;&lt;br&gt;I run MappingTool with &amp;quot;-schemaAction deleteTableContents&amp;quot;, and it looks like OpenJPA issues DELETE statements in alphabetical order of entities. In my application, a DELETE for the parent table is issued before the DELETE for the dependent table can be issued. Both tables are populated, and the parent table DELETE fails because of the default ON DELETE NO ACTION constraint.
&lt;br&gt;&lt;br&gt;Is there a way to tell MappingTool to order its deletes taking into account the RI dependency chain ? 
&lt;br&gt;&lt;br&gt;(I could set the MappingDefaults property's ForeignKeyDeleteAction option to 'cascade', so OpenJPA will alter tables for ON DELETE CASCADE, but I am hoping MappingTool can be made to work). 
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Dinkar</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/MappingTool-ignores-FK-constraints-during-DELETE-tp3950657p3950657.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3965842</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-07T13:59:00Z</published>
	<updated>2009-11-07T13:59:00Z</updated>
	<author>
		<name>Michael Dick</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 1:27 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965842&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Nov 5, 2009 at 1:48 PM, Michael Dick &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965842&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt;wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; On Thu, Nov 5, 2009 at 12:17 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965842&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; I think I misunderstood your point (I thought the FETCH was implied).
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think I asked a new question, not necessarily based on your previous
&lt;br&gt;&amp;gt; input, so I don't think you misunderstood anything, I just changed the line
&lt;br&gt;&amp;gt; of questioning on you. :-)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Adding in the fetch clause:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; A JOIN FETCH differs from a JOIN in two ways :
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;* You will get one reference to the entity on the left side of the JOIN
&lt;br&gt;&amp;gt; &amp;gt; for every related entity on the right side of the JOIN.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This I misunderstood long ago before our discussion - I didn't
&lt;br&gt;&amp;gt; misunderstand
&lt;br&gt;&amp;gt; what you were saying about it. I don't think. Anyway.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;* The relationship on the right side of the JOIN will be eagerly loaded.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is what I'm having trouble with. If a JOIN would return the children,
&lt;br&gt;&amp;gt; isn't it implied that they are eagerly loaded? What exactly does eagerly
&lt;br&gt;&amp;gt; loaded mean in this case? Picture this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; select a, bCol.b from A as a
&lt;br&gt;&amp;gt; join a.bCol as bCol
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; compared to this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; select a from A as a
&lt;br&gt;&amp;gt; join fetch a.bCol
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; They both return all the child B entities (same number of &amp;quot;rows&amp;quot;) but the
&lt;br&gt;&amp;gt; second puts the B's into the appropriate a.bCol collection. In both cases,
&lt;br&gt;&amp;gt; B's are being loaded. Is it the bCol collection you are referring to as
&lt;br&gt;&amp;gt; being eagerly loaded? Sorry if I'm putting too fine a point on this, just
&lt;br&gt;&amp;gt; trying to cement it all in my brain.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;In the join fetch case the eager loading is a side effect of the query, the
&lt;br&gt;entities on the right hand side are not part of the query results.
&lt;br&gt;&lt;br&gt;Another difference is that with a join fetch you can't set an identification
&lt;br&gt;variable for the entities on the right hand side.
&lt;br&gt;For example :
&lt;br&gt;&amp;quot;select a from A join fetch a.bCol b&amp;quot; would throw an exception.
&lt;br&gt;&lt;br&gt;Having multiple references to the same entity from the left side of the
&lt;br&gt;query is a side effect of this loading as far as I can tell.
&lt;br&gt;&lt;br&gt;I can't claim to be an expert here, I'm learning as I go. A lot of how we
&lt;br&gt;handle joins seems a bit odd to me. Sorry if this isn't terribly
&lt;br&gt;enlightening. The best reference I can give you is section 4.4.5 of the JPA
&lt;br&gt;1.0 specification. Mike Keith's Pro EJB3 book is also a good place to look.
&lt;br&gt;&lt;br&gt;-mike
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;&amp;gt; Daryl Stultz
&lt;br&gt;&amp;gt; _____________________________________
&lt;br&gt;&amp;gt; 6 Degrees Software and Consulting, Inc.
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;&amp;gt; mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3965842&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3965842.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3954486"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3954486</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-05T11:27:23Z</published>
	<updated>2009-11-05T11:27:23Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 1:48 PM, Michael Dick &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954486&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; On Thu, Nov 5, 2009 at 12:17 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954486&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think I misunderstood your point (I thought the FETCH was implied).
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;I think I asked a new question, not necessarily based on your previous
&lt;br&gt;input, so I don't think you misunderstood anything, I just changed the line
&lt;br&gt;of questioning on you. :-)
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Adding in the fetch clause:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; A JOIN FETCH differs from a JOIN in two ways :
&lt;br&gt;&amp;gt; &amp;nbsp;* You will get one reference to the entity on the left side of the JOIN
&lt;br&gt;&amp;gt; for every related entity on the right side of the JOIN.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;This I misunderstood long ago before our discussion - I didn't misunderstand
&lt;br&gt;what you were saying about it. I don't think. Anyway.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp;* The relationship on the right side of the JOIN will be eagerly loaded.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;This is what I'm having trouble with. If a JOIN would return the children,
&lt;br&gt;isn't it implied that they are eagerly loaded? What exactly does eagerly
&lt;br&gt;loaded mean in this case? Picture this:
&lt;br&gt;&lt;br&gt;select a, bCol.b from A as a
&lt;br&gt;join a.bCol as bCol
&lt;br&gt;&lt;br&gt;compared to this:
&lt;br&gt;&lt;br&gt;select a from A as a
&lt;br&gt;join fetch a.bCol
&lt;br&gt;&lt;br&gt;They both return all the child B entities (same number of &amp;quot;rows&amp;quot;) but the
&lt;br&gt;second puts the B's into the appropriate a.bCol collection. In both cases,
&lt;br&gt;B's are being loaded. Is it the bCol collection you are referring to as
&lt;br&gt;being eagerly loaded? Sorry if I'm putting too fine a point on this, just
&lt;br&gt;trying to cement it all in my brain.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954486&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3954486.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3954252"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3954252</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-05T10:48:40Z</published>
	<updated>2009-11-05T10:48:40Z</updated>
	<author>
		<name>Michael Dick</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 12:17 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954252&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Nov 5, 2009 at 12:52 PM, Michael Dick &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954252&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt;wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Can you give the 1.2.x patch attached to OPENJPA-894 a try? There are
&lt;br&gt;&amp;gt; some
&lt;br&gt;&amp;gt; &amp;gt; limitations with the approach I took (ie if Large Result Sets are used),
&lt;br&gt;&amp;gt; &amp;gt; but
&lt;br&gt;&amp;gt; &amp;gt; it'd be nice to know whether it works for you.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm pretty strapped for time, but I'll try to squeeze it in.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; LEFT JOINS should behave the same way..
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I was originally under the impression that JOIN FETCH was somehow different
&lt;br&gt;&amp;gt; from a JOIN from an SQL/DB perspective, perhaps because of the bug. If the
&lt;br&gt;&amp;gt; duplicates were returned, exactly how is JOIN different than JOIN FETCH?
&lt;br&gt;&amp;gt; The
&lt;br&gt;&amp;gt; latter returns the parent duplicated for each child along with each child
&lt;br&gt;&amp;gt; AND populates each parent with the set of children? What is the difference
&lt;br&gt;&amp;gt; between
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; select o from A as o
&lt;br&gt;&amp;gt; join o.bCol as bCol
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; and
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; select o from A as o
&lt;br&gt;&amp;gt; join fetch o.bCol
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; assuming duplicate bug is fixed?
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;I think I misunderstood your point (I thought the FETCH was implied).
&lt;br&gt;&lt;br&gt;A LEFT JOIN FETCH and a JOIN FETCH differ in that the LEFT JOIN FETCH is
&lt;br&gt;more inclusive (ie you don't have to have a relation to the right side).
&lt;br&gt;&lt;br&gt;The same applies to a LEFT JOIN and a JOIN (no fetch).
&lt;br&gt;&lt;br&gt;Adding in the fetch clause:
&lt;br&gt;&lt;br&gt;A JOIN FETCH differs from a JOIN in two ways :
&lt;br&gt;&amp;nbsp; * You will get one reference to the entity on the left side of the JOIN
&lt;br&gt;for every related entity on the right side of the JOIN.
&lt;br&gt;&amp;nbsp; * The relationship on the right side of the JOIN will be eagerly loaded.
&lt;br&gt;&lt;br&gt;LEFT JOIN FETCH and LEFT JOIN follow the same rules (but again the LEFT part
&lt;br&gt;makes the results more inclusive).
&lt;br&gt;&lt;br&gt;Sorry for the confusion, I thought you were asking about the difference
&lt;br&gt;between a JOIN FETCH and a LEFT JOIN FETCH. Not between a JOIN and a JOIN
&lt;br&gt;FETCH.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; &amp;gt; In OpenJPA 1.2.1 if you want the duplicate references in your result list
&lt;br&gt;&amp;gt; &amp;gt; then you're mostly out of luck.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Fortunately I don't. But I don't want them to show up later because I
&lt;br&gt;&amp;gt; forgot
&lt;br&gt;&amp;gt; the &amp;quot;DISTINCT&amp;quot; keyword...
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;gt; One ugly way to get them is to run the query
&lt;br&gt;&amp;gt; &amp;gt; twice (the second time we operate in memory and return the correct
&lt;br&gt;&amp;gt; &amp;gt; results).
&lt;br&gt;&amp;gt; &amp;gt; If you don't want duplicate references then I _think_ it works out of the
&lt;br&gt;&amp;gt; &amp;gt; box (until you run the query in memory . . .).
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Meaning without the DISTINCT keyword? I should not get the duplicates now
&lt;br&gt;&amp;gt; or
&lt;br&gt;&amp;gt; in the future (after bugs fixed) if I include DISTINCT, right (assuming
&lt;br&gt;&amp;gt; simple &amp;quot;select distinct o from A as o left join fetch o.bCol&amp;quot;)?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;Correct. Distinct should prevent duplicates now and in the future.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp;--
&lt;br&gt;&amp;gt; Daryl Stultz
&lt;br&gt;&amp;gt; _____________________________________
&lt;br&gt;&amp;gt; 6 Degrees Software and Consulting, Inc.
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;&amp;gt; mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954252&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3954252.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3954068"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3954068</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-05T10:17:27Z</published>
	<updated>2009-11-05T10:17:27Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 12:52 PM, Michael Dick &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954068&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Can you give the 1.2.x patch attached to OPENJPA-894 a try? There are some
&lt;br&gt;&amp;gt; limitations with the approach I took (ie if Large Result Sets are used),
&lt;br&gt;&amp;gt; but
&lt;br&gt;&amp;gt; it'd be nice to know whether it works for you.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;I'm pretty strapped for time, but I'll try to squeeze it in.
&lt;br&gt;&lt;br&gt;LEFT JOINS should behave the same way..
&lt;br&gt;&lt;br&gt;&lt;br&gt;I was originally under the impression that JOIN FETCH was somehow different
&lt;br&gt;from a JOIN from an SQL/DB perspective, perhaps because of the bug. If the
&lt;br&gt;duplicates were returned, exactly how is JOIN different than JOIN FETCH? The
&lt;br&gt;latter returns the parent duplicated for each child along with each child
&lt;br&gt;AND populates each parent with the set of children? What is the difference
&lt;br&gt;between
&lt;br&gt;&lt;br&gt;select o from A as o
&lt;br&gt;join o.bCol as bCol
&lt;br&gt;&lt;br&gt;and
&lt;br&gt;&lt;br&gt;select o from A as o
&lt;br&gt;join fetch o.bCol
&lt;br&gt;&lt;br&gt;assuming duplicate bug is fixed?
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; In OpenJPA 1.2.1 if you want the duplicate references in your result list
&lt;br&gt;&amp;gt; then you're mostly out of luck.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Fortunately I don't. But I don't want them to show up later because I forgot
&lt;br&gt;the &amp;quot;DISTINCT&amp;quot; keyword...
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; One ugly way to get them is to run the query
&lt;br&gt;&amp;gt; twice (the second time we operate in memory and return the correct
&lt;br&gt;&amp;gt; results).
&lt;br&gt;&amp;gt; If you don't want duplicate references then I _think_ it works out of the
&lt;br&gt;&amp;gt; box (until you run the query in memory . . .).
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;Meaning without the DISTINCT keyword? I should not get the duplicates now or
&lt;br&gt;in the future (after bugs fixed) if I include DISTINCT, right (assuming
&lt;br&gt;simple &amp;quot;select distinct o from A as o left join fetch o.bCol&amp;quot;)?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3954068&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3954068.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3953879"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3953879</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-05T09:52:24Z</published>
	<updated>2009-11-05T09:52:24Z</updated>
	<author>
		<name>Michael Dick</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 10:26 AM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953879&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Nov 5, 2009 at 11:10 AM, Michael Dick &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953879&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt;wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; A JOIN FETCH will eagerly load the collection for you, but should return
&lt;br&gt;&amp;gt; &amp;gt; one reference to the entity for each element in the collection. I'm
&lt;br&gt;&amp;gt; &amp;gt; working on fixing this under OPENJPA-894 (proceeding slowly though).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yes, I discovered this bug a month or so ago which led me to change my
&lt;br&gt;&amp;gt; approach for using fetch joins to modifying the fetch plan on the query.
&lt;br&gt;&amp;gt; Now
&lt;br&gt;&amp;gt; I've run into this other problem.
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;I was afraid of that. I haven't kept up with the mailing lists as well as
&lt;br&gt;I'd like to. In any event you are hitting a bug in FetchPlans.. Just thought
&lt;br&gt;I'd throw out the vendor agnostic solution in case you hadn't seen it.
&lt;br&gt;&lt;br&gt;Can you give the 1.2.x patch attached to OPENJPA-894 a try? There are some
&lt;br&gt;limitations with the approach I took (ie if Large Result Sets are used), but
&lt;br&gt;it'd be nice to know whether it works for you.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; When it's all working you could use a query like this :
&lt;br&gt;&amp;gt; &amp;gt; Query q = em.createQuery(&amp;quot;SELECT DISTINCT o from A as o JOIN FETCH
&lt;br&gt;&amp;gt; &amp;gt; o.bCol&amp;quot;);
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; So this doesn't work now? (Or is it simply that DISTINCT is not required on
&lt;br&gt;&amp;gt; first pass due to the bug?)
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;The latter. DISTINCT is not required due to the bug.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; Should LEFT JOIN FETCH work the same way?
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;LEFT JOINS should behave the same way.. The only difference is that it will
&lt;br&gt;return entities from the LEFT side which do not 'match' any entities on the
&lt;br&gt;RIGHT side..
&lt;br&gt;&lt;br&gt;ie
&lt;br&gt;&amp;nbsp; &amp;nbsp; SELECT m from Manager m LEFT JOIN FETCH m.employees
&lt;br&gt;includes Managers with no employee.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; SELECT m from Manager m JOIN FETCH m.employees
&lt;br&gt;only returns Managers which have a an employee in the employees collection..
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; I've experienced 894 directly but I don't fully understand 1365. If I have
&lt;br&gt;&amp;gt; OpenJPA 1.2.1, what are my options?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;OPENJPA-1365 is a change in the way we handle distinct results. Previously
&lt;br&gt;we just added in the DISTINCT keyword to the SQL statement and relied on
&lt;br&gt;that to return the correct results. This doesn't work if DISTINCT is applied
&lt;br&gt;to multiple tables.
&lt;br&gt;&lt;br&gt;The best example is buried in a longish email I wrote to the dev mailing
&lt;br&gt;list :
&lt;br&gt;&lt;a href=&quot;http://n2.nabble.com/How-should-we-handle-the-JPQL-DISTINCT-keyword-td3908400.html#a3908400&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://n2.nabble.com/How-should-we-handle-the-JPQL-DISTINCT-keyword-td3908400.html#a3908400&lt;/a&gt;&lt;br&gt;&lt;br&gt;In OpenJPA 1.2.1 if you want the duplicate references in your result list
&lt;br&gt;then you're mostly out of luck. One ugly way to get them is to run the query
&lt;br&gt;twice (the second time we operate in memory and return the correct results).
&lt;br&gt;If you don't want duplicate references then I _think_ it works out of the
&lt;br&gt;box (until you run the query in memory . . .).
&lt;br&gt;&lt;br&gt;-mike
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Daryl Stultz
&lt;br&gt;&amp;gt; _____________________________________
&lt;br&gt;&amp;gt; 6 Degrees Software and Consulting, Inc.
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;&amp;gt; mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953879&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3953879.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3953249"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3953249</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-05T08:26:30Z</published>
	<updated>2009-11-05T08:26:30Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Thu, Nov 5, 2009 at 11:10 AM, Michael Dick &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953249&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt;wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; A JOIN FETCH will eagerly load the collection for you, but should return
&lt;br&gt;&amp;gt; one reference to the entity for each element in the collection. I'm
&lt;br&gt;&amp;gt; working on fixing this under OPENJPA-894 (proceeding slowly though).
&lt;br&gt;&lt;br&gt;&lt;br&gt;Yes, I discovered this bug a month or so ago which led me to change my
&lt;br&gt;approach for using fetch joins to modifying the fetch plan on the query. Now
&lt;br&gt;I've run into this other problem.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; When it's all working you could use a query like this :
&lt;br&gt;&amp;gt; Query q = em.createQuery(&amp;quot;SELECT DISTINCT o from A as o JOIN FETCH
&lt;br&gt;&amp;gt; o.bCol&amp;quot;);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;So this doesn't work now? (Or is it simply that DISTINCT is not required on
&lt;br&gt;first pass due to the bug?)
&lt;br&gt;Should LEFT JOIN FETCH work the same way?
&lt;br&gt;&lt;br&gt;I've experienced 894 directly but I don't fully understand 1365. If I have
&lt;br&gt;OpenJPA 1.2.1, what are my options?
&lt;br&gt;&lt;br&gt;Thanks.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953249&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3953249.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3953139"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3953139</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-05T08:10:11Z</published>
	<updated>2009-11-05T08:10:11Z</updated>
	<author>
		<name>Michael Dick</name>
	</author>
	<content type="html">Hi Daryl,
&lt;br&gt;&lt;br&gt;A JOIN FETCH will eagerly load the collection for you, but should return one
&lt;br&gt;reference to the entity for each element in the collection. I'm working on
&lt;br&gt;fixing this under OPENJPA-894 (proceeding slowly though).
&lt;br&gt;&lt;br&gt;Adding a distinct clause will filter out these duplicates (but there are
&lt;br&gt;issues there as well : OPENJPA-1365).
&lt;br&gt;&lt;br&gt;When it's all working you could use a query like this :
&lt;br&gt;Query q = em.createQuery(&amp;quot;SELECT DISTINCT o from A as o JOIN FETCH o.bCol&amp;quot;);
&lt;br&gt;&lt;br&gt;If your goal is to selectively eagerly load a collection I believe this is
&lt;br&gt;the vendor agnostic syntax you want..
&lt;br&gt;&lt;br&gt;Hope this helps,
&lt;br&gt;&lt;br&gt;-mike
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Wed, Nov 4, 2009 at 7:48 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953139&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Wed, Nov 4, 2009 at 4:07 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953139&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Hello,
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; I'm wondering if anyone has seen something like this:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; org.apache.openjpa.persistence.PersistenceException: 5
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I've run into this on 2 occasions with different fields in one entity. I
&lt;br&gt;&amp;gt; can
&lt;br&gt;&amp;gt; get around it in both cases by changing a fetch from EAGER to LAZY. So I
&lt;br&gt;&amp;gt; have the entity A which has a collection of B which is set to LAZY. B has a
&lt;br&gt;&amp;gt; field C that is set to EAGER. I retrieve like this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; query = em.createQuery(&amp;quot;select o from A as o&amp;quot;);
&lt;br&gt;&amp;gt; ((QueryImpl) query).getFetchPlan().addField(A.class, &amp;quot;bCol&amp;quot;); // bCol is
&lt;br&gt;&amp;gt; collection of B
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The field B.c is defined like so
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; @ManyToOne(fetch = FetchType.EAGER, optional = false)
&lt;br&gt;&amp;gt; @JoinColumn(name = &amp;quot;cid&amp;quot;, nullable = false)
&lt;br&gt;&amp;gt; @ForeignKey
&lt;br&gt;&amp;gt; private C c;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This has also happened on another field of B that is nullable/optional.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Right now the only way for me to feel the system is secure is to change
&lt;br&gt;&amp;gt; everything to LAZY and put fetchPlan addFields all over. Please tell me I
&lt;br&gt;&amp;gt; don't have to do that!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Daryl Stultz
&lt;br&gt;&amp;gt; _____________________________________
&lt;br&gt;&amp;gt; 6 Degrees Software and Consulting, Inc.
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;&amp;gt; mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3953139&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3953139.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3949650"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3949650</id>
	<title>Re: Eager fetch leads to out of bounds error</title>
	<published>2009-11-04T17:48:57Z</published>
	<updated>2009-11-04T17:48:57Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">On Wed, Nov 4, 2009 at 4:07 PM, Daryl Stultz &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3949650&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm wondering if anyone has seen something like this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt;
&lt;br&gt;&amp;gt; org.apache.openjpa.persistence.PersistenceException: 5
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;I've run into this on 2 occasions with different fields in one entity. I can
&lt;br&gt;get around it in both cases by changing a fetch from EAGER to LAZY. So I
&lt;br&gt;have the entity A which has a collection of B which is set to LAZY. B has a
&lt;br&gt;field C that is set to EAGER. I retrieve like this:
&lt;br&gt;&lt;br&gt;query = em.createQuery(&amp;quot;select o from A as o&amp;quot;);
&lt;br&gt;((QueryImpl) query).getFetchPlan().addField(A.class, &amp;quot;bCol&amp;quot;); // bCol is
&lt;br&gt;collection of B
&lt;br&gt;&lt;br&gt;The field B.c is defined like so
&lt;br&gt;&lt;br&gt;@ManyToOne(fetch = FetchType.EAGER, optional = false)
&lt;br&gt;@JoinColumn(name = &amp;quot;cid&amp;quot;, nullable = false)
&lt;br&gt;@ForeignKey
&lt;br&gt;private C c;
&lt;br&gt;&lt;br&gt;This has also happened on another field of B that is nullable/optional.
&lt;br&gt;&lt;br&gt;Right now the only way for me to feel the system is secure is to change
&lt;br&gt;everything to LAZY and put fetchPlan addFields all over. Please tell me I
&lt;br&gt;don't have to do that!
&lt;br&gt;&lt;br&gt;Thanks.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3949650&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3949650.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3948197"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3948197</id>
	<title>Eager fetch leads to out of bounds error</title>
	<published>2009-11-04T13:07:05Z</published>
	<updated>2009-11-04T13:07:05Z</updated>
	<author>
		<name>Daryl Stultz</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I'm wondering if anyone has seen something like this:
&lt;br&gt;&lt;br&gt;&amp;lt;openjpa-1.2.1-r752877:753278 nonfatal general error&amp;gt;
&lt;br&gt;org.apache.openjpa.persistence.PersistenceException: 5
&lt;br&gt;at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:875)
&lt;br&gt;at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:774)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:982)
&lt;br&gt;at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:278)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2400)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.loadEagerJoin(RelationFieldStrategy.java:541)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.jdbc.meta.FieldMapping.loadEagerJoin(FieldMapping.java:807)
&lt;br&gt;...snip
&lt;br&gt;Caused by: java.lang.ArrayIndexOutOfBoundsException: 5
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.meta.ClassMetaData.getExtraFieldDataIndex(ClassMetaData.java:859)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:358)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
&lt;br&gt;at
&lt;br&gt;org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
&lt;br&gt;at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:894)
&lt;br&gt;at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:852)
&lt;br&gt;... 78 more
&lt;br&gt;&lt;br&gt;I'm running a query thathas a particular field added to the fetch group for
&lt;br&gt;the query, something like this:
&lt;br&gt;&lt;br&gt;((QueryImpl) query).getFetchPlan().addField(A.class, &amp;quot;funkyField&amp;quot;);
&lt;br&gt;&lt;br&gt;There error doesn't happen with all data sets and it doesn't happen with
&lt;br&gt;other fields on the same query/class. Anyone have any clue? What is the
&lt;br&gt;significance of the &amp;quot;5&amp;quot;? Can I use that as the index of field names into a
&lt;br&gt;class or something?
&lt;br&gt;&lt;br&gt;Is there a better way to prefetch fields? (In this case a collection). Is
&lt;br&gt;there a JPA (i.e. non-OpenJPA-specific) way to prefetch collections? Perhaps
&lt;br&gt;I just have a major misunderstanding of fetching again.
&lt;br&gt;&lt;br&gt;Thanks.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daryl Stultz
&lt;br&gt;_____________________________________
&lt;br&gt;6 Degrees Software and Consulting, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.6degrees.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.6degrees.com&lt;/a&gt;&lt;br&gt;mailto:&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3948197&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Eager-fetch-leads-to-out-of-bounds-error-tp3948197p3948197.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3937521</id>
	<title>Rollback - Transaction issue</title>
	<published>2009-11-03T02:06:43Z</published>
	<updated>2009-11-03T02:06:43Z</updated>
	<author>
		<name>Udi</name>
	</author>
	<content type="html">Hey,
&lt;br&gt;Is there any way to &amp;quot;replay&amp;quot; transaction?
&lt;br&gt;I mean, sometimes I get RollbackException and rollback the transaction. Can I then &amp;quot;clone&amp;quot; the transaction and try again, or once rollback is called, transaction is lost?
&lt;br&gt;I really need the changes, and really don't want to trace every change for rerunning later...
&lt;br&gt;&lt;br&gt;thanks,
&lt;br&gt;udi</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Rollback-Transaction-issue-tp3937521p3937521.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3943118</id>
	<title>Re: Query not getting evicted from QueryCache</title>
	<published>2009-11-03T20:23:24Z</published>
	<updated>2009-11-03T20:23:24Z</updated>
	<author>
		<name>Jeff Awe</name>
	</author>
	<content type="html">Catalina,
&lt;br&gt;&lt;br&gt;1. &amp;nbsp;This is how I enabled DataCache and QueryCache:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;openjpa.QueryCache&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;openjpa.DataCache&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;
&lt;br&gt;2. &amp;nbsp;The same application that updates RelationshipInfo also issues the
&lt;br&gt;query.
&lt;br&gt;3. &amp;nbsp;This is how the Query is created:
&lt;br&gt;&lt;br&gt;Query query = entityManager.createQuery(queryStmt);
&lt;br&gt;&lt;br&gt;Here is the stacktrace:
&lt;br&gt;&lt;br&gt;org.apache.openjpa.kernel.QueryImpl.&amp;lt;init&amp;gt;(org.apache.openjpa.kernel.Broker,
&lt;br&gt;java.lang.String, org.apache.openjpa.kernel.StoreQuery) line: 132
&lt;br&gt;org.apache.openjpa.kernel.FinalizingBrokerImpl(org.apache.openjpa.kernel.BrokerImpl).newQueryImpl(java.lang.String,
&lt;br&gt;org.apache.openjpa.kernel.StoreQuery) line: 3519
&lt;br&gt;org.apache.openjpa.kernel.FinalizingBrokerImpl(org.apache.openjpa.kernel.BrokerImpl).newQuery(java.lang.String,
&lt;br&gt;java.lang.Object) line: 3496
&lt;br&gt;org.apache.openjpa.kernel.DelegatingBroker.newQuery(java.lang.String,
&lt;br&gt;java.lang.Object) line: 1225
&lt;br&gt;org.apache.openjpa.persistence.EntityManagerImpl.createQuery(java.lang.String,
&lt;br&gt;java.lang.String) line: 870
&lt;br&gt;org.apache.openjpa.persistence.EntityManagerImpl.createQuery(java.lang.String)
&lt;br&gt;line: 865
&lt;br&gt;org.apache.openjpa.persistence.EntityManagerImpl.createQuery(java.lang.String)
&lt;br&gt;line: 1
&lt;br&gt;&lt;br&gt;queryStmt =
&lt;br&gt;&amp;quot;SELECT distinct
&lt;br&gt;OPERATINGSYSTEM1.OID,OPERATINGSYSTEM1.Guid,OPERATINGSYSTEM1.ObjectType,OPERATINGSYSTEM1.Name,REMOTESERVICEACCESSPOINT1.OID,REMOTESERVICEACCESSPOINT1.Guid,REMOTESERVICEACCESSPOINT1.ObjectType,REMOTESERVICEACCESSPOINT1.Name
&lt;br&gt;FROM OperatingSystem
&lt;br&gt;OPERATINGSYSTEM1,System_accessedVia_RemoteServiceAccessPoint
&lt;br&gt;SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1,RemoteServiceAccessPoint
&lt;br&gt;REMOTESERVICEACCESSPOINT1,RelationshipInfo RELATIONSHIPINFO1 WHERE
&lt;br&gt;OPERATINGSYSTEM1.OID = SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.sourceId
&lt;br&gt;AND REMOTESERVICEACCESSPOINT1.OID =
&lt;br&gt;SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.targetId AND
&lt;br&gt;(OPERATINGSYSTEM1.Guid = ?1) AND (OPERATINGSYSTEM1.OID = ?2) AND
&lt;br&gt;((OPERATINGSYSTEM1.BuildNumber = ?3)) AND (REMOTESERVICEACCESSPOINT1.Guid =
&lt;br&gt;?4) AND (REMOTESERVICEACCESSPOINT1.OID = ?5) AND
&lt;br&gt;((REMOTESERVICEACCESSPOINT1.Port = ?6)) AND RELATIONSHIPINFO1.changedDate &amp;gt;
&lt;br&gt;?7 and RELATIONSHIPINFO1.sourceOID=OPERATINGSYSTEM1.OID and
&lt;br&gt;RELATIONSHIPINFO1.relationshipType = ?8 and
&lt;br&gt;RELATIONSHIPINFO1.targetOID=REMOTESERVICEACCESSPOINT1.OID&amp;quot;
&lt;br&gt;&lt;br&gt;Then parameters are set on the Query after it is created.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Jeff
&lt;br&gt;&lt;br&gt;On Mon, Nov 2, 2009 at 2:01 PM, catalina wei &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3943118&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Jeff,
&lt;br&gt;&amp;gt; Could you provide more info :
&lt;br&gt;&amp;gt; 1. in persistence.xml, show us how you enable DataCache and QueryCache.
&lt;br&gt;&amp;gt; 2. the updates to RelationshipInfo, is that done by the same application
&lt;br&gt;&amp;gt; that issued the query ? or some other application ?
&lt;br&gt;&amp;gt; 3. Could you show the code fragment that issues em.createQuery ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt; Catalina
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Mon, Nov 2, 2009 at 10:15 AM, Jeff Awe &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3943118&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; I'm running on OpenJPA 1.2.1
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; The following query is added to the QueryCache:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Query: org.apache.openjpa.kernel.QueryImpl@3afe3afe;
&lt;br&gt;&amp;gt; &amp;gt; candidate class: class com.ibm.usmi.datamodel.system.OperatingSystem;
&lt;br&gt;&amp;gt; &amp;gt; query: SELECT distinct
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; OPERATINGSYSTEM1.OID,OPERATINGSYSTEM1.Guid,OPERATINGSYSTEM1.ObjectType,OPERATINGSYSTEM1.Name,REMOTESERVICEACCESSPOINT1.OID,REMOTESERVICEACCESSPOINT1.Guid,REMOTESERVICEACCESSPOINT1.ObjectType,REMOTESERVICEACCESSPOINT1.Name
&lt;br&gt;&amp;gt; &amp;gt; FROM OperatingSystem
&lt;br&gt;&amp;gt; &amp;gt; OPERATINGSYSTEM1,System_accessedVia_RemoteServiceAccessPoint
&lt;br&gt;&amp;gt; &amp;gt; SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1,RemoteServiceAccessPoint
&lt;br&gt;&amp;gt; &amp;gt; REMOTESERVICEACCESSPOINT1,RelationshipInfo RELATIONSHIPINFO1 WHERE
&lt;br&gt;&amp;gt; &amp;gt; OPERATINGSYSTEM1.OID =
&lt;br&gt;&amp;gt; &amp;gt; SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.sourceId
&lt;br&gt;&amp;gt; &amp;gt; AND REMOTESERVICEACCESSPOINT1.OID =
&lt;br&gt;&amp;gt; &amp;gt; SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.targetId AND
&lt;br&gt;&amp;gt; &amp;gt; (OPERATINGSYSTEM1.Guid = ?1) AND (OPERATINGSYSTEM1.OID = ?2) AND
&lt;br&gt;&amp;gt; &amp;gt; ((OPERATINGSYSTEM1.BuildNumber = ?3)) AND (REMOTESERVICEACCESSPOINT1.Guid
&lt;br&gt;&amp;gt; =
&lt;br&gt;&amp;gt; &amp;gt; ?4) AND (REMOTESERVICEACCESSPOINT1.OID = ?5) AND
&lt;br&gt;&amp;gt; &amp;gt; ((REMOTESERVICEACCESSPOINT1.Port = ?6)) AND RELATIONSHIPINFO1.changedDate
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; ?7 and RELATIONSHIPINFO1.sourceOID=OPERATINGSYSTEM1.OID and
&lt;br&gt;&amp;gt; &amp;gt; RELATIONSHIPINFO1.relationshipType = ?8 and
&lt;br&gt;&amp;gt; &amp;gt; RELATIONSHIPINFO1.targetOID=REMOTESERVICEACCESSPOINT1.OID
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Later on, a record in RelationshipInfo is changed, which changes what
&lt;br&gt;&amp;gt; &amp;gt; should
&lt;br&gt;&amp;gt; &amp;gt; be returned from this query. &amp;nbsp;I'd expect this to cause the cached query
&lt;br&gt;&amp;gt; to
&lt;br&gt;&amp;gt; &amp;gt; get evicted from the QueryCache, but it is not. &amp;nbsp;If I get the
&lt;br&gt;&amp;gt; &amp;gt; QueryResultCache, and evictAll RelationshipInfo.class, it still doesn't
&lt;br&gt;&amp;gt; get
&lt;br&gt;&amp;gt; &amp;gt; removed. &amp;nbsp;This seems to be because the AccessPath only contains
&lt;br&gt;&amp;gt; &amp;gt; OperatingSystem. &amp;nbsp;I'd expect this to contain all entities that this query
&lt;br&gt;&amp;gt; &amp;gt; deals with:
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {OperatingSystem,
&lt;br&gt;&amp;gt; &amp;gt; System_accessedVia_RemoteServiceAccessPoint, RemoteServiceAccessPoint,
&lt;br&gt;&amp;gt; &amp;gt; RelationshipInfo}
&lt;br&gt;&amp;gt; &amp;gt; But the AccessPath only seems to contain the entity of what is returned
&lt;br&gt;&amp;gt; &amp;gt; from
&lt;br&gt;&amp;gt; &amp;gt; the query.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; What do I need to do so this query gets evicted like I'd expect.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Thanks - Jeff
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Query-not-getting-evicted-from-QueryCache-tp3933557p3943118.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3934291"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3934291</id>
	<title>Re: Query not getting evicted from QueryCache</title>
	<published>2009-11-02T12:01:49Z</published>
	<updated>2009-11-02T12:01:49Z</updated>
	<author>
		<name>catalina wei-2</name>
	</author>
	<content type="html">Jeff,
&lt;br&gt;Could you provide more info :
&lt;br&gt;1. in persistence.xml, show us how you enable DataCache and QueryCache.
&lt;br&gt;2. the updates to RelationshipInfo, is that done by the same application
&lt;br&gt;that issued the query ? or some other application ?
&lt;br&gt;3. Could you show the code fragment that issues em.createQuery ?
&lt;br&gt;&lt;br&gt;Thanks.
&lt;br&gt;Catalina
&lt;br&gt;&lt;br&gt;On Mon, Nov 2, 2009 at 10:15 AM, Jeff Awe &amp;lt;&lt;a href=&quot;http://n2.nabble.com/user/SendEmail.jtp?type=node&amp;node=3934291&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;[hidden email]&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I'm running on OpenJPA 1.2.1
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The following query is added to the QueryCache:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Query: org.apache.openjpa.kernel.QueryImpl@3afe3afe;
&lt;br&gt;&amp;gt; candidate class: class com.ibm.usmi.datamodel.system.OperatingSystem;
&lt;br&gt;&amp;gt; query: SELECT distinct
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; OPERATINGSYSTEM1.OID,OPERATINGSYSTEM1.Guid,OPERATINGSYSTEM1.ObjectType,OPERATINGSYSTEM1.Name,REMOTESERVICEACCESSPOINT1.OID,REMOTESERVICEACCESSPOINT1.Guid,REMOTESERVICEACCESSPOINT1.ObjectType,REMOTESERVICEACCESSPOINT1.Name
&lt;br&gt;&amp;gt; FROM OperatingSystem
&lt;br&gt;&amp;gt; OPERATINGSYSTEM1,System_accessedVia_RemoteServiceAccessPoint
&lt;br&gt;&amp;gt; SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1,RemoteServiceAccessPoint
&lt;br&gt;&amp;gt; REMOTESERVICEACCESSPOINT1,RelationshipInfo RELATIONSHIPINFO1 WHERE
&lt;br&gt;&amp;gt; OPERATINGSYSTEM1.OID =
&lt;br&gt;&amp;gt; SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.sourceId
&lt;br&gt;&amp;gt; AND REMOTESERVICEACCESSPOINT1.OID =
&lt;br&gt;&amp;gt; SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.targetId AND
&lt;br&gt;&amp;gt; (OPERATINGSYSTEM1.Guid = ?1) AND (OPERATINGSYSTEM1.OID = ?2) AND
&lt;br&gt;&amp;gt; ((OPERATINGSYSTEM1.BuildNumber = ?3)) AND (REMOTESERVICEACCESSPOINT1.Guid =
&lt;br&gt;&amp;gt; ?4) AND (REMOTESERVICEACCESSPOINT1.OID = ?5) AND
&lt;br&gt;&amp;gt; ((REMOTESERVICEACCESSPOINT1.Port = ?6)) AND RELATIONSHIPINFO1.changedDate &amp;gt;
&lt;br&gt;&amp;gt; ?7 and RELATIONSHIPINFO1.sourceOID=OPERATINGSYSTEM1.OID and
&lt;br&gt;&amp;gt; RELATIONSHIPINFO1.relationshipType = ?8 and
&lt;br&gt;&amp;gt; RELATIONSHIPINFO1.targetOID=REMOTESERVICEACCESSPOINT1.OID
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Later on, a record in RelationshipInfo is changed, which changes what
&lt;br&gt;&amp;gt; should
&lt;br&gt;&amp;gt; be returned from this query. &amp;nbsp;I'd expect this to cause the cached query to
&lt;br&gt;&amp;gt; get evicted from the QueryCache, but it is not. &amp;nbsp;If I get the
&lt;br&gt;&amp;gt; QueryResultCache, and evictAll RelationshipInfo.class, it still doesn't get
&lt;br&gt;&amp;gt; removed. &amp;nbsp;This seems to be because the AccessPath only contains
&lt;br&gt;&amp;gt; OperatingSystem. &amp;nbsp;I'd expect this to contain all entities that this query
&lt;br&gt;&amp;gt; deals with:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {OperatingSystem,
&lt;br&gt;&amp;gt; System_accessedVia_RemoteServiceAccessPoint, RemoteServiceAccessPoint,
&lt;br&gt;&amp;gt; RelationshipInfo}
&lt;br&gt;&amp;gt; But the AccessPath only seems to contain the entity of what is returned
&lt;br&gt;&amp;gt; from
&lt;br&gt;&amp;gt; the query.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What do I need to do so this query gets evicted like I'd expect.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks - Jeff
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Query-not-getting-evicted-from-QueryCache-tp3933557p3934291.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3933557"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3933557</id>
	<title>Query not getting evicted from QueryCache</title>
	<published>2009-11-02T10:15:04Z</published>
	<updated>2009-11-02T10:15:04Z</updated>
	<author>
		<name>Jeff Awe</name>
	</author>
	<content type="html">I'm running on OpenJPA 1.2.1
&lt;br&gt;&lt;br&gt;The following query is added to the QueryCache:
&lt;br&gt;&lt;br&gt;Query: org.apache.openjpa.kernel.QueryImpl@3afe3afe;
&lt;br&gt;candidate class: class com.ibm.usmi.datamodel.system.OperatingSystem;
&lt;br&gt;query: SELECT distinct
&lt;br&gt;OPERATINGSYSTEM1.OID,OPERATINGSYSTEM1.Guid,OPERATINGSYSTEM1.ObjectType,OPERATINGSYSTEM1.Name,REMOTESERVICEACCESSPOINT1.OID,REMOTESERVICEACCESSPOINT1.Guid,REMOTESERVICEACCESSPOINT1.ObjectType,REMOTESERVICEACCESSPOINT1.Name
&lt;br&gt;FROM OperatingSystem
&lt;br&gt;OPERATINGSYSTEM1,System_accessedVia_RemoteServiceAccessPoint
&lt;br&gt;SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1,RemoteServiceAccessPoint
&lt;br&gt;REMOTESERVICEACCESSPOINT1,RelationshipInfo RELATIONSHIPINFO1 WHERE
&lt;br&gt;OPERATINGSYSTEM1.OID = SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.sourceId
&lt;br&gt;AND REMOTESERVICEACCESSPOINT1.OID =
&lt;br&gt;SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.targetId AND
&lt;br&gt;(OPERATINGSYSTEM1.Guid = ?1) AND (OPERATINGSYSTEM1.OID = ?2) AND
&lt;br&gt;((OPERATINGSYSTEM1.BuildNumber = ?3)) AND (REMOTESERVICEACCESSPOINT1.Guid =
&lt;br&gt;?4) AND (REMOTESERVICEACCESSPOINT1.OID = ?5) AND
&lt;br&gt;((REMOTESERVICEACCESSPOINT1.Port = ?6)) AND RELATIONSHIPINFO1.changedDate &amp;gt;
&lt;br&gt;?7 and RELATIONSHIPINFO1.sourceOID=OPERATINGSYSTEM1.OID and
&lt;br&gt;RELATIONSHIPINFO1.relationshipType = ?8 and
&lt;br&gt;RELATIONSHIPINFO1.targetOID=REMOTESERVICEACCESSPOINT1.OID
&lt;br&gt;&lt;br&gt;Later on, a record in RelationshipInfo is changed, which changes what should
&lt;br&gt;be returned from this query. &amp;nbsp;I'd expect this to cause the cached query to
&lt;br&gt;get evicted from the QueryCache, but it is not. &amp;nbsp;If I get the
&lt;br&gt;QueryResultCache, and evictAll RelationshipInfo.class, it still doesn't get
&lt;br&gt;removed. &amp;nbsp;This seems to be because the AccessPath only contains
&lt;br&gt;OperatingSystem. &amp;nbsp;I'd expect this to contain all entities that this query
&lt;br&gt;deals with:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{OperatingSystem,
&lt;br&gt;System_accessedVia_RemoteServiceAccessPoint, RemoteServiceAccessPoint,
&lt;br&gt;RelationshipInfo}
&lt;br&gt;But the AccessPath only seems to contain the entity of what is returned from
&lt;br&gt;the query.
&lt;br&gt;&lt;br&gt;What do I need to do so this query gets evicted like I'd expect.
&lt;br&gt;&lt;br&gt;Thanks - Jeff
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Query-not-getting-evicted-from-QueryCache-tp3933557p3933557.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3930693</id>
	<title>OptimisticLockException problem</title>
	<published>2009-11-02T01:27:16Z</published>
	<updated>2009-11-02T01:27:16Z</updated>
	<author>
		<name>Udi</name>
	</author>
	<content type="html">Hey,
&lt;br&gt;My application have few EntityManagers.
&lt;br&gt;Each EM, works on a different Thread.
&lt;br&gt;I configured openjpa.Optimistic to false and openjpa.Multithreaded to true. (Though Im not sure its related)
&lt;br&gt;I get the following exception (sorry for not pasting the full stack... I just can't):
&lt;br&gt;&lt;br&gt;org.apache.openjpa.persistence.OptimisticLockException: an optimistic lock violation was detected when flushing objects instance &amp;quot;bla.A-110&amp;quot; to the data store. This indicates that the object was cocurrently modified in another transaction.
&lt;br&gt;failed object:
&lt;br&gt;bla.A-bla.A-110
&lt;br&gt;at or.apache...BatchingPreparedStatementManagerImpl.checkUpdateCount(284)
&lt;br&gt;...
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;How can I get this concurrent modification if any EM uses different thread and connection?
&lt;br&gt;&lt;br&gt;I'm using OpenJPA 1.2.0, btw...
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Udi</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/OptimisticLockException-problem-tp3930693p3930693.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3934661</id>
	<title>Re: Maven dependencies in 1.3.0-SNAPSHOT</title>
	<published>2009-11-02T13:10:19Z</published>
	<updated>2009-11-02T13:10:19Z</updated>
	<author>
		<name>DWoods</name>
	</author>
	<content type="html">I'll have to take a look at it. &amp;nbsp;I my have broken something when 
&lt;br&gt;switching the aggregate JAR assemblies (openjpa.jar and openjpa-all.jar) 
&lt;br&gt;over to use the shade plugin, instead of manual Ant steps...
&lt;br&gt;&lt;br&gt;&lt;br&gt;-Donald
&lt;br&gt;&lt;br&gt;&lt;br&gt;Laird Nelson wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Perhaps it's just me, but I noticed that all of a sudden dependencies like
&lt;br&gt;&amp;gt; commons-lang and serp are not being pulled down when I depend on
&lt;br&gt;&amp;gt; &amp;lt;artifactId&amp;gt;openjpa&amp;lt;/artifactId&amp;gt; (I cleaned my local repository of OpenJPA
&lt;br&gt;&amp;gt; artifacts, and after rebuilding, my build fails, saying that it cannot find
&lt;br&gt;&amp;gt; classes that would be present if commons-lang and serp were pulled down).
&lt;br&gt;&amp;gt; Was a change made? &amp;nbsp;I noticed that in the openjpa POM they are listed as
&lt;br&gt;&amp;gt; &amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;, which indicates they should be present, yes?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Best,
&lt;br&gt;&amp;gt; Laird
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Maven-dependencies-in-1-3-0-SNAPSHOT-tp3924957p3934661.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3924957"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3924957</id>
	<title>Maven dependencies in 1.3.0-SNAPSHOT</title>
	<published>2009-10-31T12:37:55Z</published>
	<updated>2009-10-31T12:37:55Z</updated>
	<author>
		<name>ljnelson</name>
	</author>
	<content type="html">Perhaps it's just me, but I noticed that all of a sudden dependencies like
&lt;br&gt;commons-lang and serp are not being pulled down when I depend on
&lt;br&gt;&amp;lt;artifactId&amp;gt;openjpa&amp;lt;/artifactId&amp;gt; (I cleaned my local repository of OpenJPA
&lt;br&gt;artifacts, and after rebuilding, my build fails, saying that it cannot find
&lt;br&gt;classes that would be present if commons-lang and serp were pulled down).
&lt;br&gt;Was a change made? &amp;nbsp;I noticed that in the openjpa POM they are listed as
&lt;br&gt;&amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;, which indicates they should be present, yes?
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;Laird
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Maven-dependencies-in-1-3-0-SNAPSHOT-tp3924957p3924957.html" />
	
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3922563</id>
	<title>Re: Select NEW Issues</title>
	<published>2009-10-30T19:19:07Z</published>
	<updated>2009-10-30T19:19:07Z</updated>
	<author>
		<name>Pinaki Poddar</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&amp;nbsp; JPQL implementation of OpenJPA 1.3 (or before) had this limitation: if you specify a NEW in select projection then rest of the projection clauses are silently ignore.
&lt;br&gt;&amp;nbsp; This is in agreement with your observation.
&lt;br&gt;&amp;nbsp; &amp;nbsp;The good news is, the latest version of OpenJPA does not have any such restriction.
&lt;br&gt;&lt;br&gt;Pinaki
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;dharga wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;So I'm pretty new to using OpenJPA so this might be a simple fix...
&lt;br&gt;&lt;br&gt;I'm doing the following query.
&lt;br&gt;&lt;br&gt;select new com.bcbst.odstats.ejb.beans.RangeStats(count(a), avg(a.loadTime)) 
&lt;br&gt;FROM ODUsage a 
&lt;br&gt;WHERE 
&lt;br&gt;&amp;nbsp; a.accessDate BETWEEN :startDate AND :endDate and 
&lt;br&gt;&amp;nbsp; a.loadTime is not NULL
&lt;br&gt;&lt;br&gt;I've noticed the following. &amp;nbsp;If I remove the AVG aggregation function (and change the RangeStats constructor accordingly) it works fine in all cases.
&lt;br&gt;&lt;br&gt;The whole function is here.
&lt;br&gt;&lt;a href=&quot;http://aluink.pastebin.com/m49bbacb8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aluink.pastebin.com/m49bbacb8&lt;/a&gt;&lt;br&gt;&lt;br&gt;The RangeStats class is here
&lt;br&gt;&lt;a href=&quot;http://aluink.pastebin.com/m54beb0d&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aluink.pastebin.com/m54beb0d&lt;/a&gt;&lt;br&gt;&lt;br&gt;When I try to loop and do several queries I get this error. &amp;nbsp;&lt;a href=&quot;http://aluink.pastebin.com/m164f3d96&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aluink.pastebin.com/m164f3d96&lt;/a&gt;&lt;br&gt;&lt;br&gt;I've also noticed that if do the query just once with static :startDate and :endDate parameter values it works fine. &amp;nbsp;If I run a loop over a date range which includes the static date previously used, it fails.
&lt;br&gt;&lt;br&gt;The end goal is to reproduce the following transact-sql query and have the values in somekind of bean. &amp;nbsp;I really don't like the idea of doing multiple queries, but have yet to find a better solution. &amp;nbsp;I'm open to idea.
&lt;br&gt;&lt;br&gt;SELECT count(*), avg(loadTime), month(accessDate) 
&lt;br&gt;FROM Table 
&lt;br&gt;WHERE 
&lt;br&gt;&amp;nbsp; accessDate BETWEEN :startDate AND :endDate 
&lt;br&gt;GROUP BY month(accessDate)
&lt;br&gt;&lt;br&gt;TIA!
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;div class=&quot;signature&quot;&gt;Pinaki &lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Select-NEW-Issues-tp3921134p3922563.html" />
	<thr:in-reply-to ref="tag:n2.nabble.com,2006:post-3921134"/>
</entry>

<entry>
	<id>tag:n2.nabble.com,2006:post-3921134</id>
	<title>Select NEW Issues</title>
	<published>2009-10-30T12:54:49Z</published>
	<updated>2009-10-30T12:54:49Z</updated>
	<author>
		<name>dharga</name>
	</author>
	<content type="html">So I'm pretty new to using OpenJPA so this might be a simple fix...
&lt;br&gt;&lt;br&gt;I'm doing the following query.
&lt;br&gt;&lt;br&gt;select new com.bcbst.odstats.ejb.beans.RangeStats(count(a), avg(a.loadTime)) 
&lt;br&gt;FROM ODUsage a 
&lt;br&gt;WHERE 
&lt;br&gt;&amp;nbsp; a.accessDate BETWEEN :startDate AND :endDate and 
&lt;br&gt;&amp;nbsp; a.loadTime is not NULL
&lt;br&gt;&lt;br&gt;I've noticed the following. &amp;nbsp;If I remove the AVG aggregation function (and change the RangeStats constructor accordingly) it works fine in all cases.
&lt;br&gt;&lt;br&gt;The whole function is here.
&lt;br&gt;&lt;a href=&quot;http://aluink.pastebin.com/m49bbacb8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aluink.pastebin.com/m49bbacb8&lt;/a&gt;&lt;br&gt;&lt;br&gt;The RangeStats class is here
&lt;br&gt;&lt;a href=&quot;http://aluink.pastebin.com/m54beb0d&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aluink.pastebin.com/m54beb0d&lt;/a&gt;&lt;br&gt;&lt;br&gt;When I try to loop and do several queries I get this error. &amp;nbsp;&lt;a href=&quot;http://aluink.pastebin.com/m164f3d96&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aluink.pastebin.com/m164f3d96&lt;/a&gt;&lt;br&gt;&lt;br&gt;I've also noticed that if do the query just once with static :startDate and :endDate parameter values it works fine. &amp;nbsp;If I run a loop over a date range which includes the static date previously used, it fails.
&lt;br&gt;&lt;br&gt;The end goal is to reproduce the following transact-sql query and have the values in somekind of bean. &amp;nbsp;I really don't like the idea of doing multiple queries, but have yet to find a better solution. &amp;nbsp;I'm open to idea.
&lt;br&gt;&lt;br&gt;SELECT count(*), avg(loadTime), month(accessDate) 
&lt;br&gt;FROM Table 
&lt;br&gt;WHERE 
&lt;br&gt;&amp;nbsp; accessDate BETWEEN :startDate AND :endDate 
&lt;br&gt;GROUP BY month(accessDate)
&lt;br&gt;&lt;br&gt;TIA!
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://n2.nabble.com/Select-NEW-Issues-tp3921134p3921134.html" />
	
</entry>

</feed>
