-->
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: Two databases
PostPosted: Tue May 06, 2008 3:44 am 
Beginner
Beginner

Joined: Fri May 14, 2004 9:50 am
Posts: 28
Hello,

I'm using two Mysql database with foreign key and constraints from one table to another :

CREATE SCHEMA IF NOT EXISTS `client` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
CREATE SCHEMA IF NOT EXISTS `referencial` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;

CREATE TABLE IF NOT EXISTS `referencial`.`NETWORK` (
`NETWORK_ID` VARCHAR(45) NULL ,
`NETWORK_NAME` VARCHAR(45) NULL ,
PRIMARY KEY (`NETWORK_ID`) )
ENGINE = InnoDB;


CREATE TABLE IF NOT EXISTS `client`.`COMPANY` (
`COMPANY_ID` VARCHAR(45) NOT NULL ,
`NETWORK_ID` VARCHAR(45) NULL ,
`COMPANY_NAME` VARCHAR(45) NULL ,
PRIMARY KEY (`COMPANY_ID`) ,
CONSTRAINT `fk_COMPANY_NETWORK`
FOREIGN KEY (`NETWORK_ID` )
REFERENCES `referencial`.`NETWORK` (`NETWORK_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

CREATE INDEX fk_COMPANY_NETWORK ON `client`.`COMPANY` (`NETWORK_ID` ASC) ;


When I build my Hibernate configuration, I have two config files : each one contain the connection parameters for one database and the mapping of one table.

How could I map my two table, with for example a many-to-one relation from one file to another ?

Thanks,


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.