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

The Archive Base Latest Questions

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

I have a application with JPA Hibernate without Spring and I need connect to

  • 0

I have a application with JPA Hibernate without Spring and I need connect to multiple databases (with the same estructure).

The databases will be created for each client, and would have to use the same entity manager. Please I need some idea of ​​how I can do that. I am not using Spring. My application uses MySql, JPA2, Hibernate and JSF.

Thank you!

  • 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-06T19:15:32+00:00Added an answer on June 6, 2026 at 7:15 pm

    If everything is the same, except for dbname/username/pass, then create a persistence.xml with a persistance unit, put everything there which is static.

    Then use the following method to create the entity manager:

    javax.persistence.Persistence.createEntityManagerFactory(String persistenceUnitName, Map properties);
    

    Supply the variable parameters in the map, like this:

    properties.put("hibernate.connection.url", "jdbc:postgresql://127.0.0.1/test");
    properties.put("hibernate.connection.username", "joe");
    properties.put("hibernate.connection.password", "pass");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Spring application which uses JPA ( Hibernate ) initially created with
I have a Spring/JPA/Hibernate application and am trying to get it to pass my
I have a Spring/JPA application with Hibernate as the JPA provider. I've configured a
I have an application which manages 3 databases. I use hibernate with JPA on
I have an application that uses Hibernate/JPA, with Spring and Jersey. In my application
I have a web application written in Java (Spring, Hibernate/JPA, Struts2) where users can
I have an application using Tomcat/Spring 3/JPA/Hibernate but my merges do not commit to
I'm having a small problem with my insert statements in Spring-data/jpa/hibernate/mysql/junit application. I created
I have an JPA/Hibernate/Spring/Tomcat web application with second level data cache enabled for performance
I have a web application developed with Struts2, JSP, JPA, Spring and MySql. I

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.