Re: Configuration: either / or ?

2007-01-09 Thread Matthieu Riou

If I don't set openjpa.ConnectionDriverName (and even if I set 
openjpa.ConnectionFactory with my datasource instance) I get the A JDBC
Driver or DataSource class name must be specified in the
ConnectionDriverName property error. So I'm getting more and more confused
as to which properties I should set...

On 1/8/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Matthieu-

I think you want openjpa.ConnectionFactory, not
openjpa.ConnectionDriverName.



On Jan 8, 2007, at 9:45 AM, Matthieu Riou wrote:

 Hi,

 I've just tried your fix after compiling the OpenJPA trunk. I'm
 getting a
 ClassCastException as the openjpa.ConnectionDriverName is set as a
 StringValue. Should I use another property instead?

 My code:

propMap.put(openjpa.jdbc.DBDictionary, 
 org.apache.openjpa.jdbc.sql.DerbyDictionary);
propMap.put(openjpa.ManagedRuntime, new TxMgrProvider());
propMap.put(openjpa.ConnectionDriverName, _datasource);
propMap.put(openjpa.Log, DefaultLevel=TRACE);
EntityManagerFactory emf =
 Persistence.createEntityManagerFactory(ode-dao,
 propMap);
EntityManager em = emf.createEntityManager();

 The exception:

 0|true|0.9.7-incubating-SNAPSHOT
 org.apache.openjpa.persistence.PersistenceException: There was an
 error when
 invoking the static newInstance method on the named factory class 
 org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.  See the nested
 exception
 for details.
at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
 Bootstrap.java:62)
at
 org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityMan
 agerFactory
 (PersistenceProviderImpl.java:70)
at
 org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityMan
 agerFactory
 (PersistenceProviderImpl.java:78)
at javax.persistence.Persistence.createEntityManagerFactory(
 Persistence.java:83)
at org.apache.ode.axis2.ODEServerJPA.initJPA
 (ODEServerJPA.java:345)
at org.apache.ode.axis2.ODEServerJPA.init(ODEServerJPA.java:96)
at org.apache.ode.axis2.hooks.ODEAxisServlet.init(
 ODEAxisServlet.java:50)
