-->
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: Does NHibernate check for tables on init?
PostPosted: Mon Sep 19, 2005 6:56 am 
Newbie

Joined: Mon Sep 19, 2005 6:38 am
Posts: 2
I'm having a situation here where I have a web application backend library, based on NHibernate, which is shared among multiple web applications. Each of these web apps has each own, but very similar databases. The difference is: some tables might not exist in all databases.

The applications with the missing tables does of course not try to access these tables, but they all share the same .hbm.xml file (which is embedded in the backend library).

Now, the problem is that when NHibernate starts up and loads the persisters I get an error about missing object in database, even before the first real request for persistent objects. Is this correct, does NHibernate check the tables during initialization?

Is there an easy way to avoid this, like a configuration option or something?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 10:52 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
NHibernate shouldn't check the tables on startup, can you provide a debug or info log to help understand what's happening?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:36 am 
I think I see the problem now. The class/table in question is mapped as a joined-subclass. The error might occur during the first query, not the startup.

The log tells me that NHibernate.Loader.Loaders runs a query that left outer joins the base class table with all the subclasses mapped in the .hbm.xml to figure out which subclass is requested. If I remove an unused table, the query will always fail.

I guess there's no option to avoid this, so I guess the solution will be to only keep the base class mapping in the shared library and then add required subclass mappings in the client apps as needed, although this is not as transparent as I would like to.

NHibernate has worked great for me so far, and I know the this problem might sound a bit weird, but there is a different application that relies on
checking which tables are present in order to load the respective modules.

Any other suggestions? Or just to re-design it?[/i]


Top
  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:37 am 
Newbie

Joined: Mon Sep 19, 2005 6:38 am
Posts: 2
That was me, sorry, my session timed out.


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.