← Back to team overview

dhis2-devs team mailing list archive

Transactional for business logic code

 

Hi,

I have a problem while doing this patient module that I want to share with
you.

Current, I do all the business logic code on action class.

For example : I save patient, then save attributes, identifiers and
relationship of that patient, all of those actions are called from action
class. By this way, transaction can not be applied.

So I want to put those things to service class, or another layer, I'm not
sure what is the best for current frame work.

I may create a method createPatient (.. ) in service class, and pass all
needed parameters that I got from action class.

This method may throw a custom exception, or return a boolean value, to let
the action class know whether the create patient action is successful or not
.

So.. should I do this ? or keep current approach ?

Please give some advices.

Thank you,

-- 
Viet Nguyen

Follow ups