Friday December 27, 2002
ChainedExceptions and BeanUtils.copyProperties
I am wondering about a few things, so thought I'd try and get some help from the best source I know - the java.blogs community. First, an update on last night. I experienced some difficulty with Hibernate (persisting child objects) and Struts (nightly build doesn't quite work right with Tiles and Modules) and gave up at 2:00 a.m. Luckily, my head cleared up this morning after a deep 4 hours of sleep and I figured out Hibernate and it appears that a fix for the Tiles/Modules problem was checked into CVS by Cedric.
Now I'm wondering if it's possible to use declared exceptions in Struts to grab all your Exceptions from the bottom up. I can do this in an Action (or even a filter) using the following:
// caught exception e
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("errors.general"));
while (e != null) {
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("errors.detail", e.getMessage()));
e = (Exception) e.getCause();
}
request.setAttribute(Globals.ERROR_KEY, errors);
Can I do this with declared exceptions? Man that would be sweet if I could - I wouldn't have to have any exception handling in my Actions. Maybe that's the easy way out, but it also makes for rapid development - and you can always add them in when you really want them. Two other things I need to do.
- I have a
java.util.Seton my User (Hibernate) object. This refers to a collection of Resume objects. When I generate my StrutsForms, I need to do something in my XDoclet template to turn ajava.util.Setinto ajava.util.ArrayList. I don't know that I have to do this, but I've always used ArrayLists or Vectors on ActionForms for child objects. - I am using
BeanUtils.copyPropertiesin a Business Delegate to transfer properties from my User object to a UserForm object. When I do this, the child objects come through as Resume objects - where I really want them to come through as ResumeForms. Is this possible usingBeanUtils, or do I have to do this manually?
I should probably do some research now to try and figure this stuff out on my own - but hopefully an answer will come through while I'm doing that ;-). I'll post to the proper mailing lists if I can't figure it out by COB. BTW, if you're using Hibernate, the FAQ is awesome. I wish more OSS (or closed-source software) had documentation this good.
Posted in Java
at Dec 27 2002, 11:40:40 AM MST
9 Comments
Search This Site
Recent Entries
- Secure JSON Services with Play Scala and SecureSocial
- My What's New in Spring 3.1 Presentation
- Twitter's Open Source Summit: Bootstrap 2.0 Edition
- Refreshing AppFuse's UI with Twitter Bootstrap
- 2011 - A Year in Review
- Upgrading AppFuse to Spring Security 3.1 and Spring 3.1
- What have I been working on at Taleo?
- Our Engaging Trip to Paris and Antwerp
- My HTML5 with Play Scala, CoffeeScript and Jade Presentation from Devoxx 2011
- Deploying Java and Play Framework Apps to the Cloud with James Ward
Posted by Lance on December 27, 2002 at 01:36 PM MST #
Posted by Gavin on December 27, 2002 at 05:34 PM MST #
Posted by Gavin on December 27, 2002 at 05:35 PM MST #
Posted by Matt on December 27, 2002 at 06:49 PM MST #
Posted by Gavin on December 27, 2002 at 10:43 PM MST #
Posted by Gavin on December 27, 2002 at 10:44 PM MST #
Posted by Gary Grubb on June 02, 2003 at 10:16 AM MDT #
Posted by Steven Radack on January 02, 2006 at 08:15 PM MST #
Posted by Rick Charles on July 22, 2006 at 01:04 AM MDT #