openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chaos907 <da...@edelements.com>
Subject Re: Native SQL Query
Date Fri, 03 Jun 2011 20:40:18 GMT
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 name="openjpa.DetachState"
value="loaded(DetachedStateField=false)"/>
			
		</properties>
	</persistence-unit>
    
    <persistence-unit name="testPlatform">
        <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.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 name="openjpa.DetachState"
value="loaded(DetachedStateField=false)"/>
		</properties>
    </persistence-unit>
</persistence>


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

Mime
View raw message