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 8120765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:15:19+00:00 2026-06-06T05:15:19+00:00

I develop a Java application with 4 tiers : database (MySQL), persistence (JPA), business

  • 0

I develop a Java application with 4 tiers: database (MySQL), persistence (JPA), business (POJOs similar to stateless session beans in EJB), presentation (Java Swing).

I decided to fully decouple presentation and persistence tiers. So all modifications to all data are done through the business tier. This way the presentation tier does not even know that entity classes exist. This also allows a session bean to have a better control over the data passed, because sometimes a session bean needs to validate or convert values received from the presentation before changing the entities.

However, sometimes a session bean needs to send a big amount of information (like a list of entities with lots of properties) to a caller. And this becomes complicated because according to the design I adopted session bean needs to unwrap all those entities into something else. I tried to convert the list of entities into a list of arrays (where each member of an array correspond to a property in the entity), but this seems to be so flawed, error-prone and inefficient to me.

What would be the right way to send data over to the presentation? Does the concept of hiding the entities behind the session beans make any sense at all? What is the common pattern in such applications?

  • 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-06T05:15:23+00:00Added an answer on June 6, 2026 at 5:15 am

    The common pattern is to use the JPA entities when they fit the bill (i.e. when they contain the data needed by the presentation tier, and when you don’t need to fetch half of the database to return this data), and to use DTOs (Data Transfer Objects, which are just POJOs containing the required information) when the entities don’t fit the bill.

    Some prefer to only use DTOs, like you’re doing. But DTOs should be real objects, with typed properties. Lists of arrays a nightmare to understand and maintain, do not offer any kind of type safety and compilation checks, and are not easily usable by the classical presentation tier technologies (JSP EL, etc.), which generally expect JavaBeans.

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

Sidebar

Related Questions

I was trying to develop a stockManager application in java swing with MySQL .While
i develop an java desktop application which consome sqlite database. (My pc, windows 7
I develop java application using Spring 3.0.5 and I work with database Oracle using
I am using Hibernate and mySQL. I develop the java application mostly on windows.
I am using Eclipse to develop a Blackberry Java application.Is possible to automatically increment
I want to develop a simple java web application with JBoss 7 server to
I have to develop a Java ME (formerly known as J2ME) application that will
I am planning to develop an cross platform application in Java . I am
I am currently in netbeans I develop a web application with java. I use
I am attempting to develop a Play 2.0 web application alongside a core Java

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.