How to use an existing schema as business data

Hello,

The business data as managed by Bonita uses specific columns to store the objects id or references.
For example the object identifier is stored in a special column ‘persistenceId’, or a composition link to another object is in a special column [attribute]_pid.

We have an existing database schema where rows are also identified by this kind of identifiers (long integers) but here the identifier column is named ‘id’, and the reference columns are named, for example, fk_[attribute]_id.

This database is used by other applications, on top of which we would like to implement some workflow. Renaming the id columns would be a problem.

Is it possible to access these data as business data, so that the process will read / write / create rows from this existing database ?

Any idea of how to do that ?

Remark: we know how to load data into process data using a DB connector, but here we would really want to use the business data functionalities, so that the data are always up-to-date relatively to the database when the user opens a form for example.

Thank you very much.

First things first, you don’t say what database! But anyway it doesn’t matter…the same thing will apply.

Do not confuse Bonitasoft’s persistenceId and [attribute]_pid with the databases id and fk_[attribute]_id

Bonitasoft’s persistenceId and [attribute]_pid are administrative id’s and have no relation to the actual data in the record, whereas

The databases id is an actual data field designed and implemented by the database schema designer. The fk_[attribute]_id is a foreign_key which uniquely identifies a row of another table or the same table.

So to be clear, the designer created a field called id, not the database, whereas Bonitasoft create the field persistenceId. You have complete control over id but not over persistenceId.

The term business data is being used wrong here as well, your external data is also business data, just not in the terms that Bonitasoft use. I actually hate the term business data as used by Bonitasoft as, as in this case, external data can also be business data. I’m not sure why they called it this, or what else they could have called it, but it is what it is.

Now how to fix the problem, not easy and I think you will have to do some real thinking about this, if you have other systems that also use the data then keep using the external data option on database, use REST and database connectors etc.

If not then maybe you can just use BDMs. But when doing this you will have to do the following:

Create your BDM with fields called id and fk_[attribute]_id, this way you can relate them directly to the schema previously created.

NOTE however that whereas the database would handle constraints etc. that may be found on the fk_[attribute]_id (unique, cascade delete, no-cascade delete etc.) this will not be possible with Bonitasoft. You will have to manage this yourself and suffer any consequences if you get it wrong.

An interesting challenge but one I think you need to think about and implement accordingly.

Remember one source of data is always best (but make sure it’s backed up)

regards
Seán

PS: While this may not be the complete answer you’re hoping for, and if you like it, please Mark UP and/or as Resolved.

Hello Seán,

Thanks for the long answer.

Bonita’s IDs and mine have exactly the same purpose, this is why I wondered how to unify them. PersistenceID identify the row, exactly like my ‘id’ column, the next value is provided by a sequence, and the xxx_pid columns are the foreign keys to linked rows exactly like my fk_xxx_id columns. This is a common database design.

BTW, the database is PostgreSQL.

I should have been more specific about why I wish to use Bonita’s “business data” instead of accessing the data through a connector, maybe there is another solution to the problem.

What I did so far (and it was done with Bonita 6.5, when Business Data was not available in the Community version), is to define process variables for my data, including custom objects for the complex types, and implement a connector to access the database and provide the custom objects.

On each task where it is relevant, I use an entry connector to fill/update the process variables, then the task is active and the user can update the data using the task’s form, then the variables are saved to the DB through an exit connector.

The problem is that till the task is not performed, which can last for days, the process variables will not be updated, they are loaded in the task entry connector. If some data is updated in the database meanwhile, the workflow user will still work on old, outdated values.

If I use Bonita’s “business data”, these data are loaded from the database when the user opens the form, which is enough to solve the problem (there will not be ‘simultaneous’ concurrent updates while the user actually performs the task). But then I need to insure consistency between Bonita’s IDs and mine, both ways.

Maybe there are other solutions using Bonita 7.

I could implement a REST service to provide my custom “business data” to the form, then the question will be: how to save them. I am not sure if I can call easily a REST service directly from the form to save the data ? Or use a connector defined at the task level, after that the form is submitted, would be better ? In this case, I should not use Bonita’s “business data” at all, but keep my process variables, so that Bonita persistence will not interfere with mine (Bonita’s business data are automatically persisted if I understand well) ?

Thanks