at org.apache.catalina.core.StandardWrapper.loadServlet(
 StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(
 StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(
 StandardContext.java:3917)
at org.apache.catalina.core.StandardContext.start(
 StandardContext.java:4201)
at org.apache.catalina.core.ContainerBase.addChildInternal(
 ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(
 ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild
 (StandardHost.java
 :524)
at org.apache.catalina.startup.HostConfig.deployWAR
 (HostConfig.java
 :809)
at org.apache.catalina.startup.HostConfig.deployWARs
 (HostConfig.java
 :698)
at org.apache.catalina.startup.HostConfig.deployApps
 (HostConfig.java
 :472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java
 :1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
 HostConfig.java:310)
at
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
 LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start
 (ContainerBase.java
 :1021)
at org.apache.catalina.core.StandardHost.start
 (StandardHost.java
 :718)
at org.apache.catalina.core.ContainerBase.start
 (ContainerBase.java
 :1013)
at org.apache.catalina.core.StandardEngine.start
 (StandardEngine.java
 :442)
at org.apache.catalina.core.StandardService.start(
 StandardService.java:450)
at org.apache.catalina.core.StandardServer.start
 (StandardServer.java
 :709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:
 551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
 NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
 DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start
 (Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
 432)
 Caused by: org.apache.openjpa.lib.util.ParseException:
 ConnectionDriverName:
 [EMAIL PROTECTED]
at org.apache.openjpa.lib.conf.Value.setObject(Value.java:298)
at
 org.apache.openjpa.lib.conf.ConfigurationImpl.fromProperties(
 ConfigurationImpl.java:627)
at
 org.apache.openjpa.lib.conf.MapConfigurationProvider.setInto(
 MapConfigurationProvider.java:82)
at
 org.apache.openjpa.persistence.PersistenceProductDerivation
 $ConfigurationProviderImpl.setInto
 (PersistenceProductDerivation.java:406)
at
 org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newInstance(
 JDBCBrokerFactory.java:56)
at 

Re: Configuration: either / or ?

2007-01-08 Thread Matthieu Riou

Hi,

I've just tried your fix after compiling the OpenJPA trunk. I'm getting a
ClassCastException as the openjpa.ConnectionDriverName is set as a
StringValue. Should I use another property instead?

My code:

   propMap.put(openjpa.jdbc.DBDictionary, 
org.apache.openjpa.jdbc.sql.DerbyDictionary);
   propMap.put(openjpa.ManagedRuntime, new TxMgrProvider());
   propMap.put(openjpa.ConnectionDriverName, _datasource);
   propMap.put(openjpa.Log, DefaultLevel=TRACE);
   EntityManagerFactory emf =
Persistence.createEntityManagerFactory(ode-dao,
propMap);
   EntityManager em = emf.createEntityManager();

The exception:

0|true|0.9.7-incubating-SNAPSHOT
org.apache.openjpa.persistence.PersistenceException: There was an error when
invoking the static newInstance method on the named factory class 
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.  See the nested exception
for details.
   at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
Bootstrap.java:62)
   at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory
(PersistenceProviderImpl.java:70)
   at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory
(PersistenceProviderImpl.java:78)
   at javax.persistence.Persistence.createEntityManagerFactory(
Persistence.java:83)
   at org.apache.ode.axis2.ODEServerJPA.initJPA(ODEServerJPA.java:345)
   at org.apache.ode.axis2.ODEServerJPA.init(ODEServerJPA.java:96)
   at org.apache.ode.axis2.hooks.ODEAxisServlet.init(
ODEAxisServlet.java:50)
   at org.apache.catalina.core.StandardWrapper.loadServlet(
StandardWrapper.java:1105)
   at org.apache.catalina.core.StandardWrapper.load(
StandardWrapper.java:932)
   at org.apache.catalina.core.StandardContext.loadOnStartup(
StandardContext.java:3917)
   at org.apache.catalina.core.StandardContext.start(
StandardContext.java:4201)
   at org.apache.catalina.core.ContainerBase.addChildInternal(
ContainerBase.java:759)
   at org.apache.catalina.core.ContainerBase.addChild(
ContainerBase.java:739)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java
:524)
   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java
:809)
   at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java
:698)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java
:472)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java
:1122)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(
HostConfig.java:310)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
:1021)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java
:718)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
:1013)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java
:442)
   at org.apache.catalina.core.StandardService.start(
StandardService.java:450)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java
:709)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: org.apache.openjpa.lib.util.ParseException: ConnectionDriverName:
[EMAIL PROTECTED]
   at org.apache.openjpa.lib.conf.Value.setObject(Value.java:298)
   at org.apache.openjpa.lib.conf.ConfigurationImpl.fromProperties(
ConfigurationImpl.java:627)
   at org.apache.openjpa.lib.conf.MapConfigurationProvider.setInto(
MapConfigurationProvider.java:82)
   at
org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationProviderImpl.setInto
(PersistenceProductDerivation.java:406)
   at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newInstance(
JDBCBrokerFactory.java:56)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java
:117)
   at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
Bootstrap.java:57)
   ... 32 more
Caused by: java.lang.ClassCastException:
org.opentools.minerva.connector.jdbc.JDBCDataSource
   at org.apache.openjpa.lib.conf.StringValue.setInternalObject(
StringValue.java:63)
   

Re: Configuration: either / or ?

2007-01-08 Thread Marc Prud'hommeaux

Matthieu-

I think you want openjpa.ConnectionFactory, not  
openjpa.ConnectionDriverName.




On Jan 8, 2007, at 9:45 AM, Matthieu Riou wrote:


Hi,

