Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsQuestion on Native Sequence Implementation Choices..
https://www.eclipse.org/forums/index.php/mv/msg/171116/544016/#msg_544016
I'm trying to understand looking at the code how the sequencing is supported by EclipseLink.
Basically i'm trying to use a sequencing approach that could both works for example with "MySQL" and "Oracle" without force me to do different persistence unit.
In particular i found that using the following annotation:
EclipseLink is able to use the autoincrement field because mysql is supporting the autoidentityfields and not the sequencing.
So i was curious to know what would happen when the database support both ( for example H2 support both ) and i see from the following code from MetadataProject that eclipseLink use as default the "false" flag when istanting
the generator
Here the code i found:
...
for (SequenceGeneratorMetadata sequenceGenerator : m_sequenceGenerators.values()) {
String sequenceGeneratorName = sequenceGenerator.getName();
Integer allocationSize = sequenceGenerator.getAllocationSize();
if (allocationSize == null) {
// Default value, same as annotation default.
// TODO: Log a message.
allocationSize = new Integer(50);
}
NativeSequence sequence = new NativeSequence(seqName, allocationSize, false);
sequence.setQualifier(sequenceGenerator.getQualifier());
sequences.put(sequenceGeneratorName, sequence);
....
Now my question is:
It's possible to introduce a configuration parameter to let the user which approach to prefer when the database support both??
Now when both are supported the sequence approach is always used but from my point of view a good idea is to have this configurable...
Thnx in advance
Andrea Zoppello]]>Andrea Zoppello2010-07-01T11:16:38-00:00Re: Question on Native Sequence Implementation Choices..
https://www.eclipse.org/forums/index.php/mv/msg/171116/544802/#msg_544802
If you need to do something more complex, then using code in a SessionCustomizer to configure the sequences may be best. You could also define your own DatabasePlatform subclass to default the type of sequencing that you wish to use.
]]>James Sutherland2010-07-05T14:44:16-00:00