lazy-loading

Lazy Load An Entity Framework EntityCollection with criteria

In Entity Framework (specifically EF 3.5, but if it exists in EF 4 it gives me a reason to upgrade) is it possible to lazy load only part of a collection? I may be approaching this wrong too, so I'm open to suggestions. My tables/entities look similar to this: Person PersonMeal Meal ------ 1---* ---------- ...

NHibernate correct way to reattach cached entity to different session

I'm using NHibernate to query a list of objects from my database. After I get the list of objects over them I iterate over the list of objects and apply a distance approximation algorithm to find the nearest object. I consider this function of getting the list of objects and apply the algorithm over them to be a heavy operation so I cach...

NHibernate - is property lazy loading possible?

I've got some binary data that I store and was going to separate this out into a separate table so it could be lazy loaded. However, i then came across this post by Ayende (http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx) which suggests that property lazy loading is now possible. I have added the l...

NHibernate unintentional lazy property loading

I introduced a mapping for a business object which has (among others) a property called "Name": public class Foo : BusinessObjectBase { ... public virtual string Name { get; set; } } For some reason, when I fetch "Foo" objects, NHibernate seems to apply lazy property loading (for simple properties, not associations): The foll...

Hibernate Lazy Loading Proxy Incompatable w/ Other Frameworks

I've come across several instances where frameworks that take POJOs to do some work crap-out with proxied hibernate beans. For example if I xml annotate a bean for framework X and pass it to framework X it doesn't recognise the bean because it is passed the proxied object - which has no annotations for framework X. Is there a common s...

Disable lazy loading by default in Entity Framework 4

It seems that lazy loading is enabled by default in EF4. At least, in my project, I can see that the value of dataContext.ContextOptions.LazyLoadingEnabled is true by default. I don't want lazy loading and I don't want to have to write: dataContext.ContextOptions.LazyLoadingEnabled = false; each time I get a new context. So is t...

Help needed with Spring/Hibernate Lazy-loading

Hi, I know that this has been discussed lot of times. I just can't understand how this work or where my mistake is. I think giving you a reduced example is the best way to show you what I'm trying to do and what assumptions I'm taking... I have a Product class with a name. The name is a String property that is lazy. My DAO: public ab...

Is there any utility or built in class in NHibernate that force a class to load it without lazy in a special situation?

I have an web application that uses NHibernate as ORM. I enable lazy loading for my classes but I want to load some classes without lazy in a special situation. Now is there any utility or built in class in NHibernate that force a class to load it without lazy in a special situation? Note: I don't want to remove lazy property in my map...

How to get around LazyInitializationException in scheduled jobs?

I am working on a J2EE server application which is deployed on Tomcat. I use Spring source as MVC framework and Hibernate as ORM provider. My object model has lot of Lazy relationships (dependent objects are fetched on request). The high level design is like Service level methods call a few DAO methods to perform database operation. The ...

How to turn this LINQ query to lazy loading

I would like to make a certain select item to lazy load latter in my linq query. Here is my query var posts = from p in context.post where p.post_isdeleted == false && p.post_parentid == null select new { p.post_date, p.post_id, p.post_titleslug, ...

IconDownloader, problem with lazy downloading

My problem is simple to be described but it seems to be hard to solve. The problem is loading icons, with a custom class like IconDownloader.m provided by an official example from Apple, avoiding crashes if I release the view. I've added the IconDownloader class to my app, but it's clear that this approach is good only if the tableview ...

How to keep an Hibernate's Session open until the page is rendered

I'm having the following problem: I'm using Oracle ADF for the view and controller of my app. With OpenSessionInViewFilter, I intercept the request and open an Hibernate's Session, and it is closed as soon as the bean's method finishes. What I need is to keep the Session opened until the page is rendered, because in my JSP y use the ...

Lazy Loading in dynatree

In this component http://wwwendt.de/tech/dynatree/index.html under 5.4 Loading child nodes on demand ('lazy loading') it seems that the only way to load the tree nodes in a lazy manner is to grab them from web service. What if I want to grab the nodes from a data structure? such as: onLazyRead: function(dtnode){ dtn...

can you use jquery lazyload on all images (not just ones out of view)

i have a webpage with a lot of images (photo album). I am using lazyloading jquery plugin which is great to only load the images out of browser view when i scroll down. The one issue i have is that i want the loading icon to show up first on images loading IN the current view as well as some of them are big images and they show up with...

Hibernate/Spring: failed to lazily initialize - no session or session was closed

For an answer scroll down to the end of this... The basic problem is the same as asked multiple time. I have a simple program with two POJOs Event and User - where a user can have multiple events. @Entity @Table public class Event { private Long id; private String name; private User user; @Column @Id @GeneratedValue public Lo...

what's the alternative to readonlycollection when using lazy="extra"?

I am trying to use lazy="extra" for the child collection of Trades I have on my Client object. The trades is an Iset<Trade> Trades, exposed as ReadOnlyCollection<Trade> because I do not want anyone to modify the collection directly. As a result, I have added AddTrade and RemoveTrade methods. Now I have a Client Search page where I need ...

Lazy loading a plugin (jQuery)

$('a.lightbox').hover(function () { if (jQuery().lightbox) { // required, otherwise lightbox.js will be loaded on hover each time $("a.lightbox").lightbox({ 'type': 'iframe', 'overlayOpacity': 0.5, 'width': 632, 'hideOnContentClick': false }); } else { ...

How to add a product in a list without loading all the database ?

Hi, In my domain model I have a bi-directionnel association between the ProductList entity and the Product entity with the following hibernate mapping : @Entity @Indexed @Table(name="product_list") public class ProductList { @ManyToMany(fetch=FetchType.LAZY) @JoinTable(name = "list_items", inverseJoinColumns = { @JoinColumn(na...

Lazy load with MEF ?

Take a look at this code : public class Program { [import]IMain Main {get; set;} ... private Compose() {...} } internal interface IMain { ... } [Export(typeof(IMain)] public class Main : IMain { [import] Interace1 Object1 {get;set;} [import] Interace2 Object2 {get;set;} } ... I want to lazy load Object2 after the compositio...

Fluent NHibernate. L2 cache and lazy initialization.

All my references are configured to be lazy loaded like this: References(x => x.SomeProperty).ReadOnly().LazyLoad(); Everything works fine. Proxies are created. Now I added the following line in each entity mapping class: Cache.ReadWrite(); and enabled L2 cache like this: var fluentConfiguration = Fluently.Configure().Database(MsS...