I've just tried your fix after compiling the OpenJPA trunk. I'm  
getting a

ClassCastException as the openjpa.ConnectionDriverName is set as a
StringValue. Should I use another property instead?

My code:

   propMap.put(openjpa.jdbc.DBDictionary, 
org.apache.openjpa.jdbc.sql.DerbyDictionary);
   propMap.put(openjpa.ManagedRuntime, new TxMgrProvider());
   propMap.put(openjpa.ConnectionDriverName, _datasource);
   propMap.put(openjpa.Log, DefaultLevel=TRACE);
   EntityManagerFactory emf =
Persistence.createEntityManagerFactory(ode-dao,
propMap);
   EntityManager em = emf.createEntityManager();

The exception:

0|true|0.9.7-incubating-SNAPSHOT
org.apache.openjpa.persistence.PersistenceException: There was an  
error when

invoking the static newInstance method on the named factory class 
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.  See the nested  
exception

for details.
   at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
Bootstrap.java:62)
   at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityMan 
agerFactory

(PersistenceProviderImpl.java:70)
   at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityMan 
agerFactory

(PersistenceProviderImpl.java:78)
   at javax.persistence.Persistence.createEntityManagerFactory(
Persistence.java:83)
   at org.apache.ode.axis2.ODEServerJPA.initJPA 
(ODEServerJPA.java:345)

   at org.apache.ode.axis2.ODEServerJPA.init(ODEServerJPA.java:96)
   at org.apache.ode.axis2.hooks.ODEAxisServlet.init(
ODEAxisServlet.java:50)
   at org.apache.catalina.core.StandardWrapper.loadServlet(
StandardWrapper.java:1105)
   at org.apache.catalina.core.StandardWrapper.load(
StandardWrapper.java:932)
   at org.apache.catalina.core.StandardContext.loadOnStartup(
StandardContext.java:3917)
   at org.apache.catalina.core.StandardContext.start(
StandardContext.java:4201)
   at org.apache.catalina.core.ContainerBase.addChildInternal(
ContainerBase.java:759)
   at org.apache.catalina.core.ContainerBase.addChild(
ContainerBase.java:739)
   at org.apache.catalina.core.StandardHost.addChild 
(StandardHost.java

:524)
   at org.apache.catalina.startup.HostConfig.deployWAR 
(HostConfig.java

:809)
   at org.apache.catalina.startup.HostConfig.deployWARs 
(HostConfig.java

:698)
   at org.apache.catalina.startup.HostConfig.deployApps 
(HostConfig.java

:472)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java
:1122)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(
HostConfig.java:310)
   at  
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(

LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start 
(ContainerBase.java

:1021)
   at org.apache.catalina.core.StandardHost.start 
(StandardHost.java

:718)
   at org.apache.catalina.core.ContainerBase.start 
(ContainerBase.java

:1013)
   at org.apache.catalina.core.StandardEngine.start 
(StandardEngine.java

:442)
   at org.apache.catalina.core.StandardService.start(
StandardService.java:450)
   at org.apache.catalina.core.StandardServer.start 
(StandardServer.java

:709)
   at org.apache.catalina.startup.Catalina.start(Catalina.java: 
551)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.catalina.startup.Bootstrap.start 
(Bootstrap.java:294)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 
432)
Caused by: org.apache.openjpa.lib.util.ParseException:  
ConnectionDriverName:

[EMAIL PROTECTED]
   at org.apache.openjpa.lib.conf.Value.setObject(Value.java:298)
   at  
org.apache.openjpa.lib.conf.ConfigurationImpl.fromProperties(

ConfigurationImpl.java:627)
   at  
org.apache.openjpa.lib.conf.MapConfigurationProvider.setInto(

MapConfigurationProvider.java:82)
   at
org.apache.openjpa.persistence.PersistenceProductDerivation 
$ConfigurationProviderImpl.setInto

