• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Should we inherit an actionForm

 
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,

i have two DB tables named "inv_header" and "inv_details"

inv_header:


inv_details:


so in ActionForm , i make it details class inherit header class, is that any cons if i do this ?




thank you for guidance
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see any down side to having one ActionForm inherit from another. I will caution you not to "overthink" ActionForms, though. They're just simple JavaBeans that match the data in a JSP page. I wouldn't recommend devising elaborate inheritance structures for them.
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi merill ,

i may use the following code to get all the data in table


BeanHandler is from apache common utility, would it be heavy to carry if we have many header fields where the resultset return only Inv_details data but if Inv_details inherit the Inv_Header, it will have extra fields unnecessary inv_header fields
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would say that from an object oriented design view your use of inheritance seems to be wrong...at least as far as I am guessing at the relationship. Try to apply the "is a" rule to your inheritance. The class Dog can inherit from Mammal because "Dog is a Mammal". Is this true..."Invoice Details is an Invoice Header"? If you mean that you have one Invoice that has multiple Detail records then I would say that your Header class should contain a collection/list/array of Detail objects. You could also have your Detail class contain a reference to the Header class but I would not model this relationship with inheritance.

- Brent
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic