Specified IDENTITY, got SEQUENCE
I am using SAS9 as part of JEE 5 SDK, ontop of MaxDB.
In one of my EJB 3.0 Entities, I have the following code:
@Id
@GeneratedValue(strategy = IDENTITY)
privateint id;
The code gets compiled, packaged and validated without problem.
But at deployment, SAS9 puts the following line into the log:
[#|2006-07-29T14:40:42.243+0200|WARNING|sun-appserver-pe9.0|javax.enterprise .system.core.classloading|_ThreadID=12;_ThreadName=Thread-25;_RequestID=ae15f407 -26d8-4423-b48f-8de844f9cac3;|Exception [TOPLINK-7144] (Oracle TopLink Essentials - 2006.4 (Build 060412)): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: SEQ_GEN_SEQUENCE: platform DatabasePlatform doesn't support NativeSequence.
javax.persistence.PersistenceException: Exception [TOPLINK-7144] (Oracle TopLink Essentials - 2006.4 (Build 060412)): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: SEQ_GEN_SEQUENCE: platform DatabasePlatform doesn't support NativeSequence.
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainer EntityManagerFactory(EntityManagerFactoryProvider.java:173)
It looks like SAS9's integrated OracleTopLink tries to do SEQUENCE while I specified IDENTITY. Unfortunately, SAS9 is not enabling the JSF application ontop of this persistence module in turn. As a result, my complete application is not accessible.
Sounds like a bug.
What do you think?
# 1
This post addresses the error message that you are getting:
Please don't be alarmed by the error message. Both Identity Seuqnce are treated as native sequence by toplink. Hence the error message.
Why are you getting the error message?
MaxDB is not supported platform on toplink essentials. Hence the toplink code is falling back on DatabasePlatform (the base platform for all databases). This platform is marked as not suporting native sequence
Is there any workaround?
You can use strategy=GenerationType.TABLE which is portable across all databases. You can use it along with java2db featrure of glassfish which will generate all the required tables for you.
Can you please post some more details about the issue you are having with the JSF aplpication.
# 2
> Both Identity Seuqnce are treated as native sequence by
> toplink.
But this is a clear violation of the EJB 3.0 persistence specification. So where can I report this violation to get fixed?
> MaxDB is not supported platform on toplink
> essentials.
What can I do become MaxDB to be supported? I am an experienced software engineering professional (coding more than 20 years, analysis and design more than 9 years) and would like to contribute the necessary code changes. Can you tell me where to apply for that?
> You can use strategy=GenerationType.TABLE which is
> portable across all databases.
I'll try doing that now. Actually I tried leaving it open to SAS9 to decide, but it then chooses SEQUENCE, which certainly fails in turn.
> Can you please post some more details about the issue
> you are having with the JSF aplpication.
What exactly do you need to know? I think it is obvious that JSF will no more render once SAS9 is running on severe DB failures. Or shoulf JSF render an error page?
# 3
> You can use strategy=GenerationType.TABLE which is
> portable across all databases. You can use it along
> with java2db featrure of glassfish which will
> generate all the required tables for you.
Thank you for this tip. Actually it was half the way to the final solution. Toplink was unable to add the needed tables to the MaxDB schema, so I wrote a small script that added the table (and the data row) manually, using MaxDB's native command line tools. Now it runs well. In fact it would be great if MaxDB support would be added to Toplink, since MaxDB actually supports both, SEQUENCEs and IDENTITY columns, which provides better performance than updating a TABLE. Do you know whom to ask for this?