(PersistenceProductDerivation.java:406)
   at  
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newInstance(

JDBCBrokerFactory.java:56)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.openjpa.kernel.Bootstrap.invokeFactory 
(Bootstrap.java

:117)
   at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(

Re: Configuration: either / or ?

2007-01-03 Thread Abe White
I've been fighting for some time now with my OpenJPA configuration  
and just
discovered why. It seems that you *either* consider the  
persistence.xml file
*or* the map passed as parameter of  
Persistence.createEntityManagerFactory.
If you look at PersistenceProductDerivation.load(String rsrc,  
String name,
Map m) (line 151), if the configuration provider can find a  
configuration
file then the configuration is returned as is and the provided  
configuration

Map doesn't even gets considered.


I don't see this.  The Map is passed along to the method that loads  
the configuration file, which passes it along to the configuration  
parser, which sets its entries over the properties it parses.

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.


Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou

Sorry I've jumped too quickly to conclusions. The mistake was mine.

However I'm trying to initialize OpenJPA programmatically using the
following code:

   HashMap propMap = new HashMap();
   propMap.put(openjpa.ManagedRuntime, new TxMgrProvider(_txMgr));
   propMap.put(openjpa.ConnectionDriverName,
org.apache.derby.jdbc.EmbeddedDriver.class.getName());
   propMap.put(openjpa.ConnectionFactory, _datasource);
   EntityManagerFactory emf =
Persistence.createEntityManagerFactory(ode-dao,
propMap);
   EntityManager em = emf.createEntityManager(propMap);

The TxMgrProvider implements the ManagedRuntime interface.

When execute, for each of the Map key I'm passing I'm getting:

4|false|0.9.6-incubating-SNAPSHOT
org.apache.openjpa.persistence.ArgumentException: Missing getter for
property ConnectionDriverName in type class
org.apache.openjpa.persistence.EntityManagerImpl.

With the NoSuchMethodException that comes together. As I'm passing
configuration properties I don't get why it tries to set of get them on the
entity manager. I guess I'm doing something wrong, do you have an idea of
what could that be?

Thanks!

Matthieu

On 1/3/07, Abe White [EMAIL PROTECTED] wrote:


 I've been fighting for some time now with my OpenJPA configuration
 and just
 discovered why. It seems that you *either* consider the
 persistence.xml file
 *or* the map passed as parameter of
 Persistence.createEntityManagerFactory.
 If you look at PersistenceProductDerivation.load(String rsrc,
 String name,
 Map m) (line 151), if the configuration provider can find a
 configuration
 file then the configuration is returned as is and the provided
 configuration
 Map doesn't even gets considered.

I don't see this.  The Map is passed along to the method that loads
the configuration file, which passes it along to the configuration
parser, which sets its entries over the properties it parses.
___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.



Re: Configuration: either / or ?

2007-01-03 Thread Marc Prud'hommeaux

Matthieu-

Can you send the complete stack trace?

Also, I don't think this is the cause of the problem, but why are you  
specifying both ConnectionDriverName and ConnectionFactory? With  
ConnectionFactory specified, you shouldn't need to specify the  
ConnectionDriverName.




On Jan 3, 2007, at 5:01 PM, Matthieu Riou wrote:


Sorry I've jumped too quickly to conclusions. The mistake was mine.

However I'm trying to initialize OpenJPA programmatically using the
following code:

   HashMap propMap = new HashMap();
   propMap.put(openjpa.ManagedRuntime, new TxMgrProvider 
(_txMgr));

   propMap.put(openjpa.ConnectionDriverName,
org.apache.derby.jdbc.EmbeddedDriver.class.getName());
   propMap.put(openjpa.ConnectionFactory, _datasource);
   EntityManagerFactory emf =
Persistence.createEntityManagerFactory(ode-dao,
propMap);
   EntityManager em = emf.createEntityManager(propMap);

The TxMgrProvider implements the ManagedRuntime interface.

When execute, for each of the Map key I'm passing I'm getting:

4|false|0.9.6-incubating-SNAPSHOT
org.apache.openjpa.persistence.ArgumentException: Missing getter for
property ConnectionDriverName in type class
org.apache.openjpa.persistence.EntityManagerImpl.

With the NoSuchMethodException that comes together. As I'm passing
configuration properties I don't get why it tries to set of get  
them on the
entity manager. I guess I'm doing something wrong, do you have an  
idea of

what could that be?

Thanks!

Matthieu

On 1/3/07, Abe White [EMAIL PROTECTED] wrote:


 I've been fighting for some time now with my OpenJPA configuration
 and just
 discovered why. It seems that you *either* consider the
 persistence.xml file
 *or* the map passed as parameter of
 Persistence.createEntityManagerFactory.
 If you look at PersistenceProductDerivation.load(String rsrc,
 String name,
 Map m) (line 151), if the configuration provider can find a
 configuration
 file then the configuration is returned as is and the provided
 configuration
 Map doesn't even gets considered.

I don't see this.  The Map is passed along to the method that loads
the configuration file, which passes it along to the configuration
parser, which sets its entries over the properties it parses.
_ 
__
Notice:  This email message, together with any attachments, may  
contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and   
affiliated
entities,  that may be confidential,  proprietary,  copyrighted   
and/or
legally privileged, and is intended solely for the use of the  
individual
or entity named in this message. If you are not the intended  
recipient,
and have received this message in error, please immediately return  
this

by email and then delete it.





Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou

But if I don't provide openjpa.ConnectionDriverName the call to
createEntityManager fails with an exception saying that ConnectionDriverName
should be provided (coming from DataSourceFactory):

4|true|0.9.6-incubating-SNAPSHOT
org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or
DataSource class name must be specified in the ConnectionDriverName
property.
   at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(
DataSourceFactory.java:67)
   at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(
JDBCConfigurationImpl.java:797)
   at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(
JDBCConfigurationImpl.java:563)
   at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(
MappingRepository.java:1167)
   at org.apache.openjpa.lib.conf.Configurations.configureInstance(
Configurations.java:355)
   at org.apache.openjpa.lib.conf.Configurations.configureInstance(
Configurations.java:280)
   at org.apache.openjpa.lib.conf.PluginValue.instantiate(
PluginValue.java:99)
   at org.apache.openjpa.lib.conf.ObjectValue.instantiate(
ObjectValue.java:70)
   at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance
(OpenJPAConfigurationImpl.java:834)
   at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance
(OpenJPAConfigurationImpl.java:829)
   at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(
AbstractBrokerFactory.java:526)
   at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(
AbstractBrokerFactory.java:147)
   at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
DelegatingBrokerFactory.java:139)
   at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:187)
   at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:52)
   at org.apache.ode.axis2.ODEServerJPA.initJPA(ODEServerJPA.java:344)


