Re: Native SQL Query

2011-08-08 Thread Pinaki Poddar
Thank you for testing and validating the new changes.
Enjoy Slice :)



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6664880.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-08-02 Thread lspasam
Any updates? Has this been tested yet?

On 06/14/2011 02:37 PM, Pinaki Poddar [via OpenJPA] wrote:
 If possible, try revision 1135806 from trunk.

 I have committed a draft version that would execute SQL in Slice. I 
 have not tested it and I have concerns about sorting etc.

 If possible, let me know whether it gets you out of NPE.
 Also check for ORDER By or SUM() type support which perhaps will 
 simply not work.
 Pinaki


 
 If you reply to this email, your message will be added to the 
 discussion below:
 http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6476092.html 

 To unsubscribe from Native SQL Query, click here 
 http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=6432918code=bGVzQGVkZWxlbWVudHMuY29tfDY0MzI5MTh8LTE3NTY0MTAyMjc=.
  



-- 
Les Pasamonte
Engineering
Edelements Inc.



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6645883.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Native SQL Query

2011-08-02 Thread Pinaki Poddar
 Any updates? Has this been tested yet?
As a brave user of Open Source software, you will be testing it, I hoped :)
Of course, It is checked-in with some degree of testing. 


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6645971.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-08-02 Thread lspasam
I just checked out, built and ran the code against revision 1135806.  
Error is the same. Attached:

Caused by: java.lang.NullPointerException
 at 
org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:154)
 at 
org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:672)
 at 
org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:640)
 at 
org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:620)
 ... 51 more

Please advise.

Thanks!

On 08/02/2011 11:41 AM, Pinaki Poddar [via OpenJPA] wrote:
  Any updates? Has this been tested yet?
 As a brave user of Open Source software, you will be testing it, I 
 hoped :)
 Of course, It is checked-in with some degree of testing.
 Pinaki Poddar
 Chair, Apache OpenJPA Project


 
 If you reply to this email, your message will be added to the 
 discussion below:
 http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6645971.html 

 To unsubscribe from Native SQL Query, click here 
 http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=6432918code=bGVzQGVkZWxlbWVudHMuY29tfDY0MzI5MTh8LTE3NTY0MTAyMjc=.
  



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6646144.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Native SQL Query

2011-08-02 Thread Pinaki Poddar
Hi,
  I just cross checked with a native SQL query on Slice. It does run. 
Though the new addition lacked thorough testing, I would not expect the
error you have reported provided the new changes are applied in your
environment. 

To ensure that the change is available in your environment, please do the
following:

1. $ java -jar /path/to/openjpa.jar
this will print the SVN reversion number openjpa is built with

2. Check whether following class is present in the distribution (because
this is the newly added class)
org.apache.openjpa.slice.jdbc.DistributedSQLStoreQuery


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6646315.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-14 Thread Pinaki Poddar
If possible, try revision 1135806 from trunk.

I have committed a draft version that would execute SQL in Slice. I have not
tested it and I have concerns about sorting etc.

If possible, let me know whether it gets you out of NPE.
Also check for ORDER By or SUM() type support which perhaps will simply not
work. 

-
Pinaki 
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6476092.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-06 Thread Rick Curtis
I know this isn't a good answer, but is it possible to use JPQL as opposed
to native queries?

On Fri, Jun 3, 2011 at 3:40 PM, Chaos907 da...@edelements.com wrote:

 Below is our persistence.xml. When we are using the persistence-unit
 platform
 (no sharding), then createNativeQuery works. But if we use the
 persistence-unit platform-slice, then createNativeQuery fails with the
 stacktrace in the previous post.

 ?xml version=1.0 encoding=UTF-8?
 persistence version=2.0 xmlns=http://java.sun.com/xml/ns/persistence;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd;
persistence-unit name=platformTest_AWS
 transaction-type=RESOURCE_LOCAL
provider
org.apache.openjpa.persistence.PersistenceProviderImpl
/provider

properties

property name=javax.persistence.jdbc.driver
 value=com.mysql.jdbc.Driver/
property name=javax.persistence.jdbc.url
 value=jdbc:mysql://
 platformtest.co7yazhl6rhc.us-east-1.rds.amazonaws.com:3306/platform/
property name=javax.persistence.jdbc.user
 value=**/
property name=javax.persistence.jdbc.password
 value=**/

property name=openjpa.Log
 value=DefaultLevel=WARN, Tool=INFO/


property name=openjpa.QueryCache
 value=ehcache/
property name=openjpa.DataCacheManager
 value=ehcache/

/properties
/persistence-unit

