> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf 
> Of Matthias Bohlen
> Sent: Monday, December 23, 2002 3:18 AM
> To: 'tek1'; [EMAIL PROTECTED]
> Subject: RE: [Xdoclet-devel] Hibernate, VOs and StrutsForms
> 
> 
> Hi tek1, Matt and the others,
> 
> tek1 said:
> > what you're doing sounds pretty cool...
> 
> I completely disagree with this point of view! It is 
> double-plus-uncool!
> 
> Did you ever hear of the model-view-controller pattern? The 
> model consists of your server side objects, the view is what 
> you see on the GUI, the controller is the logic you need for 
> the workflow of your application. The pattern says: "Keep 
> these separate!"

I agree with you, and I've always done it this way.  However, on the
project I'm on, the requirement is to put a GUI front-end on the
database.  This is to say that the model is the same as the view.  I
know it's screwy, but that's the way they've designed the system.  I was
merely trying to get out of writing ValidatorForms and POJOs for
Hibernate - since they will (initially) have the same getter/setters.  I
can see now that this is not going to work, and I'll resort to
hand-coding my POJOs and ValidatorForms.  

> 
> What you are trying to do is to introduce a 1:1 mapping 
> between the Hibernate objects and the form. This will make 
> your view completely depend on your model! It will cause a 
> maintenance nightmare when your project grows larger. Each 
> time you change your model, you will have to re-arrange your 
> GUI! This is a very bad thing!
> 

I always seem to end up doing this regardless.  Maybe it's because of
the projects I've been on, but most database changes (i.e. adding a
column) are to add an element to the UI.

Thanks,

Matt

> Struts tried to avoid this by inventing the Form object! The idea is:
> * The Form corresponds to the view and is simply a copy of
>   the screen fields. It has nothing to do with your model.
> * The Action drives your control flow. It transforms data
>   back and forth between model and view.
> * The server side objects (Hibernate POJOs in your case)
>   store and manage your model data.
> 
> If you keep these three separate, you will stay happy through 
> the lifetime of your application.
> 
> Cheers...
> Matthias
> 
> ----
> 
> Matthias Bohlen
> Consulting that helps project teams to succeed...
> 
> Web:
> http://www.mbohlen.de/
> 
> Snail:
> Luise-Albertz-Str. 25
> D-53340 Meckenheim
> Germany
> 
> Phone: +49 (170) 772 8545
> Fax: +49 (2225) / 945189
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of tek1
> > Sent: Sunday, December 22, 2002 4:29 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [Xdoclet-devel] Hibernate, VOs and StrutsForms
> >
> >
> > are you using an ejb task-generated VO?  if so, why?  are 
> you able to 
> > just create a simple java class and add hibernate and struts tags?
> >  sorry, i
> > don't understand the dependency on ejb VO's...
> >
> > what you're doing sounds pretty cool.  are you doing this to try to 
> > nearly automate the process of dumping data from an html form
> > directly into a
> > database table for that form?  it would be nice if in the
> > struts-config.xml
> > file if as part of the dynaform definition, a database 
> table name and
> > fields could be specified to provide this automatic data dumping
> > functionality.  sorry for going off on a tangent...
> >
> >
> >
> >
> > At 12:18 02/12/22 -0700, you wrote:
> >
> > >As you might know, I'm trying to generate StrutsForms and 
> POJOs for 
> > >Hibernate from the same class.  I'm having minimal luck and
> > about ready to
> > >throw it out the window.  A couple of problems:
> > >
> > >1.  I have to use an EntityBean in order to generate the 
> StrutsForm. 
> > >2.  I have to generate a VO for Hibernate to work, as an 
> EntityBean 
> > >cannot be instantiated using new EntityBean(); 3.  The VO only 
> > >generates methods for getters/setters.  I need an 
> addResume method on 
> > >my User object in order to associate the two.
> > >
> > >Am I a fool in trying to do something like this?  It seems
> > so - as I just
> > >feel like I'm fighting with Xdoclet and Hibernate at this
> > point - without
> > >really accomplishing anything.  I think the ideal 
> situation is thus:
> > >
> > >1.  Mark up a POJO with Hibernate and Struts Tags.
> > >2.  The POJO will be used by Hibernate as and there will be
> > no additional
> > >class generated.
> > >2.  The StrutsForm can be generated from this POJO.
> > >
> > >So since I *really* want to implement this functionality -
> > where do I dig
> > >in and make it possible?  Here's an initial stab at it:
> > >
> > >1.  Make the strutsform a possible subtask of hibernate doclet, or 
> > >possibly webdoclet.  Basically, allow it to be run on a POJO
> > rather than
> > >an EntityBean only.
> > >
> > >2.  Make the @struts.form related tags not depend on @ejb tags.
> > >
> > >Furthermore, it would be great to be able to indicate which 
> > >getter/setters get used for Hibernate, and which ones get
> > used for Struts.
> > >This might be possible using the @struts.form-field tag.  I
> > tried playing
> > >with it a little and it seemed that the only way to make it
> > work was to
> > >put a @struts.form name="" and then @struts.form
> > form-name="" - otherwise
> > >they wouldn't generate.
> > >
> > >Any advice would be great.  I'm trying to get this done
> > ASAP, and I'm way
> > >over my head here - but I don't want to resort to writing a
> > ValidatorForm
> > >and POJO by hand.  I will if I have to, but I'd rather
> > extend Xdoclet.
> > >
> > >Thanks,
> > >
> > >Matt
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf 
> > _______________________________________________
> > Xdoclet-devel mailing list [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
> >
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Xdoclet-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
> 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to