On 1/3/07, Abe White [EMAIL PROTECTED] wrote:


 When execute, for each of the Map key I'm passing I'm getting:

 4|false|0.9.6-incubating-SNAPSHOT
 org.apache.openjpa.persistence.ArgumentException: Missing getter for
 property ConnectionDriverName in type class
 org.apache.openjpa.persistence.EntityManagerImpl.

Because you shouldn't be passing your property map to the
createEntityManager call.  That call takes EntityManager properties,
not EntityManagerFactory settings.
___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.



Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou

Right. Sorry about that. Even though my ConnectionDriverName is still not
properly picked up:

ERROR - ApplicationContext.log(675) | StandardWrapper.Throwable
4|true|0.9.6-incubating-SNAPSHOT
org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or
DataSource class name must be specified in the ConnectionDriverName
property.
   at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(
DataSourceFactory.java:67)
   at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(
JDBCConfigurationImpl.java:797)
   at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(
JDBCConfigurationImpl.java:563)
   at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(
MappingRepository.java:1167)
   at org.apache.openjpa.lib.conf.Configurations.configureInstance(
Configurations.java:355)
   at org.apache.openjpa.lib.conf.Configurations.configureInstance(
Configurations.java:280)
   at org.apache.openjpa.lib.conf.PluginValue.instantiate(
PluginValue.java:99)
   at org.apache.openjpa.lib.conf.ObjectValue.instantiate(
ObjectValue.java:70)
   at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance
