hibernate - Saving master detail entities -


i have small invoicing app have (invoicemaster) , (invoicedetails) entities, facing problem on how save master , details in same time / in other words in 1 transaction...

i have following classes in application:

- invoicemasterdao - invoicedetailsdao  - invoicemasterservice - invoicedetailsservice 

and thinking shall call invoicemasterdao, invoicedetailsdao save method within invoicemasterservice class? if did there no use invoicedetailsservice class?

or shall create invoiceservice class , use to control both invoicemasterdao, invoicedetailsdao in same time?

taking in consideration saving invoice me means, saving master, saving details, deducting product balances.....or rollback in case went wront

kindly advice

it's you, having invoiceservice looks more logical me.

services shouldn't designed 1 service per entity. should designed logical group of ... services caller needs (the ui layer, usually). in other words, should use-case oriented, , not entity-oriented.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -