-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate and DB2 -- Schema problems
PostPosted: Thu Sep 13, 2007 12:23 pm 
Newbie

Joined: Thu Sep 13, 2007 12:19 pm
Posts: 2
Hello,
Is anybody using hibernate and db2?

The issue I'm having is that I have three different schema's for each of the three different environments of test, integration and production. DB2 requires the schema be defined or it defaults to the ID.tablename where ID is the username that was used to establish the original connection.

I am using the <prop key="hibernate.default_schema">${defaultSchema}</prop> and using a property file to store the defaultSchema variable.

Does anybody have any idea how to work around this problem without having to deploy three separate ears with a different schema coded for each ear? I could hit the servers environmental variable to find out which server I'm on but that doesn't do me any good since everything in hibernate is done through xml.

My projects works flawlessly as long as I deploy the correct ear. with the correct schema, to the correct env.

I don’t this issue for my MS SQL or Synapse data sources of course as I don’t have to define a default schema.

Thanks,
Matt Hillesheim


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 14, 2007 11:15 am 
Newbie

Joined: Tue Sep 04, 2007 2:21 pm
Posts: 14
Essentially you need to keep the schema name configuration setting outside your ear file. There are a couple of ways to do this....

Based on your description could you keep your property file in a directory on the app server (outside your ear) and include that directory in the server or application's classpath?

HTH
Tom


Top
 Profile  
 
 Post subject: Re: Hibernate and DB2 -- Schema problems
PostPosted: Fri Sep 14, 2007 11:53 am 
Newbie

Joined: Mon Sep 10, 2007 2:49 pm
Posts: 3
You can have different property files for each environment and since you are saying that you can determine in which environment you are running load that particular property file for example ,create propertis file for Dev.properties for Development, test.properties for test Environment . During the start of tha application make this a task for initialisation. You can have something like an EnvironmentConfigurer ...


Top
 Profile  
 
 Post subject: found the solution...
PostPosted: Wed Sep 19, 2007 11:19 am 
Newbie

Joined: Thu Sep 13, 2007 12:19 pm
Posts: 2
Hola,
What I didn't know is there is a defaultSchema property at the data source level. It is located in the custom properties for the data source.

I just needed to set that property for each data source and it works like a charm.

Just wanted to chime back in for anybody else that may have this issue.

-matt


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

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.