-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate and struts questions
PostPosted: Thu May 06, 2004 9:20 am 
Newbie

Joined: Thu Apr 29, 2004 11:40 am
Posts: 7
My situation is as follows:

I have a new application that needs to use struts (and hibernate).
I have a legacy database.

I know you can generate hibernate mapping files from the DDL
using middlegen.

I also know that you can generate the beans (pojo's) from the
same ddl or the hibernate mapping files.

My question is now:
is it wise to generate struts ActionForm extending pojo's or
is it better to have an ActionForm that copies the pojo's
properties?

If something alters to the db model, will the generator be
smart enough to just make an update to the (at that stage
probably) altered ActionForm-bean or will it simply overwrite
everything?

-> validate() function, reset() function.

Or should the actionform fetch the data and post the data
manually?

Is there a way to reset changes to such a persistent object
(refetch, undo?) without a transaction's rollback? Or would
you need to use nested transactions?

How would one set up such an architecture where one:
- presents an add/edit form
- validates the posted input (and resends the input with
indicators of the error(s) or saves and forwards to the
next screen)

I know these are more of a struts related questions, but I do
not know where the persisting/'saving' is done in this scenario.

Anybody knows a good tutorial on struts/hibernate binding
that covers these?

thnx in advance,
Dimitri Smits
aka Gongo


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 2:47 pm 
Newbie

Joined: Tue Jan 27, 2004 3:26 pm
Posts: 18
I always separate my domain model from ActionsForms, even the are almost the same. You must think about struts ActionForms as a kind of data transfer objects rather than domain objects (as struts documentation states). ActionForms have few limitations that regular POJOs don't have, since they "maps" properties to HTML fields (which are just strings). My advice is to separate your domain model from ActionForms and use some clever frameworks like apache common's BeanUtils to copy properties from domain to ActionForms and back. Take look at latest StrutsResume release for examples. I strongly recommend you use of spring-framework, it eases struts and hibernate integration alot, and gives you unbeliveable power of IoC.

regards,
Artur


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 4:45 pm 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
karaznie wrote:
I strongly recommend you use of spring-framework, it eases struts and hibernate integration alot, and gives you unbeliveable power of IoC.


This might be a good link to help you figure out how to use Hibernate with Struts and Spring.

http://www.onjava.com/pub/a/onjava/2004/04/07/wiringwebapps.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.