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: "default_schema" property in SchemaExport.Execute
PostPosted: Mon Dec 15, 2008 8:25 am 
Newbie

Joined: Mon Dec 15, 2008 7:45 am
Posts: 1
Need help with this one. In hibernate.cfg.xml my connection_string property doesn't specify initial catalog (defafult DB), 'cause I need to be able to access different DBs on that server.
When I create Configuration object and add default_schema property (for example: "XXX.dbo") , I get folowing SQL generated:

if exists (select * from dbo.sysobjects where id = object_id(N'XXX.dbo.Entity') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table XXX.dbo.Entity
create table XXX.dbo.Entity (...)


Do you see the problem here? "(select * from dbo.sysobjects..." There is no database specified here and the script looks for Entity table in DEFAULT (i.e. master -- since I don't specify initial db in connection string prop either) database, tries to drop it and then creates table in XXX database! If you run the script twice you'll get an error "There is already an object named 'Entity' in the database."

I think the setting default_schema property to "XXX.dbo" should generate the script to this:
... select * from XXX.dbo.sysobjects...


Hibernate version:
NHibernate-2.0.0.GA


Regards
Maciej Szymanski


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.