APAR status
Closed as program error.
Error description
IBM customers requested to backport JIRA OPENJPA-1376 defect to WebSphere V7 (OpenJPA 1.2.x). https://issues.apache.org/jira/browse/OPENJPA-1376
Local fix
N/A.
Problem summary
**************************************************************** * USERS AFFECTED: All users of the Java Persistence API * * (JPA) 2.0 feature of the IBM WebSphere * * Application Server V7 Feature Pack for * * OSGi Applications and Java Persistence API * * 2.0 who make use of the 'allocationSize' * * when using the @SequenceGenerator * * annotation. * **************************************************************** * PROBLEM DESCRIPTION: OpenJPA's implementation of the * * allocationSize in a @SequenceGenerator * * is incorrectly implemented. * **************************************************************** * RECOMMENDATION: * **************************************************************** The Javadoc for the 'allocationSize' property of the @SequenceGenerator annotation defines the 'allocationSize' as follows: "The amount to increment by when allocating sequence numbers from the sequence." OpenJPA is using this value as a caching value. That is, when generating a native sequence, an SQL like the following my be generated: CREATE SEQUENCE entityE2_seq_gen START WITH 1 INCREMENT BY 50 CACHE 50 In this SQL statement, OpenJPA is using a 'CACHE 50' statement, where the value 50 is the allocationSize. By using caching, OpenJPA is requesting a sequence value from the database each time it needs a new sequence. The database is in turning caching sequence values. This results in extra calls to the database. A more efficient approach would be for OpenJPA to cache the sequence value in memory, rather than relying on the database, and thus honoring the true meaning of 'allocationSize'. Allocating values in memory allows the OpenJPA runtime to avoid accessing the database for every sequence request. That is, when 'allocationSize' is set to 50, OpenJPA will set aside the next 50 numbers each time it accesses the sequence, which in turn means it only has to make a database trip to get new sequence numbers once every 50 sequence number requests. In this case, a sequence similar to the following should be generated: CREATE SEQUENCE entityE2_seq_gen START WITH 1 INCREMENT BY 50
Problem conclusion
To enabled the code of this fix, please use the following JVM system property: -Dopenjpa.jdbc.DBDictionary=useNativeSequenceCache=false Or add the following to your persistence.xml file: <property name="openjpa.jdbc.DBDictionary" value="useNativeSequenceCache=false"/> With this fix, and the above system property, OpenJPA will use the 'allocationSize' as intended (i.e. as the increment when allocation sequence numbers). The fix for this APAR is currently targeted for inclusion in Fix Pack 1.0.0.7 for the Feature Pack for OSGi Applications and Java Persistence API 2.0. Please refer to the recommended updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix
Comments
APAR Information
APAR number
PM45107
Reported component name
JPA OSGI FEATUR
Reported component ID
5724J0857
Reported release
700
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-08-04
Closed date
2011-08-30
Last modified date
2011-08-30
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
JPA OSGI FEATUR
Fixed component ID
5724J0857
Applicable component levels
R700 PSY
UP
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
29 September 2020