Re: Configuration: either / or ?

2007-01-09 Thread Marc Prud'hommeaux
Matthieu- The following code works for me against the most recent OpenJPA build: org.apache.derby.jdbc.EmbeddedDataSource ds = new org.apache.derby.jdbc.EmbeddedDataSource(); ds.setDatabaseName("testdb"); ds.setCreateDatabase("create"); Map props = ne

Re: Configuration: either / or ?

2007-01-09 Thread Matthieu Riou
So if I do: propMap.put("openjpa.ConnectionDriverName", org.apache.derby.jdbc.EmbeddedDriver.class.getName()); propMap.put("openjpa.ConnectionFactoryName", org.apache.derby.jdbc.EmbeddedDriver.class.getName()); propMap.put("openjpa.ConnectionFactory", _datasource); It tries

Re: Configuration: either / or ?

2007-01-09 Thread Marc Prud'hommeaux
Matthieu- We may not be expecting you to just manually set the DataSource. Try setting the "openjpa.ConnectionFactory" property to the DataSource object you are using, and then set "openjpa.ConnectionFactoryName" to some bogus string and see what happens. If there is an error, be sure to

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

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

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.DerbyDictio

Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou
Sorry about that, I've been persistently reading your sentence the other way around: use createEntityManager instead of createEntityManagerFactory. I've finally got it in the right order, I guess I should get my eyes checked or something. Thanks for insisting though :) Now that I got it the right

Re: Configuration: either / or ?

2007-01-03 Thread Abe White
SVN revision 492368 no long ignores non-String values for openjpa.* keys in the Map passed to Persistence.createEntityManagerFactory. ___ Notice: This email message, together with any attachments, may contain information of B

Re: Configuration: either / or ?

2007-01-03 Thread Abe White
EntityManagerFactory emf = Persistence.createEntityManagerFactory ("ode-dao"); EntityManager em = emf.createEntityManager(propMap); Once again, you should be passing your props to createEntityManagerFactory, not createEntityManager. As I said, use the no-arg version of cre

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", TxMgrPr

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

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.nonJt

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 debu

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 affi

Re: Configuration: either / or ?

2007-01-03 Thread Marc Prud'hommeaux
If you enable verbose logging on all channels (by setting the property "openjpa.Log" to "DefaultLevel=TRACE"), then you should see all the properties being outputted. Note that "openjpa.ManagedRuntime" needs to be set to a plugin string or class name, not an actual object. That might be t

Re: Configuration: either / or ?

2007-01-03 Thread Matthieu Riou
I'm trying to debug why my properties don't get properly loaded. Now my code looks like: HashMap propMap = new HashMap(); propMap.put("openjpa.jdbc.DBDictionary", " org.apache.openjpa.jdbc.sql.DerbyDictionary"); propMap.put("openjpa.ManagedRuntime", new TxMgrProvider(_txMgr))

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 rig

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 specifi

Re: Configuration: either / or ?

2007-01-03 Thread Abe White
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

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 Da

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, a

Re: Configuration: either / or ?

2007-01-03 Thread Abe White
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 pass

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.Con

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,