[jboss-dev-forums] [Design of JBoss jBPM] - Re: various questions

david.lloyd@jboss.com do-not-reply at jboss.com
Fri Feb 16 11:13:56 EST 2007


"alex.guizar at jboss.com" wrote : Adding a "businessKey" property to the ProcessInstance class is not the way to go, because its name and type would not be defined by the user anymore. Further, composite business keys would not be possible anymore.
  | 
  | (...complex explaination...)

Alex, I think you're missing the point here - this is not a mandatory field.  This is a field that can be used by simple applications (which I believe will be the majority).  Applications for which this field is not useful need not use it, and thus are unaffected.

"tom.baeyens at jboss.com" wrote : let me see if i get your point by proposing a solution:
  | 
  | ProcessInstances gets an new 'businessKey' property of type String.  This property is added to the constructors.  Such a business key is optional, but the combination (processDefinition, businessKey) must be unique if the businessKey is not null.  (not sure if DB's support such a unique constraint)

All databases that I know of support multi-column unique constraints that include nullable columns - that said, I'm not sure that it should be unique by default.  That is something that the user could decide.

"tom.baeyens at jboss.com" wrote : Often the business key is a reference to some other object.  So on the process definition you could specify a Converter that converts the String based business key into the referred object.

Maybe... that might be feature overkill though.  Users should be able to handle manipulating a String.

"tom.baeyens at jboss.com" wrote : The business key can be used in queries.  I'm not sure if HQL can support the type differences between the text based reference and the typical number based PK of the referred table.

It shouldn't matter - the user can just query as if it is text.  It wouldn't be a real key from the database's perspective, just a column that is indexed for efficient queries.  I think it is important to emphasize that database keys should never, ever have business meaning.

Business keys often tend to be strings anyway: think of JIRA issue keys, or account numbers that are issued by banks, telephone companies, etc., which tend to be mixed letters and numbers.

"tom.baeyens at jboss.com" wrote : I think that even in this case, you could have multiple types of processes in 1 single process definition.   Suppose that you have change orders and customer orders all being processed by the same process definition.  In that case you could compose the business key like this:
  | 
  | "customerorder["+customerOrderId+"]" for customer orders and 
  | "changeorder["+changeOrderId+"]" for change orders.
  | 
  | that makes the business key unique and still you can specify custom code to convert these business keys into the proper referred objects.

Exactly.

People, I think we just need to add a single, optional, indexed text field to ProcessInstance (and maybe Token and TaskInstance too).  I think that such a field would be handy in a variety of situations, and I also think that we don't need to add a ton of other features or complexity to make it useful.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017704#4017704

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017704



More information about the jboss-dev-forums mailing list