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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:02:48+00:00 2026-05-16T12:02:48+00:00

I have a Java web application that has a ‘disconnected’ Java Swing desktop app.

  • 0

I have a Java web application that has a ‘disconnected’ Java Swing desktop app. Using the desktop app users connect to the internet and download data they need from a server. They can disconnect and use the application offline. When they reconnect to the internet they can sync their data back to the server.

The server itself is a Java EE web application and the desktop app is a limited functionality version of the web app. Up until now all business logic and data access code was coded separately for each application. The data stores were different for each application (Web is SQL Server and Desktop is Serialized objects). Some new requirements involve a lot of development to both applications. Since the functionality is the same I want to layer the data access code and business logic so I can easily reuse it for both applications.

My plan is to do the following.

1) Create a DAO library (JPA)

Switch my DAOs (currently JDBC) to use Java Persistence API. This way I can start using a RDBMS on the desktop app like derby, sql express or something similar and reuse the entites and DAO code to do all of the db operations. I can bundle this into a class library and use the same library for the web and the desktop.

2) Create a library for business logic

The web app is written in struts 2. I will take all of the logic in my Action classes and but it in POJOs. Create a jar class library with the business logic. I can add the lib to my web and desktop project. Then I can call the POJOs from my struts actions and from my desktop application.

I assume that the JPA will take care of duplicating the data access code and putting the business logic (which for the most part are dao calls) in a separate library will take care of duplicating the business logic.

So my question is: What is a good strategy for separating layers for an application that can be used online and offline?

If you have any recommendations for achieving this differently, any warning for me as I begin this project or any frameworks that might help me please let me know.

  • 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-16T12:02:49+00:00Added an answer on May 16, 2026 at 12:02 pm

    What is a good strategy for separating layers for an application that can be used online and offline?

    Well, your plan looks decent from a high-level point of view and will definitely simplify the maintenance of your applications. I don’t have much to add: create JPA entities, a service layer, and if you feel the need, a DAO layer1. Then use these parts in both of your applications, with different JPA settings.

    Here are a few additional notes:

    • I would go for a full Java database on the desktop (derby), it will be easier to manage its lifecycle.
    • Spring would provide good overall support (for layering, for declarative transaction management).
    • JPA doesn’t provide any facility for the merge or databases, you’ll have to implement that yourself and handle painful things like conflicting changes, etc.

    1 I would actually even consider skipping the DAOs and accessing JPA’s EntityManager directly from the service layer. Some people might not agree with this but the fact is that the EntityManager already implements the Domain Store pattern which does pretty much what the DAO pattern does and and there is not much value at shielding it behind a DAO.

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

Sidebar

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is, of course, Algorithm::Combinatorics and/or Set::CrossProduct but it is… May 17, 2026 at 12:47 am
  • Editorial Team
    Editorial Team added an answer Example on how to use scanner class String s =… May 17, 2026 at 12:47 am
  • Editorial Team
    Editorial Team added an answer OK, perhaps I was a bit unfair leaving this part… May 17, 2026 at 12:47 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a Java Web application that has several servlets with the following mappings.
I have a Java web application that uses a plugin architecture. I would like
I have a java web application that selects one column from table (with 6
I have a Java Web Start Application that I launch from live site by
I have built a Java application that has some dependencies (~10). I would like
I have a Java web application at my work and I'd like simplify how
I'm developing a java servlet web application that manages information from multiple databases (all
We have a Java web application and we'd like to set up some basic
Let's say I have a running Java-based web application with 0 or more valid
I am working with your typical three layered application that has a presentation layer,

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.