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

  • Home
  • SEARCH
  • 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 9013633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:19:00+00:00 2026-06-16T03:19:00+00:00

Context I’m creating a database environment where I’d like to split data in several

  • 0

Context

I’m creating a database environment where I’d like to split data in several different schemas to be used for different groups of users. Although, one of these databases should be shared to everyone due to it contains common entities.

Suppose databases:

  • DB1 – Common entities;
    • Wheels entity
  • DB2 – Group “A”;
    • Cars entity
  • DB3 – Group “B”;
    • Motorcycles entity

I have three different projects:

  • Project 1:
    • Wheels bean
  • Project 2:
    • Cars constructor
  • Project 3:
    • Motorcycles constructor

Problem

I’m trying to access wheels (Project 1) from projects/schemas (2,”A”) and (3,”B”)

First question: Is it possible?
Second: How can I do it?

hibernate.cfg.xml in project 2 is configured to

<property name="hibernate.connection.url">jdbc:mysql://99.999.999.99:3306/DB2</property>

This necessarily must restrict all the connections to DB2, or there’s another way to add a new connection or work with all databases in 3306 port, or at least DB1?

Mapping the entities from project1 in project 2 seems not to be succeeded too, like:

<mapping class="com.company.project1.Wheels"
        package="com.company.project1.Wheels" resource="com/company/project1/Wheels.hbm.xml"/>

Configuration

  • Eclipse Indigo
  • MySql 5.5
  • Hibernate 3.0 (mapping through xml instead annotations)
  • Win 7

Thanks for helping!

  • 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-16T03:19:02+00:00Added an answer on June 16, 2026 at 3:19 am

    You can use @Table(catalog="") to specify database to which they belong to and then also can make relation across database.

    in your case Wheel maps to DB1, Car to DB2 and MotorCycle to DB3 using catalog attribute.

    i have used this solution with MySQL and MSSQL and works perfectly fine. only constraint this has all three DB has to be in same database server and user which is being used to access db should have appropriate permission to all DB.

    As this solution just adds schema name against table in all queries.

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

Sidebar

Related Questions

Context Sometimes, I like reading code on paper rather than on screen (so I
Context I'm currently reading about Clojure's implementation of monads: org.clojure/algo.monads Intuitively, reduce looks like
Context I'm building a persistence layer to abstract different types of databases that I'll
Context: static ThreadLocal<MyType> threadLocalMyType = ... What i'd like is to say something like:
Context: I'm trying to improve the values returned by the iPhone CLLocationManager, although this
Context: From my javascript web UI, I launch a long-running (several minutes) operation that
Context: I have a data grid where the following has been implemented. tabbing through
Context: .Net 3.5, C# I'd like to have caching mechanism in my Console application.
CONTEXT I have a list of items (or arbitrary length). I'd like to group
context: I have an ajax request which return data structure with an html key.

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.