Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4077226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:31:26+00:00 2026-05-20T17:31:26+00:00

I have a struts and hibernate project, From the action class, I need to

  • 0

I have a struts and hibernate project,

  1. From the action class, I need to call the DAO, to get the data from the database.

  2. I need all the fields in the form class, to be passed to method in the DAO.

The form has about 15 fields, all are of type String.

Which is better or efficient: Pass the fields directly to the DAO, or the entire FORM object as a parameter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:31:27+00:00Added an answer on May 20, 2026 at 5:31 pm

    Imagine a method with 15 String parameters:

    public void save(String name, String firstName, String email, String ..., String ..., String ..., String ..., String ..., String ..., String ..., String ..., String ..., String ..., String ..., String ...)
    

    Oh look, a horizontal scrollbar. And a pretty small button. Hm. That looks dubious. Don’t do it.

    It’s always better to collect parameters in a parameter object if you have more than 3 or 4 of them. Long parameter lists create the following problems:

    1. You can’t omit any paramater. So if you don’t need any of them, you’ll have to pass lots of nulls or something.

    2. The order of parameters is fixed. If you need to change it, or add parameters, you’re always in trouble. If you make a mistake (and you will), there is no easy way to find out where.

      If you use a parameter object with setters and getters, you can fill in the values in any order.

    3. Parameters have no name. Example:

      method("23894623");
      

      what does that mean? Look here:

      Params params = new Params();
      params.setPhoneNumber("23894623");
      method(params);
      

      Oh, it’s a phone number. Now it’s obvious.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSP struts application that uses Spring to integrate with the services/dao/database.
I have a web app with Spring, Hibernate and Struts 2 and I get
I am working in a struts-hibernate application. I have seen a error on 3rd
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have
I have a Struts + Velocity structure like for example, a Person class, whose
I have a Struts (1.3x) ActionForm that has several String and boolean properties/fields, but
I have been working with Struts for some time, but for a project I
Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire
I have a struts form that contains many input fields generated using indexed properties.
I'm having trouble calling a method in one Struts action from a method in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.