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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:28:30+00:00 2026-05-22T17:28:30+00:00

i have a local client j2se application and backend is derby(javadb) database and dao

  • 0

i have a local client j2se application and backend is derby(javadb) database and dao is jpa eclipselink .
how do i send these database pojo to a remote database which linked with spring ( jsp) application on tomcat server

simply this is a rich client with swing which connects to tomcat deployed web application. The client should receive data and send data through HTTP requests to the server-side of the service,
what would be the best solution ??

01) direct database connection/transaction through socket using Eclipselink
02) web service ??
03) just send post request to spring web application and convert it to POJO and persist to database

how do i achieve this??

  • 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-22T17:28:31+00:00Added an answer on May 22, 2026 at 5:28 pm

    DISCLAIMER I am not suggesting you port your app from Spring to EJB. Despite how people like to compare them as exclusively one or the other, you can use them both. Its your app, you can be as pragmatic as you want to be 🙂

    You don’t necessarily have to use Web Services if you wanted. You could drop the OpenEJB war file into Tomcat as well and create an Remote EJB to send data back and forth.

    Once you drop in OpenEJB you can put a remote @Stateless bean in your app like so:

    @Stateless
    @Remote
    public class MyBean implements MyBeanRemote {
        //...
    }
    
    public interface MyBeanRemote {
       // any methods you want remotely invoked
    }
    

    Then look it up and execute it over HTTP from your Swing app like so:

    Properties p = new Properties();
    p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
    p.put("java.naming.provider.url", "http://tomcatserver:8080/openejb/ejb");
    // user and pass optional
    p.put("java.naming.security.principal", "myuser");
    p.put("java.naming.security.credentials", "mypass");
    
    InitialContext ctx = new InitialContext(p);
    
    MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");
    

    Client-side all you need are the openejb-client.jar and javaee-api.jar from the OpenEJB war file and your own classes.

    Since it’s already a Spring app don’t bother trying to use @PersistenceContext to get a reference to the EntityManager so the EJB can use it. Just figure out how to expose the EntityManagerFactory that Spring creates (or you create) to the EJB via any means possible. The direct and ugly, but effective, approach would be a static on the MyBean class and a bit of startup logic that sets it. You’d just be using the EJB for remoting so no need for fancier integration.

    If you did really need web services for non-java communication or something, you can add @WebService to the top of your bean and then it will have WSDL and all that generated for it:

    @Stateless
    @Remote
    @WebService(portName = "MyBeanPort",
        serviceName = "MyBeanService",
        targetNamespace = "http://superbiz.org/wsdl"
        endpointInterface = "org.superbiz.MyBeanRemote")
    public class MyBean implements MyBeanRemote {
        //...
    }
    
    public interface MyBeanRemote {
       // any methods you want remotely invoked
    }
    

    Then you can also use the same bean as a web service like:

    Service service = Service.create(
            new URL("http://tomcatserver:8080/MyBeanImpl?wsdl"),
            new QName("http://superbiz.org/wsdl", "MyBeanService"));
    assertNotNull(service);
    
    MyBeanRemote myBean = service.getPort(MyBeanRemote.class);
    

    Both approaches are over http, but the web service approach will be a bit slower as it isn’t a binary protocol.

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

Sidebar

Related Questions

I have a web application where the client will be running off a local
I have written an ActionScript client program that tries to connect to a local
I have a local scientific application that uses threads to process independent pieces of
I have an application that connects to a database and can be used in
I have Apache server with PHP and associated local client PCs in my private
I have a code that will show the image got from a local client.
i have local WSDL file. i tried to create JAX-WS Web service client which
We have a local database of our products without the price. To get the
I'm currently developing an application with Appengine and GWT. I have to send a
I have a local network with DHCP and a few PCs. One of these

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.