Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Hibernate Relationships in DataSources

    I'm currently using one of the GWT-RPC DataSources to provide data
    I also successfully used REST using XStream to automatically transform my objects to xml.

    The issue I have is ridiculous: too much information!
    For the SmartClient I only need the primary/foreign keys to links multiple datasources, but using Hibernate i get the whole object tree.

    example:
    Code:
    class Person{
    	int id;
    	int name;
    	Address address;
    	
    	// etc...
    }
    
    class Address{
    	int id;
    	String city;
    	// etc...
    }
    so using Hibernate i get a Person with an Address inside!
    To link the Person and Address Datasources, i only need the addess_fk and the address_id.

    When i get the object tree and only take the foreign key, presentation works fine (despite wasting a lot of traffic)
    but then, when changing an relationship, hibernate requires the object, not just the foreign_key.
    I might fix that on serverside manually by loading the object from the db and put it in, but then i need to write the REST Transformer myself or provide a nearly-identical dublicate class to do it with xstream

    Any idea, how i might fix that without writing a lot of server side transformers or dublicating value objects?
    I can't use smartgwtee :(

    #2
    The "nearly identical object" you're stuck with creating is commonly called a "DTO" (data transfer object) and the way to avoid this redundant object is SmartGwt Pro / EE. Why is it that you say you can't use it?

    Comment


      #3
      it's not that I can't - I don't want to :)

      it sounds really stupid to load the whole tree just to get IDs that are on my table anyway (at least in the many-to-one relationships) and I don't like to create and fill DTOs just because of the reference-ids.

      for now i decupled all relationships and let the client manage it, which is not nice but should have the best performance.... when i add two references, hosted mode does not respond anymore...
      do i have to much records for clientside referencing?
      3900 products referencing one of 420 categories and 40 distributors

      Comment


        #4
        for the records: what messed up the performance of my ListGrid was this:
        setShowAllRecords(true);

        that's really no wonder since the grid had to load 4000 records and the lazy fetching was not used. So it's really not SmartGWT's fault :)

        Comment

        Working...
        X