-->
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.  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Thu Oct 06, 2005 3:17 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
bcholmes wrote:
I think you're missing the point of kbaum's post: there are three schemas in place in the production environment, and another three schemas in the sandbox environment.


Ah, you are right. I didn't interpret his first post that way. I see the problem.

I just tried this:

Code:
      Configuration cfg = new Configuration();
      ...
      cfg.configure(...);
      
      PersistentClass pc = cfg.getClassMapping("com.my.ClassName");
      
      Table table = pc.getTable();
      table.setSchema("dummy");

      SessionFactory sf = cfg.buildSessionFactory();


and it seemed to work. I think it seems a little easier than the previous similar suggestion from bcholmes. Anyway, good luck.

_________________
nathan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 3:36 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I think that easier remove schema form *hbm.xml (not only for this case, than for testing,qa production, what ever), but ...
good luck , too


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 3:40 pm 
Beginner
Beginner

Joined: Tue Aug 17, 2004 11:27 pm
Posts: 24
Quote:
I think you're missing the point of kbaum's post: there are three schemas in place in the production environment, and another three schemas in the sandbox environment.


That is correct. Each sandbox environment has one database and three schemas within that database.

Quote:
Either kbaum needs three session factories per application instance (and that might have impacts on joins) or zie has to specify which hbms have which schemas.


That's correct. Three session factories is not an option. Since we only have one session factory, we need to set the schema attribute in the hibernate mapping files.

thanks.

-karl


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 3:48 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Kbaum,
Have you different tables in every schemas or every scema have own set tables ?

for example,
Table a,b,c are in schema S1
Table d,e,f are in schema S2
...

or

Schemas S1,S2,S3 have tables a,b,c,d,e,f and S1 is production,S2 is testing and S3 is qa

If your case is last you have remove schema from hbm.xml and set schema in configuration - this is the best way - for first case I don't know - God can help you then


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:00 pm 
Beginner
Beginner

Joined: Tue Aug 17, 2004 11:27 pm
Posts: 24
Quote:
Have you different tables in every schemas or every scema have own set tables ?


Each schema has it's own tables.

Thx.

-kral


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:02 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
kbaum wrote:
Quote:
Have you different tables in every schemas or every scema have own set tables ?


Each schema has it's own tables.

Thx.

-kral


and you have production with 3 schemas, qa with 3 schemas ... ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:03 pm 
Beginner
Beginner

Joined: Tue Aug 17, 2004 11:27 pm
Posts: 24
Yep. 3 schemas in QA and 3 schemas in production.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:09 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I don't know what is 'yep', but probably yes

It is easier for this case that create different databases for production,qa etc and change url in configuration - creating databases is easy in most databeases.What is your database ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:12 pm 
Beginner
Beginner

Joined: Tue Aug 17, 2004 11:27 pm
Posts: 24
Quote:
I don't know what is 'yep', but probably yes

Yep=yes :-)

Our database is UDB. Unfortunately, I don't have a choice in our database setup. This was decided by our DBA's.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:18 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
IBM DB2 ?
Never mind, it is easy make new database for every databases

You make database for every environment - your test will be correct
or you have to make test for change schema in *.hbm.xml


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 3:03 pm 
Newbie

Joined: Tue Oct 30, 2007 2:57 pm
Posts: 1
I'm using spring 2.0.3 and hibernate 3.2 with annotations and wrote a hibernate configuration class to override the schema. I've posted the code on the spring forum at http://forum.springframework.org/showthread.php?p=148428

-Greg


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ]  Go to page Previous  1, 2

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.