[
https://issues.apache.org/jira/browse/OFBIZ-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033511#comment-13033511 ]
Philippe Mouawad commented on OFBIZ-2353:
-----------------------------------------
Hello Jacques,
No we didn't implement Karl Algorithm.
What we did was to use another ID generator that relies on Oracle Sequences.
But this approach is tightly related to Sequence mechanism available in POSTGRES, Oracle and DB2 (not mysql from what I know).
Karl approach seems right to me but I agree there's a risk of infinite loop if you don't protect with a number of tries.
I once implemented this kind of algorithm and we used Pessimistic locking (select for update in Oracle) , this feature seems to be cross DB since it exists in Hibernate so maybe it can also work.
My opinion is to rely on native DB mechanisms instead of trying it in Java.
Either Sequences if they exist everywhere or pessimistic locking
Regards
Philippe
> SequenceUtil may generate duplicate IDs in Load Balancing mode
> ---------------------------------------------------------------
>
> Key: OFBIZ-2353
> URL:
https://issues.apache.org/jira/browse/OFBIZ-2353> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: Release Branch 4.0, Release Branch 09.04, SVN trunk
> Reporter: Philippe Mouawad
> Assignee: Adam Heath
> Priority: Critical
>
> If Ofbiz is deploy on 2 servers in Load Balancing Mode
> SequenceUtil will generate duplicate IDs because synchronization is done at JVM level instead of doing it in DB.
> A good replacement implementation would be:
> org.hibernate.id.enhanced.TableGenerator
> But it would involve a dependency on Hibernate
> Philippe
> www.ubik-ingenierie.com
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira