Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy loading #14

Open
corneil opened this issue Jun 2, 2012 · 1 comment
Open

Lazy loading #14

corneil opened this issue Jun 2, 2012 · 1 comment

Comments

@corneil
Copy link

corneil commented Jun 2, 2012

I would like to suggest you add support for lazy loading.

public interface RDFProxy {
    public boolean isLoaded();
    public Object load(Session session);
}

The following should be provided:

  • Proxies should have a common interface
  • Proxy interface should have methods to:
    • determine if the object has been loaded
    • load the underlying object using supplied session.
  • Session should provide support for bulk load of collection of proxies

I think most other persistent mechanisms do not store a session in a proxy and will only load the proxies in the context of a session. I think it is a lot safer to store sessionFactory in the proxy.
The proxy code for loading the object will use sessionFactory.currentSession for loading the object.

@timowest
Copy link
Contributor

timowest commented Jun 3, 2012

How about the following

  • How to annotate properties to be lazily loaded?
  • How is the lazy loading done from the user's perspective? implicitly or explicitly?
  • Does the interface contract work? Why not isLoaded() and load()? The proxy extends the class to be loaded, so there shouldn't be a reason to provide an external object for the target, unless I misunderstood the design.
  • IMHO using the session used for loading the object should also be used for lazy loading. This is conceptually simpler, is widely used and guarantees that the lazily loaded state is (or has been) valid in the scope of the current session.

Can you provide maybe a domain class example and some imagined RDFBean API usage for lazy loading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants