Announcement

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

    Performance problem with Hibernate

    Hello,
    I'm using SmartGWT 3.0p and I'm having performance problems using Hibernate.
    I have a master - detail - subdetail relationship and when a fetch is done on master, all details and subdetails (the whole subgraph) are loaded.
    Using dropExtraFields in the datasource is not working whole graph is still loaded.
    As I want to be able to add a detail object to my master for instance, not adding related fields in my datasouce is not an option.
    I'm including example datasources. If you'd like I have a modified "builtinds" to reproduce the problem.

    Regards,
    Cédric.
    Attached Files

    #2
    If I understand your question correctly...

    Yes, it is an inherent problem with bidirectional relations. You try to load a single record an whole table is fetched. Moreover - Hibernate can deal with it by using lazy loading and caching managed entities. With detached data we do not have such luxury. We do not have any knowledge about data structure so we send all data defined in data source.

    Only you as a developer have knowledge about data structure so it is your responsibility to define and use relations wisely.

    My suggestion:
    Remove relation from itemVenda.ds.xml (only from data source not from JPA entity)
    Code:
    <field name="venda" type="venda" foreignKey="venda.id"></field>
    Regards,
    Alius

    Comment


      #3
      To clarify a bit - SmartGWT can load or not load related records depending on whether you declare the field and whether you set dataSource.dropExtraFields.

      If you look the related records as nested sub-records along with a main record, all related records are loaded.

      You can instead declare a DataSource for the sub-records and query them directly, passing criteria, in order to load any subset of those records you want.

      Comment

      Working...
      X