I am new to Aware IM.
From the getting started guide, I see this as a business rule:
IF
Member IS NEW
THEN
Member.MemberNumber = MAX Member.MemberNumber+1
In a potentially high volume environment, and where the default of database isolation level is set to READ COMMITTED (the best option), using the above logic could potentially assign the same sequential number to multiple object instances, due to dirty reads.
Does anyone know Aware IM protects against this dirty read from happening? Or, alternatively, is there a better design for this type of rule, such that underlying database objects, such as db sequences, are used. Sequences are only assigned in a locked state, and thus will never assign a duplicate value.
dirty read from database
Hi,
One bullet proof method is to use a rule like:
IF
Member IS NEW
THEN
Member.MemberNumber = SystemSettings.MemberNumber
SystemSettings.MemberNumber=SystemSettings.MemberNumber+1
With this method you cannot end up with duplicate member numbers. Use can also use auto increment on the attribute.
Cheers,
Pete
One bullet proof method is to use a rule like:
IF
Member IS NEW
THEN
Member.MemberNumber = SystemSettings.MemberNumber
SystemSettings.MemberNumber=SystemSettings.MemberNumber+1
With this method you cannot end up with duplicate member numbers. Use can also use auto increment on the attribute.
Cheers,
Pete
Pete Bradstreet
Contract developer of commercialized applications
AwareIM Ver. 8.2
Contract developer of commercialized applications
AwareIM Ver. 8.2
Thanks Pete. So, are SystemSettings attributes "read" locked during the execution of a business rule? Otherwise you could still get a dirty read in the execution of the first statement, correct?pbrad wrote:Hi,
One bullet proof method is to use a rule like:
IF
Member IS NEW
THEN
Member.MemberNumber = SystemSettings.MemberNumber
SystemSettings.MemberNumber=SystemSettings.MemberNumber+1
With this method you cannot end up with duplicate member numbers. Use can also use auto increment on the attribute.
Cheers,
Pete
Dave
One of your first challenges is to get around your existing paradigm for database management. Let the rules do the work and the database will take care of itself.
In this case, as soon as the rule is run upon saving your member object, the next member number is incremented in system settings which is always available in context to all rules and processes. There is no possibility under any conditions of the same number being made available to another object.
Pete
In this case, as soon as the rule is run upon saving your member object, the next member number is incremented in system settings which is always available in context to all rules and processes. There is no possibility under any conditions of the same number being made available to another object.
Pete
Pete Bradstreet
Contract developer of commercialized applications
AwareIM Ver. 8.2
Contract developer of commercialized applications
AwareIM Ver. 8.2
I like that. And yes, still wrapping my head around db stuff that I had to deal with in more traditional, non-object toolspbrad wrote:One of your first challenges is to get around your existing paradigm for database management. Let the rules do the work and the database will take care of itself.
In this case, as soon as the rule is run upon saving your member object, the next member number is incremented in system settings which is always available in context to all rules and processes. There is no possibility under any conditions of the same number being made available to another object.
Pete
Dave
-
- Posts: 7527
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Please read a section in the User Guide about transaction handling in Aware IM - will be useful for any database expert.
A better approach for assigning incremental ID's is to use Number attributes with "Auto-Incremented" checkbox ticked. Auto-incremented numbers have been designed specifically to guarantee uniqueness under any circumstances and avoid "dirty-reads" problem.
A better approach for assigning incremental ID's is to use Number attributes with "Auto-Incremented" checkbox ticked. Auto-incremented numbers have been designed specifically to guarantee uniqueness under any circumstances and avoid "dirty-reads" problem.
Aware IM Support Team
Excellent - thanks!aware_support wrote:Please read a section in the User Guide about transaction handling in Aware IM - will be useful for any database expert.
A better approach for assigning incremental ID's is to use Number attributes with "Auto-Incremented" checkbox ticked. Auto-incremented numbers have been designed specifically to guarantee uniqueness under any circumstances and avoid "dirty-reads" problem.
Dave