You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hines, Bill" <bh...@hersheys.com> on 2000/11/29 19:43:37 UTC

Model Beans: No Exceptions?

In the Struts User Guide, it says that beans that represent the Model of the
system should not throw exceptions. Isn't that pretty much unavoidable when
these beans have business logic using JDBC or APIs that talk to other
back-ends, such as SAP? We're using a sort of two-level Model structure,
with a 'pure' Model bean to represent the business object, that has pretty
much only attributes and get/setters and is good for putting in the
session/request because it is lightweight, and a corresponding 'persistence'
Model bean for each class that knows how to persist it to/from a given data
source. I can see how the former wouldn't throw exceptions, but the latter
certainly will.

Bill Hines 
Computer Systems Specialist 
Sun Certified Java Programmer 
Hershey Foods Corp 
<http://www.hersheys.com> 
<http://www.hersheygifts.com> 
(717) 534-6295


Re: Model Beans: No Exceptions?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Hines, Bill" wrote:

> In the Struts User Guide, it says that beans that represent the Model of the
> system should not throw exceptions. Isn't that pretty much unavoidable when
> these beans have business logic using JDBC or APIs that talk to other
> back-ends, such as SAP? We're using a sort of two-level Model structure,
> with a 'pure' Model bean to represent the business object, that has pretty
> much only attributes and get/setters and is good for putting in the
> session/request because it is lightweight, and a corresponding 'persistence'
> Model bean for each class that knows how to persist it to/from a given data
> source. I can see how the former wouldn't throw exceptions, but the latter
> certainly will.
>

I think you are right.  I was probably thinking about form beans when I wrote
that sentence.

The user's guide has been corrected in the 1.0 code base, although it also needs
substantial updating to reflect all of the other changes that have happened
since 0.5.

>
> Bill Hines
> Computer Systems Specialist
> Sun Certified Java Programmer
> Hershey Foods Corp
> <http://www.hersheys.com>
> <http://www.hersheygifts.com>
> (717) 534-6295

Craig