(OpenJPAConfigurationImpl.java:834)
   at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance
(OpenJPAConfigurationImpl.java:829)
   at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(
AbstractBrokerFactory.java:526)
   at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(
AbstractBrokerFactory.java:147)
   at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
DelegatingBrokerFactory.java:139)
   at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:187)
   at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:52)
   at org.apache.ode.axis2.ODEServerJPA.initJPA(ODEServerJPA.java:344)


On 1/3/07, Abe White [EMAIL PROTECTED] wrote:


 But if I don't provide openjpa.ConnectionDriverName the call to
 createEntityManager fails with an exception saying that
 ConnectionDriverName
 should be provided (coming from DataSourceFactory):

You need to provide it to createEntityManagerFactory.  Not to
createEntityManager.  You shouldn't be passing anything to
createEntityManager.  Use the no-args version.
___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.



Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou

My ultimate goal is to provide directly an instance of DataSource that
OpenJPA would use instead of trying to lookup or create one. It seems that
it's possible by setting ConnectionFactory to the datasource instance but
OpenJPA fails before that if no ConnectionDriverName is specified.

Abe is right when saying that I should provide the properties to
createEntityManager insteand of createEntityManagerFactory but I still can't
find to way to initialize everything property.

Thanks,

Matthieu

On 1/3/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Matthieu-

Can you send the complete stack trace?

Also, I don't think this is the cause of the problem, but why are you
specifying both ConnectionDriverName and ConnectionFactory? With
ConnectionFactory specified, you shouldn't need to specify the
ConnectionDriverName.



On Jan 3, 2007, at 5:01 PM, Matthieu Riou wrote:

 Sorry I've jumped too quickly to conclusions. The mistake was mine.

 However I'm trying to initialize OpenJPA programmatically using the
 following code:

HashMap propMap = new HashMap();
propMap.put(openjpa.ManagedRuntime, new TxMgrProvider
 (_txMgr));
propMap.put(openjpa.ConnectionDriverName,
 org.apache.derby.jdbc.EmbeddedDriver.class.getName());
propMap.put(openjpa.ConnectionFactory, _datasource);
EntityManagerFactory emf =
 Persistence.createEntityManagerFactory(ode-dao,
 propMap);
EntityManager em = emf.createEntityManager(propMap);

 The TxMgrProvider implements the ManagedRuntime interface.

 When execute, for each of the Map key I'm passing I'm getting:

 4|false|0.9.6-incubating-SNAPSHOT
 org.apache.openjpa.persistence.ArgumentException: Missing getter for
 property ConnectionDriverName in type class
 org.apache.openjpa.persistence.EntityManagerImpl.

 With the NoSuchMethodException that comes together. As I'm passing
 configuration properties I don't get why it tries to set of get
 them on the
 entity manager. I guess I'm doing something wrong, do you have an
 idea of
 what could that be?

 Thanks!

 Matthieu

 On 1/3/07, Abe White [EMAIL PROTECTED] wrote:

  I've been fighting for some time now with my OpenJPA configuration
  and just
  discovered why. It seems that you *either* consider the
  persistence.xml file
  *or* the map passed as parameter of
  Persistence.createEntityManagerFactory.
  If you look at PersistenceProductDerivation.load(String rsrc,
  String name,
  Map m) (line 151), if the configuration provider can find a
  configuration
  file then the configuration is returned as is and the provided
  configuration
  Map doesn't even gets considered.

 I don't see this.  The Map is passed along to the method that loads
 the configuration file, which passes it along to the configuration
 parser, which sets its entries over the properties it parses.
 _
 __
 Notice:  This email message, together with any attachments, may
 contain
 information  of  BEA Systems,  Inc.,  its subsidiaries  and
 affiliated
 entities,  that may be confidential,  proprietary,  copyrighted
 and/or
 legally privileged, and is intended solely for the use of the
 individual
 or entity named in this message. If you are not the intended
 recipient,
 and have received this message in error, please immediately return
 this
 by email and then delete it.





