I've not worked with Hibernate at all, so please forgive me if this is entirely off base.

but....
I know XDoclet has hibernate support. And, I know using straight EJB + Xdoclet + Struts, I can have it generated ActionForms directly from my EJB classes. The ActionForms have support (accessors) in them to return Value and Data Objects, which can then be used to update/populate EJBs. Im going to guess there's probably a very similar mechanism for use with Hibernate.
Cuts out all the work of using bean copiers, and all your associated classes are kept in sync with the original data model.


my $0.02, hth.

-- adam


From: Vilya Harvey <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: Struts + Hibernate: A few newbie questions about how to get this right?
Date: Thu, 24 Jul 2003 16:05:55 +0100


Thorbjørn Ravn Andersen wrote:
* Can I use a persistant bean as my FormBean (or would that be asking for inconsistencies), or should I work with a DynaBean and then copy the result to the persistant bean in the end? I will probably need some validation.

You could, I believe, but AFAIK it's not recommended. The Struts form beans are really part of the view layer and should be kept separate from the business and persistence layers where possible. A better approach is to use a DynaBean for collecting the form data and have the actions copy it into the appropriate model class.


* If not, is there an easy way to populate such a DynaBean from my persistant bean and vice versa? I would rather not have to write a lot of setXX( getXX()) statements.

Have a look at the commons-beanutils package that comes with Struts. In particular, you'll probably find BeanUtils.copyProperties() quite helpful.


Hope that helps,
Vil.
--
Vilya Harvey
[EMAIL PROTECTED]                 / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457                 http://www.digitalsteps.com/

--Disclaimer--

This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this email and you are not a named
addressee, please inform the sender at Digital Steps Ltd by phone on
+44 (0)1483 469 480 or by reply email and then delete the email from
your system. If you are not a named addressee you must not use,
disclose, distribute, copy, print or rely on this email. Although
Digital Steps Ltd routinely screens for viruses, addressees should
check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this
email or any attachments.

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to