Re: @IdClass annotation for id field of type byte[]
Marc, Supposedly, this problem is only happening on Oracle. It's working just fine with DB2 and Derby. This is a bit long, but here's the call stack for the problem... I have also attached the java files for the ManagedEntity, Guid, and Agent classes. 1500 TRACE [main] openjpa.MetaData - Resolving field " [EMAIL PROTECTED]". <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: Errors encountered while resolving metadata. See nested exceptions for details. at org.apache.openjpa.meta.MetaDataRepository.resolve( MetaDataRepository.java:501) at org.apache.openjpa.meta.MetaDataRepository.getMetaData( MetaDataRepository.java:283) at org.apache.openjpa.meta.MetaDataRepository.getMetaData( MetaDataRepository.java:338) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData (JPQLExpressionBuilder.java:151) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData( JPQLExpressionBuilder.java:131) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData( JPQLExpressionBuilder.java:211) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData( JPQLExpressionBuilder.java:181) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType (JPQLExpressionBuilder.java:174) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$1( JPQLExpressionBuilder.java:173) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate( JPQLExpressionBuilder.java:1658) at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java :52) at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation( ExpressionStoreQuery.java:145) at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java :642) at org.apache.openjpa.kernel.QueryImpl.compilationFromCache( QueryImpl.java:623) at org.apache.openjpa.kernel.QueryImpl.compileForCompilation( QueryImpl.java:589) at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java :651) at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1464) at org.apache.openjpa.kernel.DelegatingQuery.getOperation( DelegatingQuery.java:120) at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:202) at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java :251) at jpa.test.LoadTestCase.testLoadAgents(LoadTestCase.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196) Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping that supports joins. at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable( ClassMapping.java:235) at org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy.map( VerticalClassStrategy.java:99) at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy( ClassMapping.java:343) at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy (RuntimeStrategyInstaller.java:52) at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping( MappingRepository.java:305) at org.apache.openjpa.meta.MetaDataRepository.preMapping( MetaDataRepository.java:600) at org.apache.openjpa.meta.MetaDataRepository.resolve( MetaDataRepository.java:487) ... 33 more NestedThrowables: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping that supports joins. at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable( ClassMapping.java:235) at org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy.map( VerticalClassStrategy.java:99) at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy( ClassMapping.java:343) at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy (RuntimeStrategyInstaller.java:52) at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping( ClassMapping.java:768) at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java :1569) at org.apache.openjpa.meta.MetaDataRepository.processBuffer( MetaDataRepository.java:65
Re: svn commit: r492225 - in /incubator/openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-jdbc/src/main/resourc
I don't agree with this implementation. It doesn't leave any room for customization through MappingDefaults, it ties the ClassMapping to the XMLSchemaParser (?!), and it's totally different than our mapping of indexes, foreign keys, and primary keys, the other supported constraint types. +mapUniqueConstraints(); +} + +/** + * Adds unique constraints to the mapped table. + * + */ +void mapUniqueConstraints() { +Log log = getRepository().getLog(); +Collection uniqueInfos = _info.getUniqueConstraints(); +if (uniqueInfos == null || uniqueInfos.isEmpty()) +return; +Iterator iter = uniqueInfos.iterator(); +Table table = getTable(); +int i = 1; +while (iter.hasNext()) { +XMLSchemaParser.UniqueInfo uniqueInfo = +(XMLSchemaParser.UniqueInfo)iter.next(); +if (uniqueInfo.cols == null || uniqueInfo.cols.isEmpty()) +continue; +String constraintName = table.getName() + "_UNIQUE_" + i; +i++; +Unique uniqueConstraint = table.addUnique (constraintName); +Iterator uniqueColumnNames = uniqueInfo.cols.iterator(); +while (uniqueColumnNames.hasNext()) { +String uniqueColumnName = (String) uniqueColumnNames.next(); +Column uniqueColumn = table.getColumn (uniqueColumnName); +if (uniqueColumn != null) { +uniqueConstraint.addColumn(uniqueColumn); +} else { +table.removeUnique(uniqueConstraint); +if (log.isWarnEnabled()) +log.warn(_loc.get("missing-unique-column", this, +table.getName(), uniqueColumnName)); +break; +} } } } ___ 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: @IdClass annotation for id field of type byte[]
Can you file a JIRA report for the time being? Nothing immediately suspicious jumps out at me in the stack trace, but I am still fairly confident that this has something to do with our special blob handling in Oracle. On Jan 3, 2007, at 10:14 AM, Kevin Sutter wrote: Marc, Supposedly, this problem is only happening on Oracle. It's working just fine with DB2 and Derby. This is a bit long, but here's the call stack for the problem... I have also attached the java files for the ManagedEntity, Guid, and Agent classes. 1500 TRACE [main] openjpa.MetaData - Resolving field "[EMAIL PROTECTED]". <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : Errors encountered while resolving metadata. See nested exceptions for details. at org.apache.openjpa.meta.MetaDataRepository.resolve (MetaDataRepository.java:501) at org.apache.openjpa.meta.MetaDataRepository.getMetaData (MetaDataRepository.java:283) at org.apache.openjpa.meta.MetaDataRepository.getMetaData (MetaDataRepository.java:338) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData( JPQLExpressionBuilder.java :151) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaD ata(JPQLExpressionBuilder.java:131) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD ata(JPQLExpressionBuilder.java :211) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD ata(JPQLExpressionBuilder.java:181) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType( JPQLExpressionBuilder.java :174) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$1 (JPQLExpressionBuilder.java:173) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder $ParsedJPQL.populate(JPQLExpressionBuilder.java:1658) at org.apache.openjpa.kernel.jpql.JPQLParser.populate (JPQLParser.java:52) at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation (ExpressionStoreQuery.java:145) at org.apache.openjpa.kernel.QueryImpl.newCompilation (QueryImpl.java:642) at org.apache.openjpa.kernel.QueryImpl.compilationFromCache (QueryImpl.java:623) at org.apache.openjpa.kernel.QueryImpl.compileForCompilation (QueryImpl.java:589) at org.apache.openjpa.kernel.QueryImpl.compileForExecutor (QueryImpl.java:651) at org.apache.openjpa.kernel.QueryImpl.getOperation (QueryImpl.java:1464) at org.apache.openjpa.kernel.DelegatingQuery.getOperation (DelegatingQuery.java:120) at org.apache.openjpa.persistence.QueryImpl.execute (QueryImpl.java:202) at org.apache.openjpa.persistence.QueryImpl.getResultList (QueryImpl.java:251) at jpa.test.LoadTestCase.testLoadAgents(LoadTestCase.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected (TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java :478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196) Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping that supports joins. at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable (ClassMapping.java:235) at org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy.map (VerticalClassStrategy.java:99) at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy (ClassMapping.java:343) at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy( RuntimeStrategyInstaller.java:52) at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping (MappingRepository.java:305) at org.apache.openjpa.meta.MetaDataRepository.preMapping (MetaDataRepository.java:600) at org.apache.openjpa.meta.MetaDataRepository.resolve (MetaDataRepository.java:487) ... 33 more NestedThrowables: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping that supports joins. at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable (ClassMapping.java:235) at org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy.map (VerticalClassStrategy.java:99) at org.apache.openjpa.jdbc.met
Re: BrokerImpl using thread class loader?
Dain- Note that in many cases, we track the thread's context class loader, but only use it as an auxiliary loader to check when searching for classes: typically, class loading will go happen via the Configuration's getClassResolverInstance(). That isn't to say that there aren't potential problems with our class loading, but if we were only using global class loaders, then we wouldn't be working with EJBs deployed in application servers (which we clearly are). Maybe if you could provide some stack traces and more information on the environment in which class loading is being seen to fail, we can investigate more thoroughly. On Jan 3, 2007, at 12:29 AM, Dain Sundstrom wrote: The BrokerImpl class initializes the _loader to Thread.currentThread ().getContextClassLoader() when constructed (when an EM is constructed). This cl is used while loading the mappings file. This causes the entity classes to be loaded from the thread context class loader instead of the class loader specified in the PersistenceUnit. Is this expected behavior? In the mean time, I'll code around it. -dain
Re: Should UserTransaction Work?
Hi Don, On 1/1/07, Craig L Russell <[EMAIL PROTECTED]> wrote: Hi Don, The short answer is yes, UserTransaction is supposed to work. On Jan 1, 2007, at 11:52 AM, Don Brady wrote: > I cannot get UserTransaction to work. > > Nothing happens when I commit. Is the symptom that the commit succeeds but there is no change in the database? > > This consists of: > > - Using a JTA datasource > - specifying Bean Managed Transaction rather then CMT on the > enclosing session Bean. > - looking up a UserTransaction with: > UserTransaction userTran = (UserTransaction) initCtx >.lookup("java:comp/UserTransaction"); > > then doing a begin on it, some entity lookup and changes, and a > commit. Is the EntityManagerFactory (PersistenceUnit) also declared as JTA, in addition to the DataSource that it uses? Both need to be JTA-enabled. > > Could anyone tell me if this should work? > This is under WebSphere 6.1. > > As background, I am able to get a JTA data source to work fine if I > use Container Managed Transactions rather than BMT. The problem > with that approach for me is that I am calling the session Bean as > a web-service-enable endpoint. If I leave committing the > transaction entirely to JTA, the commit is done after all of my > web service code has exited and any errors are thrown as soap > faults. I want to be able to catch the error and analyze it > before returning from the web service. I can also do this fine > with Resource Local Transactions but then I do not get the benefits > of a JTA datasource managed by WebSphere. And the possibility of using other transactional resources as well. If you lookup the UserTransaction in your Session Bean, then your approach should work. I tried making the Feature Pack sample application a BMT bean and it seemed to work for me. I can send you the application if you'd like. If the transaction is started prior to looking up a BMT bean, then it will be suspended before the bean method executes. I don't know much about web services, this might not be the case or possible. > > So I am trying to use JTA with BMT which I believe would allow me > to catch errors on commit. Right, this is a good pattern to use in order to wrap database errors with your own (presumably more user-friendly) exceptions. Craig > > If this is too much of a user question for this list, please let > me know. > > Thanks! > > Don > > > > > > > > Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp! Hope this helps, -- -Michael Dick
Re: Should UserTransaction Work?
Don, One clarification... On 1/1/07, Don Brady <[EMAIL PROTECTED]> wrote: This is under WebSphere 6.1. Are you attempting to use OpenJPA with standard WebSphere 6.1 (ala the DeveloperWorks article that Roland and I wrote -- http://www-128.ibm.com/developerworks/websphere/techjournal/0612_barcia/0612_barcia.html), or are you using the EJB3/JPA Feature Pack ( https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/was61ejb3/)? The Feature Pack support is a much more integrated solution. The answers to your questions may depend on the environment. Thanks! Kevin
Configuration: either / or ?
Hi all, 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. My expectations would have been to have both the xml file and the map being used. One or the other can prevail if a property is defined twice but I think the map shouldn't be plainly ignored when provided. What do you think? Would that be a bug or is it the desired behavior? Thanks! Matthieu
Re: Configuration: either / or ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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)); propMap.put("openjpa.ConnectionDriverName", org.apache.derby.jdbc.EmbeddedDriver.class.getName()); propMap.put("openjpa.ConnectionFactory", _datasource); EntityManagerFactory emf = Persistence.createEntityManagerFactory ("ode-dao"); EntityManager em = emf.createEntityManager(propMap); Where are the properties set on JDBConfigurationImpl? So I can check what gets wrong in my case. Thanks, Matthieu On 1/3/07, Matthieu Riou <[EMAIL PROTECTED]> wrote: 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 ?
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 the cause of your problem. On Jan 3, 2007, at 6:03 PM, Matthieu Riou wrote: 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)); propMap.put("openjpa.ConnectionDriverName", org.apache.derby.jdbc.EmbeddedDriver.class.getName()); propMap.put("openjpa.ConnectionFactory", _datasource); EntityManagerFactory emf = Persistence.createEntityManagerFactory ("ode-dao"); EntityManager em = emf.createEntityManager(propMap); Where are the properties set on JDBConfigurationImpl? So I can check what gets wrong in my case. Thanks, Matthieu On 1/3/07, Matthieu Riou <[EMAIL PROTECTED]> wrote: 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. > >> > >
[jira] Updated: (OPENJPA-95) @IdClass annotation for id field type of byte[]
[ https://issues.apache.org/jira/browse/OPENJPA-95?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Sutter updated OPENJPA-95: Attachment: ManagedElement.java Guid.java Agent.java > @IdClass annotation for id field type of byte[] > --- > > Key: OPENJPA-95 > URL: https://issues.apache.org/jira/browse/OPENJPA-95 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Environment: Oracle >Reporter: Kevin Sutter > Assigned To: Marc Prud'hommeaux > Attachments: Agent.java, Guid.java, ManagedElement.java > > > This problem was first reported via the dev mailing list starting with this > message: > http://mail-archives.apache.org/mod_mbox/incubator-open-jpa-dev/200701.mbox/[EMAIL > PROTECTED] > It seems that we are having a problem with processing byte[] fields as > identity fields when running with Oracle. The same scenario works just fine > with DB2 and Derby. Marc seems to think this is related to some special blob > processing that is in place for Oracle. > The Exception (and message) that is thrown is: > Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: > You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a > mapping that supports joins. > The complete call stack follows: > 1500 TRACE [main] openjpa.MetaData - Resolving field "[EMAIL > PROTECTED]". > <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : Errors > encountered while resolving metadata. See nested exceptions for details. > at > org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:501) > at org.apache.openjpa.meta.MetaDataRepository.getMetaData > (MetaDataRepository.java:283) > at > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:338) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java > :151) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:131) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java > :211) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:181) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java > :174) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$1(JPQLExpressionBuilder.java:173) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1658) > at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:52) > at > org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:145) > at org.apache.openjpa.kernel.QueryImpl.newCompilation (QueryImpl.java:642) > at > org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:623) > at > org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:589) > at org.apache.openjpa.kernel.QueryImpl.compileForExecutor > (QueryImpl.java:651) > at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1464) > at > org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:120) > at org.apache.openjpa.persistence.QueryImpl.execute (QueryImpl.java:202) > at > org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251) > at jpa.test.LoadTestCase.testLoadAgents(LoadTestCase.java:30) > at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected (TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java > :478) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: > You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a > mapping that supports joins. > at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable > (ClassMapp
[jira] Created: (OPENJPA-95) @IdClass annotation for id field type of byte[]
@IdClass annotation for id field type of byte[] --- Key: OPENJPA-95 URL: https://issues.apache.org/jira/browse/OPENJPA-95 Project: OpenJPA Issue Type: Bug Components: jdbc Environment: Oracle Reporter: Kevin Sutter Assigned To: Marc Prud'hommeaux Attachments: Agent.java, Guid.java, ManagedElement.java This problem was first reported via the dev mailing list starting with this message: http://mail-archives.apache.org/mod_mbox/incubator-open-jpa-dev/200701.mbox/[EMAIL PROTECTED] It seems that we are having a problem with processing byte[] fields as identity fields when running with Oracle. The same scenario works just fine with DB2 and Derby. Marc seems to think this is related to some special blob processing that is in place for Oracle. The Exception (and message) that is thrown is: Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping that supports joins. The complete call stack follows: 1500 TRACE [main] openjpa.MetaData - Resolving field "[EMAIL PROTECTED]". <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : Errors encountered while resolving metadata. See nested exceptions for details. at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:501) at org.apache.openjpa.meta.MetaDataRepository.getMetaData (MetaDataRepository.java:283) at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:338) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java :151) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:131) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java :211) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:181) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java :174) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$1(JPQLExpressionBuilder.java:173) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1658) at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:52) at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:145) at org.apache.openjpa.kernel.QueryImpl.newCompilation (QueryImpl.java:642) at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:623) at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:589) at org.apache.openjpa.kernel.QueryImpl.compileForExecutor (QueryImpl.java:651) at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1464) at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:120) at org.apache.openjpa.persistence.QueryImpl.execute (QueryImpl.java:202) at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251) at jpa.test.LoadTestCase.testLoadAgents(LoadTestCase.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected (TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java :478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping that supports joins. at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable (ClassMapping.java:235) at org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy.map(VerticalClassStrategy.java:99) at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:343) at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:52) at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:305) at org.apache.openjpa.meta.MetaDataReposit
Re: @IdClass annotation for id field of type byte[]
Marc, Just opened OPENJPA-95 for this problem. Thanks, Kevin On 1/3/07, Marc Prud'hommeaux <[EMAIL PROTECTED]> wrote: Can you file a JIRA report for the time being? Nothing immediately suspicious jumps out at me in the stack trace, but I am still fairly confident that this has something to do with our special blob handling in Oracle. On Jan 3, 2007, at 10:14 AM, Kevin Sutter wrote: > Marc, > Supposedly, this problem is only happening on Oracle. It's working > just fine with DB2 and Derby. This is a bit long, but here's the > call stack for the problem... I have also attached the java files > for the ManagedEntity, Guid, and Agent classes. > > 1500 TRACE [main] openjpa.MetaData - Resolving field > "[EMAIL PROTECTED]". > <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : > Errors encountered while resolving metadata. See nested exceptions > for details. > at org.apache.openjpa.meta.MetaDataRepository.resolve > (MetaDataRepository.java:501) > at org.apache.openjpa.meta.MetaDataRepository.getMetaData > (MetaDataRepository.java:283) > at org.apache.openjpa.meta.MetaDataRepository.getMetaData > (MetaDataRepository.java:338) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData( > JPQLExpressionBuilder.java :151) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaD > ata(JPQLExpressionBuilder.java:131) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD > ata(JPQLExpressionBuilder.java :211) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD > ata(JPQLExpressionBuilder.java:181) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType( > JPQLExpressionBuilder.java :174) > at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$1 > (JPQLExpressionBuilder.java:173) > at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder > $ParsedJPQL.populate(JPQLExpressionBuilder.java:1658) > at org.apache.openjpa.kernel.jpql.JPQLParser.populate > (JPQLParser.java:52) > at > org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation > (ExpressionStoreQuery.java:145) > at org.apache.openjpa.kernel.QueryImpl.newCompilation > (QueryImpl.java:642) > at org.apache.openjpa.kernel.QueryImpl.compilationFromCache > (QueryImpl.java:623) > at org.apache.openjpa.kernel.QueryImpl.compileForCompilation > (QueryImpl.java:589) > at org.apache.openjpa.kernel.QueryImpl.compileForExecutor > (QueryImpl.java:651) > at org.apache.openjpa.kernel.QueryImpl.getOperation > (QueryImpl.java:1464) > at org.apache.openjpa.kernel.DelegatingQuery.getOperation > (DelegatingQuery.java:120) > at org.apache.openjpa.persistence.QueryImpl.execute > (QueryImpl.java:202) > at org.apache.openjpa.persistence.QueryImpl.getResultList > (QueryImpl.java:251) > at jpa.test.LoadTestCase.testLoadAgents(LoadTestCase.java:30) > at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected (TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > (RemoteTestRunner.java :478) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run > (RemoteTestRunner.java:344) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main > (RemoteTestRunner.java:196) > Caused by: <4|true|0.0.0> > org.apache.openjpa.persistence.ArgumentException: You cannot join > on column "MNGD_ELEMENT.ME_GUID". It is not managed by a mapping > that supports joins. > at org.apache.openjpa.jdbc.meta.ClassMapping.assertJoinable > (ClassMapping.java:235) > at org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy.map > (VerticalClassStrategy.java:99) > at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy > (ClassMapping.java:343) > at > org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy( > RuntimeStrategyInstaller.java:52) > at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping > (MappingRepository.java:305) > at org.apache.openjpa.meta.MetaDataRepository.preMapping > (MetaDataRepository.java:600) > at org.apache.openjpa.meta.MetaDataRepository.resolve > (MetaDataRepository.java:487) > ... 33 more > NestedThrowables: > <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : > You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not > managed by a mapping that supports j
[jira] Commented: (OPENJPA-95) @IdClass annotation for id field type of byte[]
[ https://issues.apache.org/jira/browse/OPENJPA-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462082 ] Kevin Sutter commented on OPENJPA-95: - I just attached the three files (Agent, Guid, and ManagedElement) used to reproduce the problem. > @IdClass annotation for id field type of byte[] > --- > > Key: OPENJPA-95 > URL: https://issues.apache.org/jira/browse/OPENJPA-95 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Environment: Oracle >Reporter: Kevin Sutter > Assigned To: Marc Prud'hommeaux > Attachments: Agent.java, Guid.java, ManagedElement.java > > > This problem was first reported via the dev mailing list starting with this > message: > http://mail-archives.apache.org/mod_mbox/incubator-open-jpa-dev/200701.mbox/[EMAIL > PROTECTED] > It seems that we are having a problem with processing byte[] fields as > identity fields when running with Oracle. The same scenario works just fine > with DB2 and Derby. Marc seems to think this is related to some special blob > processing that is in place for Oracle. > The Exception (and message) that is thrown is: > Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: > You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a > mapping that supports joins. > The complete call stack follows: > 1500 TRACE [main] openjpa.MetaData - Resolving field "[EMAIL > PROTECTED]". > <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException : Errors > encountered while resolving metadata. See nested exceptions for details. > at > org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:501) > at org.apache.openjpa.meta.MetaDataRepository.getMetaData > (MetaDataRepository.java:283) > at > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:338) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java > :151) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:131) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java > :211) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:181) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java > :174) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$1(JPQLExpressionBuilder.java:173) > at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1658) > at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:52) > at > org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:145) > at org.apache.openjpa.kernel.QueryImpl.newCompilation (QueryImpl.java:642) > at > org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:623) > at > org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:589) > at org.apache.openjpa.kernel.QueryImpl.compileForExecutor > (QueryImpl.java:651) > at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1464) > at > org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:120) > at org.apache.openjpa.persistence.QueryImpl.execute (QueryImpl.java:202) > at > org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251) > at jpa.test.LoadTestCase.testLoadAgents(LoadTestCase.java:30) > at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected (TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java > :478) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.ArgumentException: > You cannot join on column "MNGD_ELEMENT.ME_GUID". It is not managed by a > mapping that supports joins. > at org.apache.openjpa.jdbc.meta.Cl
Re: Configuration: either / or ?
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 ?
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 ?
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 ?
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 ?
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.
Re: Configuration: either / or ?
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 createEntityManager: EntityManagerFactory emf = Persistence.createEntityManagerFactory ("ode-dao", propMap); EntityManager em = emf.createEntityManager(); ___ 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 ?
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 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 ?
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 way, it seems to work as the I get the right value for ConnectionFactory in the log after setting javax.persistence.nonJtaDataSource as you recommended: openjpa.ConnectionFactory: [EMAIL PROTECTED] I'm hitting another problem but it comes from my code. I'll let you know if I can get everything working this way. Thanks a lot for your help! On 1/3/07, Abe White <[EMAIL PROTECTED]> wrote: >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 createEntityManager: EntityManagerFactory emf = Persistence.createEntityManagerFactory ("ode-dao", propMap); EntityManager em = emf.createEntityManager(); ___ 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.