openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucas Smith (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OPENJPA-2185) Exception when @SequenceGenerator is used with DerbyDB
Date Sun, 06 May 2012 15:33:48 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lucas Smith updated OPENJPA-2185:
---------------------------------

    Description: 
When I want to use @SequenceGenerator I get the following exception:

Exception in thread "main" <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Error instantiating named sequence "COMPANYSEQUENCE": Your database dictionary does not support
native sequences.  To tell the dictionary how to select sequence values, use:
openjpa.jdbc.DBDictionary: NextSequenceQuery="SELECT NEXT VALUE FOR "COMPANYSEQUENCE"
Where the above string is replaced with the proper SQL for your database.
	at org.apache.openjpa.jdbc.kernel.NativeJDBCSeq.endConfiguration(NativeJDBCSeq.java:182)
	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:423)
	at org.apache.openjpa.meta.SequenceMetaData.instantiate(SequenceMetaData.java:293)
	at org.apache.openjpa.meta.SequenceMetaData.getInstance(SequenceMetaData.java:263)
	at org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:628)
	at org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:600)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:484)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)

The solution is to add:

<property name="openjpa.jdbc.DBDictionary" value="derby(NextSequenceQuery=VALUES NEXT VALUE
FOR {0})"/>

(not SELECT NEXT VALUE FOR {0} as it was suggested)

to persistence.xml.



  was:
When I want to use @SequenceGenerator I get the following exception:

Exception in thread "main" <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Error instantiating named sequence "COMPANYSEQUENCE": Your database dictionary does not support
native sequences.  To tell the dictionary how to select sequence values, use:
openjpa.jdbc.DBDictionary: NextSequenceQuery="SELECT NEXT VALUE FOR "COMPANYSEQUENCE"
Where the above string is replaced with the proper SQL for your database.
	at org.apache.openjpa.jdbc.kernel.NativeJDBCSeq.endConfiguration(NativeJDBCSeq.java:182)
	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:423)
	at org.apache.openjpa.meta.SequenceMetaData.instantiate(SequenceMetaData.java:293)
	at org.apache.openjpa.meta.SequenceMetaData.getInstance(SequenceMetaData.java:263)
	at org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:628)
	at org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:600)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:484)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)

The solution is to add:

<property name="openjpa.jdbc.DBDictionary" value="derby(NextSequenceQuery=VALUES NEXT VALUE
FOR {0})"/>

to persistence.xml.



    
> Exception when @SequenceGenerator is used with DerbyDB
> ------------------------------------------------------
>
>                 Key: OPENJPA-2185
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2185
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>         Environment: Java SE
>            Reporter: Lucas Smith
>
> When I want to use @SequenceGenerator I get the following exception:
> Exception in thread "main" <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Error instantiating named sequence "COMPANYSEQUENCE": Your database dictionary does not support
native sequences.  To tell the dictionary how to select sequence values, use:
> openjpa.jdbc.DBDictionary: NextSequenceQuery="SELECT NEXT VALUE FOR "COMPANYSEQUENCE"
> Where the above string is replaced with the proper SQL for your database.
> 	at org.apache.openjpa.jdbc.kernel.NativeJDBCSeq.endConfiguration(NativeJDBCSeq.java:182)
> 	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
> 	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
> 	at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:423)
> 	at org.apache.openjpa.meta.SequenceMetaData.instantiate(SequenceMetaData.java:293)
> 	at org.apache.openjpa.meta.SequenceMetaData.getInstance(SequenceMetaData.java:263)
> 	at org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:628)
> 	at org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:600)
> 	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:484)
> 	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> 	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
> 	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
> 	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
> 	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
> 	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
> 	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
> 	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
> 	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
> The solution is to add:
> <property name="openjpa.jdbc.DBDictionary" value="derby(NextSequenceQuery=VALUES NEXT
VALUE FOR {0})"/>
> (not SELECT NEXT VALUE FOR {0} as it was suggested)
> to persistence.xml.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message