Re: Configuration: either / or ?

2007-01-03 Thread Abe White
I'm able to reproduce the ConnectionDriverName problem.  I'll have  
more info in a bit.

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.


Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou

Cool! I've tried to set openjpa.Log but like all other properties it doesn't
get considered by the entity manager. It's just like my whole Map gets
ignored. I'm also setting the DBDictionary but it also gets ignored as I get
the dictionary auto-detection message...

Something else I can do to debug this? I'm able to do a step-by-step into
the code but it seems that the properties on configuration classes are set
through introspection so it's hard to track down.

On 1/3/07, Abe White [EMAIL PROTECTED] wrote:


I'm able to reproduce the ConnectionDriverName problem.  I'll have
more info in a bit.
___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.



Re: Configuration: either / or ?

2007-01-03 Thread Abe White
OK, the problem is that we're only paying attention to openjpa.*  
property keys with String values when you bootstrap through  
Persistence.  I have no idea why, and I'll change it momentarily.   
But for now, you can work around the problem for your DataSource  
using the javax.persistence.nonJtaDataSource key instead of  
openjpa.ConnectionFactory.  Unfortunately no such workaround exists  
for the ManagedRuntime.

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.


Re: Configuration: either / or ?

2007-01-03 Thread Abe White
OK, the problem is that we're only paying attention to openjpa.*  
property keys with String values when you bootstrap through  
Persistence.  I have no idea why, and I'll change it momentarily.


Actually I now see why, and I might not be able to fix it before I  
leave work today.  For anyone who's interested, it's because we  
combine the parsed persistence.xml with the Map into a  
PersistenceUnitInfo, and PersistenceUnitInfo returns a Properties  
instance from getProperties() instead of a generic Map, implying all  
String values. 
 
___

Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.


Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou

I'm still having the same problem (it can't find my ConnectionDriverName
property). Now my code looks like:

   HashMap propMap = new HashMap();
   propMap.put(openjpa.jdbc.DBDictionary, 
org.apache.openjpa.jdbc.sql.DerbyDictionary);
   propMap.put(openjpa.ManagedRuntime, TxMgrProvider.class.getName
());
   propMap.put(openjpa.ConnectionDriverName,
org.apache.derby.jdbc.EmbeddedDriver.class.getName());
   propMap.put(javax.persistence.nonJtaDataSource, _datasource);
   propMap.put(openjpa.Log, DefaultLevel=TRACE);
   EntityManagerFactory emf = Persistence.createEntityManagerFactory
(ode-dao);
   EntityManager em = emf.createEntityManager(propMap);

As you can see everything is a string exception
javax.persistence.nonJtaDataSource. I even tried to comment out this
property to only have string properties and I still got the same error.

I have 2 questions thought:

  1. If the loading of one property fails, no property gets loaded?
  2. I keep on looking at the code in
EntityManagerFactoryImpl.createEntityManager. The error appears on the call
to _factory.newBroker and it seems to me that nothing much is done with the
provided Map before that. When does the Map gets used exactly?

Thanks a lot for your help!

On 1/3/07, Abe White [EMAIL PROTECTED] wrote:


OK, the problem is that we're only paying attention to openjpa.*
property keys with String values when you bootstrap through
Persistence.  I have no idea why, and I'll change it momentarily.
But for now, you can work around the problem for your DataSource
using the javax.persistence.nonJtaDataSource key instead of
openjpa.ConnectionFactory.  Unfortunately no such workaround exists
for the ManagedRuntime.
___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.