-->
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.  [ 3 posts ] 
Author Message
 Post subject: Configuration.BuildSessionFactory() create entity instance?
PostPosted: Fri May 26, 2006 3:31 pm 
Newbie

Joined: Fri May 26, 2006 3:05 pm
Posts: 4
Using NHibernate version 1.0.0.0

We are using nhibernate in an ASP.net 2.0 project and are have some issues.

We have noticed that when we the “BuildSessionFactory” method is called on our cfg.configuration object that nhibernate creates instances of several of our entity types. There does not seem to be anything unique out the entity objects it is instantiating (it ties to create the same 7 objs every time – we have 150 entity types total).

Creation of these entity types has become a problem because recently we have implemented role based security in the constructors of all entity types. What sometimes happens is the user who is accessing the site sometimes does not have permission to access a certain type which crashes the application.

What we need to know is why the call to “BuildSessionFactory” is creating instances of these types and how can we prevent it from doing so.

Additionally if anyone else has encountered this and has a workaround please post it here.

Kevin


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 26, 2006 5:04 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It creates the objects and reads the value of their identifier and version properties to guess the unsaved-value for them. If you set unsaved-values manually in the mapping files the objects will not be created.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 26, 2006 6:04 pm 
Newbie

Joined: Fri May 26, 2006 6:00 pm
Posts: 2
I have run into the same problem and It was missing unsaved-value tag in my xml mapping file


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.