-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Class with mapping other classes from two diferents bases
PostPosted: Fri Mar 05, 2010 12:12 am 
Newbie

Joined: Mon Jun 01, 2009 10:53 am
Posts: 6
Hi there,

probably the Subject was not clear, so I'm going to try to explain what is the situation.

I'm developing a system (jsp, servlets, jpa, hibernate; no struts, spring or jsf) that has two diferent databases related to.

What I'm wondering is if there is a way to properly map classes from these two databases in one class.

Since I guess this still is not a good explanation I'll try to give an example.

Code:
public class Person {
    ... id and other stuff ...

    @OneToOne // from one database
    private Address address;
    @OneToOne // from another database
    private Telephone telephone;

  // getters and setters...
}


In this very moment what I do is to map address on the normal way (since person and address are in the same base) and the telephone I'm just taking the id from the other database to save on this object. And when I retrieve a Person instance I explicit make a query on the other database to bring the telephone object itself.

Well, of course my domain is not Person, Telephone and Address in two diferent databases, but that's what came in mind to explain the situation.

The problem with my approach is that decreases considerably the performance when I try to filter by the telephone...

Does anyone have a tip for me?

Thanks in advance.

Bruno Krebs


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.