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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:30:50+00:00 2026-05-27T12:30:50+00:00

DB Config: db=mysql://root@localhost/db jpa.dialect=org.hibernate.dialect.MySQLDialect …. db_other.url=jdbc:mysql://localhost/db2 db_other.driver=com.mysql.jdbc.Driver db_other.user=root db_other.pass= db_other.jpa.dialect=org.hibernate.dialect.MySQLDialect In these databases i

  • 0

DB Config:

db=mysql://root@localhost/db
jpa.dialect=org.hibernate.dialect.MySQLDialect
....
db_other.url=jdbc:mysql://localhost/db2
db_other.driver=com.mysql.jdbc.Driver
db_other.user=root
db_other.pass=
db_other.jpa.dialect=org.hibernate.dialect.MySQLDialect

In these databases i have absolutely exact tables (clones).
But the difference is that there’s different values in these tables.
(‘Value #1’ and ‘Value #2’ respectively).

A simple model:

package models;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PersistenceUnit;
import javax.persistence.Table;
import play.db.jpa.GenericModel;

@Entity
@PersistenceUnit(name="other")
@Table(name="testtable")
public class DbTest extends GenericModel {
    @Id
    public String value;
}

the rest of code:

List<DbTest> lst = DbTest.findAll();
if(!lst.isEmpty())
        System.out.println(lst.get(0).value);

It always prints Value #1. (It must be ‘Value #2’ as it’s in db2).
Surely, i’ve specified @PersistenceUnit(name=”other”).
But that doesn’t have any effect. Even if i change name of pers.unit
to random, no any errors.
This annotation is not working or just being ignored?
Or i did mistake somewhere? :/

p.s
Also, i’ve tried to get the EntityManager as it’s shown in the framework manual
(/documentation/jpa#multiple).

EntityManager em = JPA.getJPAConfig("other").em();

But it’s not possible:
<< The method getJPAConfig(String) is undefined for the type JPA >>

  • 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-27T12:30:51+00:00Added an answer on May 27, 2026 at 12:30 pm

    Play 1.2.3 does not support multiple databases. The Support for
    multiple databases section was included in this documentation page by
    mistake (the feature is only in the master branch on github).

    (cannot find the source now)

    look e.g. here: http://groups.google.com/group/play-framework/browse_thread/thread/4079cc961db8c750?pli=1

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

Sidebar

Related Questions

I am trying to set the mysql connection in web config file. Here is
I have config.time_zone in environment.rb set to UTC, and my mySQL server returns the
I am using php and mysql. I have a Database config file (db-config.php) which
config.php put at the root level, this file will be included in any pages.
I follow this article to update data to gae localhost server from MySQL. This
Using phpmyadmin, I changed the password for user root (both the localhost entry and
I have created a config file that looks like: $conf['db_hostname'] = localhost; $conf['db_username'] =
I use Hibernate (through JPA) configured by Spring and when I launch my application
config.ini: [globalloads] plugin.SWPlugin = 1 plugin.SWPlugin.params.1 = true plugin.SWPlugin.params.2 = 10 [testz : globballoads]
My config file: global maxconn 4096 # Total Max Connections. This is dependent on

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.