openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florian Bruckner (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-1618) Exception during factory creation due to javax.persistence.transactionType
Date Thu, 08 Apr 2010 16:41:36 GMT
Exception during factory creation due to javax.persistence.transactionType
--------------------------------------------------------------------------

                 Key: OPENJPA-1618
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1618
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.0.0-beta3
         Environment: Windows XP SP3, Java 1.6.0_19
            Reporter: Florian Bruckner


With the folliowing code:

		emProperties.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("myPu", emProperties);

This exception is thrown:

Provider named org.apache.openjpa.persistence.PersistenceProviderImpl threw unexpected exception
at create EntityManagerFactory: 
java.lang.IllegalArgumentException
java.lang.IllegalArgumentException: No enum const class javax.persistence.spi.PersistenceUnitTransactionType.JAVAX.PERSISTENCE.TRANSACTIONTYPE
	at java.lang.Enum.valueOf(Enum.java:196)
	at org.apache.openjpa.persistence.JPAProperties.getEnumValue(JPAProperties.java:207)
	at org.apache.openjpa.persistence.JPAProperties.getEnumValue(JPAProperties.java:190)
	at org.apache.openjpa.persistence.PersistenceUnitInfoImpl.fromUserProperties(PersistenceUnitInfoImpl.java:310)
	at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.endElement(PersistenceProductDerivation.java:804)
	at org.apache.openjpa.lib.meta.XMLMetaDataParser.endElement(XMLMetaDataParser.java:456)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:795)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:393)
	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:334)
	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:311)
	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:284)
	at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.parse(PersistenceProductDerivation.java:741)
	at org.apache.openjpa.persistence.PersistenceProductDerivation.parseResources(PersistenceProductDerivation.java:550)
	at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:520)
	at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:334)
	at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:89)
	at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
	at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
	at com.dreikraft.persistence.SyncSchema.testSetOwner(SyncSchema.java:32)


due to the following code in PersistenceUnitInfoImpl:

          else if (JPAProperties.TRANSACTION_TYPE.equals(key)) {
                setTransactionType(JPAProperties.getEnumValue(PersistenceUnitTransactionType.class,
key));

which quite clearly should use the value to lookup the enum value, and not the key.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message