-->
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: Prevent any loading of a mapped many-to-one association?
PostPosted: Fri Jan 16, 2009 6:32 pm 
Newbie

Joined: Wed Nov 19, 2008 3:09 pm
Posts: 4
Location: Roseville, CA
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.0.1.GA

Mapping documents: Attributes

Code between sessionFactory.openSession() and session.close():
N/A

Full stack trace of any exception that occurs:
N/A

Name and version of the database you are using:
SQL Server 2008

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A

In my entities I map a integer property for my foreign key columns. That works fine.

Currently I also map a property of entity type for the same foreign key columns. My many-to-one mapping is setup to Lazy load. But this property and mapping is really only there so I can build ICriteria queries that include the associated entities.

I need to map my many-to-one associations such that I can build ICriteria queries over them, but I don't want NHibernate to ever load the associated type into my propery. I don't want NHibernate to either load them Lazy or Eager. I have dependency injected my entity properties so that they can load themself either using a factoried DAO (business tier) or a factoried WCF Proxy (client teir).

I suppose I can can use HQL queries allow searches on associated entities, but also to prevent their loading. But I already have a nice abstraction layer that makes it easy for my developers build a search using property paths. And it was easy to directly map from my abstraction to Restrictions.

I would hate to have to start building HQL/SQL dynamically.

Right now, on my entity property many-to-one associations, I have insert="false" and update="false" and on the corresponding integer property I have the inverse.

Is there anything semantically equivalent to load="false" in a many-to-one mapping?

_________________
Thanks.
Ken.


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.