Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsAssigning a numeric sequence value to a varchar column
https://www.eclipse.org/forums/index.php/mv/msg/169993/540041/#msg_540041
I have to switch from Hibernate to EclipseLink 2.0.x and have the following problem:
We use a legacy Oracle DB and the primary keys are numbers that are stored in varchar2 columns padded with zeroes. Example: 0000012345
The primary keys are generated by a sequence that returns numeric values.
The problem is the datatype mismatch: When I declare the Java type as String, then I get this error: "Invalid type specified for identity column 'REQUEST_ID'. The only valid types for identity columns are BIGINT, INT and SMALLINT."
Is there any solution for this problem in EclipseLink or plain JPA2? In Hibernate, I use a custom "org.hibernate.id.SequenceGenerator", but I don't know how to do something similar in EclipseLink.
Thanks in advance for your help!
Stephan]]>Stephan Vollmer2010-06-14T16:28:12-00:00Re: Assigning a numeric sequence value to a varchar column
https://www.eclipse.org/forums/index.php/mv/msg/169993/540874/#msg_540874
EclipseLink supports custom sequence generation using its Sequence classes (org.eclipse.persistence.sequencing). You can register your own custom Sequence subclass on the EclipseLink Session's DatabaseLogin using a SessionCustomizer.