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/