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

  • SEARCH
  • Home
  • 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 8762829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:37:51+00:00 2026-06-13T15:37:51+00:00

When I create a Data transfer Object (DTO) which I use to store user

  • 0

When I create a Data transfer Object (DTO) which I use to store user input data to manager layer, I have a doubt that I’m doing it in correct way.

For example

Scenario one

public class Person{

    private String name;
    private int age;  // primitive type
    private double weight; // primitive type

}

Scenario 2

public class Person{

    private String name;
    private Integer age;
    private Double weight;

}

in this case what is the best scenario that I can use and what are the factors that I should think about when decide on each scenarios. Kindly advice me.

  • 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-06-13T15:37:52+00:00Added an answer on June 13, 2026 at 3:37 pm

    If you can use a primitive type, I would use a primitive type. Not just for performance reasons but to make it clear that null is not a valid value.

    If you have a value which can be null, use a wrapper.

    Also if you can make the fields final I would do so as well as this avoids questions of mutability and thread safety.

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

Sidebar

Related Questions

I need to create a data transfer object, which I will use for storing
I have an data transfer object called Report . These report objects are held
I have an ASP.NET MVC 2 project in which I've created a data transfer
I have a query in Data Access Object DAOComments that joins users table and
I'm attempting to create Data Access Layer for my web application. Currently, all datatables
i am new in Cassandra db. need help to create data model. i have
I want to create a data type as a TABLE but I can't use
I want to create a data store to allow me to store some data.
I need to create a data.frame that will be populated one row at a
I have an existing SQL Server database, where I store data from large specific

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.