persistence-unit name=platform transaction-type=RESOURCE_LOCAL
provider
org.apache.openjpa.persistence.PersistenceProviderImpl
/provider

properties

property name=openjpa.ConnectionDriverName
  value=com.mysql.jdbc.Driver/
property name=openjpa.ConnectionUserName
 value=**/
property name=openjpa.ConnectionPassword
 value=**/
property name=openjpa.ConnectionURL
  value=jdbc:mysql://
 127.0.0.1:3306/platform/

property name=openjpa.jdbc.SchemaFactory
 value=native(ForeignKeys=true)/

property name=openjpa.Log value=Runtime=TRACE,
 SQL=TRACE,
 DefaultLevel=WARN, Tool=INFO/

property name=openjpa.QueryCache
 value=ehcache/
property name=openjpa.DataCacheManager
 value=ehcache/

/properties
/persistence-unit
persistence-unit name=platform_slice
provider
org.apache.openjpa.persistence.PersistenceProviderImpl
/provider

properties
property name=openjpa.Log value=Runtime=TRACE,
 SQL=TRACE,
 DefaultLevel=TRACE, Tool=TRACE/
property name=openjpa.BrokerFactory
 value=slice/
property name=openjpa.slice.Names
 value=platform,platform1,platform2/
property name=openjpa.slice.Master
  value=platform/

property name=openjpa.slice.Lenient
 value=true/

property name=openjpa.ConnectionDriverName
  value=com.mysql.jdbc.Driver/
property name=openjpa.ConnectionUserName
 value=root/
property name=openjpa.ConnectionPassword
 value=99nfirst/
property
 name=openjpa.slice.platform.ConnectionURL
  value=jdbc:mysql://
 127.0.0.1:3306/platform/
property
 name=openjpa.slice.platform1.ConnectionURL
  value=jdbc:mysql://
 127.0.0.1:3306/platform1/
property
 name=openjpa.slice.platform2.ConnectionURL
  value=jdbc:mysql://
 127.0.0.1:3306/platform2/

property name=openjpa.slice.DistributionPolicy


 value=com.edelements.platform.service.openjpa.DistributeByInstitutionPolicy/
property name=openjpa.slice.FinderTargetPolicy

 value=com.edelements.platform.service.openjpa.ShardFinderTargetPolicy/
property name=openjpa.slice.ReplicationPolicy

 value=com.edelements.platform.service.openjpa.ShardReplicationPolicy/
property name=openjpa.slice.ReplicatedTypes
   value=/


property name=openjpa.QueryCache value=false/
property name=openjpa.DataCache value=false/


property name=openjpa.QueryCompilationCache
 value=false/
property name=openjpa.jdbc.QuerySQLCache
 value=false/
property name=openjpa.jdbc.FinderCache
 value=false/

property 

Re: Native SQL Query

2011-06-06 Thread Chaos907
For our application we want to support both native queries and JPQL. Does
open JPA not support native query under a distributed environment yet?

--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6446011.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-06 Thread Rick Curtis
I dug around the code a little bit and native queries don't work with
slice... I'm not sure if it is a simple bug to fix, or if it will take a
large effort to fix. Can I have you open a JIRA[1] for this bug?

[1] https://issues.apache.org/jira/browse/OPENJPA

On Mon, Jun 6, 2011 at 12:15 PM, Chaos907 da...@edelements.com wrote:

 For our application we want to support both native queries and JPQL. Does
 open JPA not support native query under a distributed environment yet?

 --


-- 
*Rick Curtis*


Re: Native SQL Query

2011-06-06 Thread Chaos907
I've created a JIRA issue for this bug:

https://issues.apache.org/jira/browse/OPENJPA-2008

--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6447446.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-06 Thread lspasam
Additional information I found, is that this only happens in a Distributed
environment (Slice).  Below is the method that is returning null for
ExpressionParser.  At this point in execution, language is openJpa.SQL. 
There doesn't seem to be an ExpressionParser mapped to this language.



public StoreQuery newQuery(String language) {
ExpressionParser parser =
QueryLanguages.parserForLanguage(language);
DistributedStoreQuery ret = new DistributedStoreQuery(this, parser);
for (SliceStoreManager slice : _slices) {
ret.add(slice.newQuery(language));
}
return ret;
}


Is this a bug or is native queries not going to be supported in a sliced
environment?



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6433509.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-03 Thread Michael Dick
Which properties do you have in persistence.xml?

A reply on Nabble (not accepted by the mailing list yet) asserts that this
only happens with slice. If that's the case we can look into reproducing the
problem outside of your container environment. 

