A useful approach is to validate update intent in two places:
Perform validations that do not depend on database state in a non-EJB
JavaBean, e.g. a form bean checking field format.
Perform validations that depend on database state in a Session Bean,
with a transactional context if appropriate.
E.g.
InventoryUpdateAction {
perform(InventoryForm form) {
if (form.validate())
session.updateInventory(form.getInventoryItem())
}
}
InventoryChangeSession {
updateInventory(InventoryItem item) {
if (isValidAccountId(item.getAcctId())) ...
}
}
Fred Loney
Spirited Software, Inc.
www.spiritedsw.com
----- Original Message -----
From: "Mohammad Kargar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 22, 2001 2:07 AM
Subject: Where to put multi-entity business rules?
> Hi all,
>
> We are developing an integrated accounting-inventory environment under
J2EE.
> Say Entity A is responsible for general ledger(GL) accounts and Entity
B
> handles inventory. According to the current requirements, each
inventory
> item contains 3 account IDs from GL.
> My question is about the best place to put ID validation. One approach
is to
> ask Entity B to do this. Based on this approach Entity B does
validation by
> getting a reference to Entity A and asking it to validate ID. Another
way is
> to have a session facade to fulfill this. It means that session facade
will
> has a reference to Entity A and validates IDs before delivering them
to
> Entity B.
>
> Thanks in advance,
> Mohammad
>
>
========================================================================
===
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST". For general help, send email
to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".