Menu

doubt: null on lazy collections

Help
legrass
2008-11-28
2013-04-19
  • legrass

    legrass - 2008-11-28

    Hi, I'm using spring + hibernate 3 and maybe i have not understood very well how to use hibernate4gwt;
    I followed the stateless approach and all works fine, but I have some doubt with lazy properties.
    A simple scenario:

    class User
    class Bid.

    User has a name (String) and a collection of Bid (lazy fetch).

    My userDAO returns User objects, but calling getBids() I have null.
    I thought that, when used, being a lazy property, hibernate4GWT could manage the retrieve.
    It is wrong?
    If wrong, how I can obtain that? (without sending the entire graph all at once)?

    thanks

     
    • Bruno Marchesson

      Hi,

      Indeed, Hibernate4GWT replaces lazy properties with null on client side and does not implement a remote lazy loading mechanism (even if it is technically possible, I always thought that it would lead to very poor performances).
      So the behavior you describe is normal.

      If you want your bids separately, you have to load them with specific DAO method, and send the list to GWT before setting it to User.

      HTH
      Bruno

       
    • Diego Lovison

      Diego Lovison - 2008-12-03

      i have 2 entity

      MessageEntity
      private Integer id
      private User user
      ....

      UserEntity
      private Integer id
      private String name

      using gxt my grid has a list of MessageEntity

      in column I set user.name... but return "" because User is null..

      Soluction: "you have to load them with specific DAO method, and send the list to GWT before setting it to User. "

      dont have other soluction?

       
    • Diego Lovison

      Diego Lovison - 2008-12-03

      you can post an example of how I can use LazyKiller

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.