Thanks
-mike

--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6435475.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-03 Thread Chaos907
Thanks for the reply. Yes you are right, we are using a distributed
environment (Slice) and we did find out that this only happens when we are
using slice.  Below is the method that is returning null for
ExpressionParser.  At this point in execution, language is openJpa.SQL. 
There doesn't seem to be an ExpressionParser mapped to this language. 


public StoreQuery newQuery(String language) {
ExpressionParser parser =
QueryLanguages.parserForLanguage(language);
DistributedStoreQuery ret = new DistributedStoreQuery(this, parser);
for (SliceStoreManager slice : _slices) {
ret.add(slice.newQuery(language));
}
return ret;
}

Is this a bug or is native queries not going to be supported in a sliced
environment? 


--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6436172.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-06-03 Thread Chaos907
Below is our persistence.xml. When we are using the persistence-unit platform
(no sharding), then createNativeQuery works. But if we use the
persistence-unit platform-slice, then createNativeQuery fails with the
stacktrace in the previous post.

?xml version=1.0 encoding=UTF-8?
persistence version=2.0 xmlns=http://java.sun.com/xml/ns/persistence;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd;
persistence-unit name=platformTest_AWS
transaction-type=RESOURCE_LOCAL
provider
org.apache.openjpa.persistence.PersistenceProviderImpl
/provider

properties

property name=javax.persistence.jdbc.driver
value=com.mysql.jdbc.Driver/
property name=javax.persistence.jdbc.url
value=jdbc:mysql://platformtest.co7yazhl6rhc.us-east-1.rds.amazonaws.com:3306/platform/
property name=javax.persistence.jdbc.user 
value=**/
property name=javax.persistence.jdbc.password 
value=**/

property name=openjpa.Log value=DefaultLevel=WARN, 
Tool=INFO/


property name=openjpa.QueryCache value=ehcache/
property name=openjpa.DataCacheManager 
value=ehcache/

/properties
/persistence-unit

persistence-unit name=platform transaction-type=RESOURCE_LOCAL
provider
org.apache.openjpa.persistence.PersistenceProviderImpl
/provider

properties

property name=openjpa.ConnectionDriverName
  value=com.mysql.jdbc.Driver/
property name=openjpa.ConnectionUserName 
value=**/
property name=openjpa.ConnectionPassword 
value=**/
property name=openjpa.ConnectionURL
  value=jdbc:mysql://127.0.0.1:3306/platform/

property name=openjpa.jdbc.SchemaFactory
value=native(ForeignKeys=true)/

property name=openjpa.Log value=Runtime=TRACE, 
SQL=TRACE,
DefaultLevel=WARN, Tool=INFO/

property name=openjpa.QueryCache value=ehcache/
property name=openjpa.DataCacheManager 
value=ehcache/

/properties
/persistence-unit
persistence-unit name=platform_slice
provider
org.apache.openjpa.persistence.PersistenceProviderImpl
/provider

properties
property name=openjpa.Log value=Runtime=TRACE, 
SQL=TRACE,
DefaultLevel=TRACE, Tool=TRACE/
property name=openjpa.BrokerFactory value=slice/
property name=openjpa.slice.Names  
value=platform,platform1,platform2/
property name=openjpa.slice.Master  
value=platform/

property name=openjpa.slice.Lenient value=true/
 
property name=openjpa.ConnectionDriverName
  value=com.mysql.jdbc.Driver/
property name=openjpa.ConnectionUserName 
value=root/
property name=openjpa.ConnectionPassword 
value=99nfirst/
property name=openjpa.slice.platform.ConnectionURL   
 
  value=jdbc:mysql://127.0.0.1:3306/platform/
property name=openjpa.slice.platform1.ConnectionURL  
  
  
value=jdbc:mysql://127.0.0.1:3306/platform1/
property name=openjpa.slice.platform2.ConnectionURL  
  
  
value=jdbc:mysql://127.0.0.1:3306/platform2/

property name=openjpa.slice.DistributionPolicy 
  
value=com.edelements.platform.service.openjpa.DistributeByInstitutionPolicy/
property name=openjpa.slice.FinderTargetPolicy 
  
value=com.edelements.platform.service.openjpa.ShardFinderTargetPolicy/
property name=openjpa.slice.ReplicationPolicy 
  
value=com.edelements.platform.service.openjpa.ShardReplicationPolicy/
property name=openjpa.slice.ReplicatedTypes 
   value=/


property name=openjpa.QueryCache value=false/
property name=openjpa.DataCache value=false/


property name=openjpa.QueryCompilationCache 
value=false/