Announcement

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

    DataSource Lazy-loading issue

    v8.3d_2012-10-22/Pro Deployment (built 2012-10-22)

    I'll try to describe as simple as i can.

    I have:

    1. Hibernate bean describing the following LAZY field:
    Code:
    @ManyToMany(targetEntity = Role.class, fetch = FetchType.LAZY)
        @JoinTable(name = "userrole", joinColumns = @JoinColumn(name = "UserID"),
                inverseJoinColumns = @JoinColumn(name = "URID"))
        public List<Role> getRoles()
        {
            return roles;
        }
    
        public void setRoles(List<Role> roles)
        {
            this.roles = roles;
        }
    2. Datasource XML-definition with ignore flag
    Code:
    <DataSource ID="users" serverType="hibernate" beanClassName="com.myPackage.etgcrm.server.model.User"
           schemaBean="com.myPackage.etgcrm.server.model.User">
        <fields>
    
    ...
    <field name="roles" ignore="true"/>
    
    ...
    
    </fields>
    </DataSource>
    3. Standard list grid
    Code:
    DataSource ds = DataSource.get("users");
    ListGrid listGrid = new ListGrid();
    listGrid.setDataSource(ds);
    listGrid.setAutoFetchData(true);
    Everything is working fine, except the thing that LAZY field "roles" is initialized during ListGrid fetch operation: i can see multiple sql queries in the log.

    I've tried ignore=true, as shown in example, but without any success.

    Is there a way to make SmartGwt respect Lazy attribute and not initialize the fields not shown in ListGrid?
    Last edited by vostapenko; 1 Nov 2012, 04:36.

    #2
    Is this issue being processed?

    Here's some log records.

    Code:
    === 2012-11-01 16:26:03,988 [l0-6] DEBUG IDACall - Header Name:Value pair: Host:127.0.0.1:8888
    === 2012-11-01 16:26:03,988 [l0-6] DEBUG IDACall - Header Name:Value pair: User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
    === 2012-11-01 16:26:03,989 [l0-6] DEBUG IDACall - Header Name:Value pair: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    === 2012-11-01 16:26:03,989 [l0-6] DEBUG IDACall - Header Name:Value pair: Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
    === 2012-11-01 16:26:03,989 [l0-6] DEBUG IDACall - Header Name:Value pair: Accept-Encoding:gzip, deflate
    === 2012-11-01 16:26:03,989 [l0-6] DEBUG IDACall - Header Name:Value pair: Connection:keep-alive
    === 2012-11-01 16:26:03,989 [l0-6] DEBUG IDACall - Header Name:Value pair: Referer:http://127.0.0.1:8888/etgcrm.jsp?gwt.codesvr=127.0.0.1:9997
    === 2012-11-01 16:26:03,989 [l0-6] DEBUG IDACall - Header Name:Value pair: Cookie:GLog=%7B%0D%20%20%20%20left%3A541%2C%20%0D%20%20%20%20top%3A201%2C%20%0D%20%20%20%20width%3A758%2C%20%0D%20%20%20%20height%3A780%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20Log%3A4%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A3%2C%20%0D%20%20%20%20trackRPC%3Anull%0D%7D; JSESSIONID=1rbwsg0qea6i2
    === 2012-11-01 16:26:03,990 [l0-6] DEBUG IDACall - Header Name:Value pair: Content-Type:application/x-www-form-urlencoded; charset=UTF-8
    === 2012-11-01 16:26:03,990 [l0-6] DEBUG IDACall - Header Name:Value pair: Content-Length:1006
    === 2012-11-01 16:26:03,990 [l0-6] DEBUG IDACall - Header Name:Value pair: Pragma:no-cache
    === 2012-11-01 16:26:03,990 [l0-6] DEBUG IDACall - Header Name:Value pair: Cache-Control:no-cache
    === 2012-11-01 16:26:03,990 [l0-6] DEBUG IDACall - session exists: 1rbwsg0qea6i2
    === 2012-11-01 16:26:03,990 [l0-6] DEBUG IDACall - remote user: admin
    === 2012-11-01 16:26:03,991 [l0-6] INFO  RequestContext - URL: '/etgcrm/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0': Moz (Gecko) with Accept-Encoding header
    === 2012-11-01 16:26:03,993 [l0-6] DEBUG XML - Parsed XML from (in memory stream): 1ms
    === 2012-11-01 16:26:03,994 [l0-6] DEBUG RPCManager - Processing 1 requests.
    === 2012-11-01 16:26:04,008 [l0-6] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
        },
        operationConfig:{
            dataSource:"users",
            operationType:"fetch",
            textMatchStyle:"substring"
        },
        startRow:0,
        endRow:75,
        componentId:"isc_ListGrid_0",
        appID:"builtinApplication",
        operation:"users_fetch",
        oldValues:{
        }
    }
    === 2012-11-01 16:26:04,008 [l0-6] INFO  IDACall - Performing 1 operation(s)
    === 2012-11-01 16:26:04,008 [l0-6] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2012-11-01 16:26:04,009 [l0-6] DEBUG DeclarativeSecurity - DataSource users is not in the pre-checked list, processing...
    === 2012-11-01 16:26:04,013 [l0-6] DEBUG AppBase - [builtinApplication.users_fetch] No userTypes defined, allowing anyone access to all operations for this application
    === 2012-11-01 16:26:04,014 [l0-6] DEBUG AppBase - [builtinApplication.users_fetch] No public zero-argument method named '_users_fetch' found, performing generic datasource operation
    === 2012-11-01 16:26:04,014 [l0-6] INFO  HibernateDataSource - [builtinApplication.users_fetch] Performing fetch operation with
    	criteria: {}	values: {}
    === 2012-11-01 16:26:04,020 [l0-6] DEBUG HibernateTransaction - [builtinApplication.users_fetch] Started new transaction "328369962"
    === 2012-11-01 16:26:04,021 [l0-6] INFO  HibernateDataSource - [builtinApplication.users_fetch] Query string: select _User, department1 from ru.eurotechnologygroup.etgcrm.server.model.User _User left outer join _User.department department1
    === 2012-11-01 16:26:04,028 [l0-6] DEBUG SQL - select count(*) as col_0_0_ from suser user0_
    === 2012-11-01 16:26:04,036 [l0-6] DEBUG SQL - select top 75 user0_.USERID as USERID0_0_, department1_.DID as DID2_1_, user0_.USERBLOCKED as USERBLOC2_0_0_, user0_.USERDATEBIRTH as USERDATE3_0_0_, user0_.DID as DID0_0_, user0_.USEREMAIL as USEREMAIL0_0_, user0_.USERFIRSNAME as USERFIRS5_0_0_, user0_.USERLASTNAME as USERLAST6_0_0_, user0_.USERLOGIN as USERLOGIN0_0_, user0_.USERMASKIP as USERMASKIP0_0_, user0_.USERPASSWORD as USERPASS9_0_0_, user0_.USERPHONE as USERPHONE0_0_, user0_.USERPATRONYMIC as USERPAT11_0_0_, department1_.DNAME as DNAME2_1_ from suser user0_ left outer join department department1_ on user0_.DID=department1_.DID
    === 2012-11-01 16:26:04,056 [l0-6] INFO  DSResponse - [builtinApplication.users_fetch] DSResponse: List with 75 items
    === 2012-11-01 16:26:04,056 [l0-6] INFO  HibernateTransaction - [builtinApplication.users_fetch] Attempting to commit 0 database update(s)
    === 2012-11-01 16:26:04,056 [l0-6] DEBUG HibernateTransaction - [builtinApplication.users_fetch] Committing transaction "328369962"
    === 2012-11-01 16:26:04,069 [l0-6] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2012-11-01 16:26:04,075 [l0-6] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2012-11-01 16:26:04,121 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,129 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,135 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,140 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,144 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,148 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,152 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,157 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,161 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,165 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,169 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,174 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,178 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,183 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,187 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,193 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,198 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,203 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,207 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,211 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,215 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,220 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,224 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,230 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,235 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,239 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,244 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,248 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,253 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,257 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,262 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,266 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,271 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,276 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,280 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,285 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,290 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,294 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,298 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,303 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,307 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,311 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,316 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,320 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,324 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,329 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,334 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,338 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,342 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,347 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,352 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,356 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,360 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,364 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,369 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,373 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,378 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,382 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,387 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,392 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,396 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,401 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,405 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,410 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,414 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,419 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,423 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,428 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,433 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,437 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,441 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,447 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,453 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,457 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,461 [l0-6] DEBUG SQL - select roles0_.UserID as UserID0_1_, roles0_.URID as URID1_, role1_.urid as urid1_0_, role1_.roledesc as roledesc1_0_, role1_.urname as urname1_0_ from userrole roles0_ inner join srole role1_ on roles0_.URID=role1_.urid where roles0_.UserID=?
    === 2012-11-01 16:26:04,467 [l0-6] DEBUG HibernateTransaction - Closing session "328369962"
    === 2012-11-01 16:26:04,467 [l0-6] DEBUG HibernateTransaction - Removed transaction "328369962"

    Comment


      #3
      Any response is still welcome here.

      Comment


        #4
        Hi,

        I've just committed changes.
        Now fields with ignore=true will not be accessed thus lazy-loaded fields will not be initialized.

        You can get changes with next nightly build (2012-11-06).

        Regards,
        Alius

        Comment


          #5
          Thanks a lot, Alius.

          What about other fields, which are not shown in ListGrid (hidden, detail)? Are they being initialized during listgrid fetch?

          And if yes and it works as designed, what's the best practice to overcome this issue?

          For example, i have a huge Lazy Object in my Hibernate bean. I defenetly don't wanna initialize it during listgrid fetch operation (and it's not shown in ListGrid).

          But i want to show it in details view and during record editing in DynamicForm.

          Thanks for your help.

          Comment


            #6
            Hi,

            All fields declared in data source (except with ignore=true) will be initialized.

            To solve your problem I would sggest to have two data sources on the same bean:
            1. for DynamicForm with all fields
            2. for ListGrid only with fields required to show in grid. It should have dropExtraFields=true at data source level.

            Regards,
            Alius

            Comment


              #7
              Two DataSources isn't necessary, set operationBinding.outputs to avoid data being delivered to the browser.

              Comment


                #8
                I've got another problem connected with lazy-loading.

                operationBinding.outputs correctly excludes fields from HQL query ONLY if it does not contain "foreignKey" attribute.

                A simple example:
                bean
                Code:
                @Entity
                @Table(name = "CA")
                public class JurPerson implements Serializable
                {
                ...
                @ManyToOne(targetEntity = User.class, fetch = FetchType.LAZY)
                    @JoinColumn(name = "userid")
                    public User getResponsibleUser()
                    {
                        return responsibleUser;
                    }
                ...
                }
                Code:
                DataSource ID="jurPersons" serverConstructor="spring:EtgHibernateDataSource"
                            serverType="hibernate" beanClassName="ru.eurotechnologygroup.etgcrm.server.model.JurPerson"
                            schemaBean="ru.eurotechnologygroup.etgcrm.server.model.JurPerson">
                <operationBindings>
                        <operationBinding operationType="fetch" operationId="listFetch" requiresRole="R_CA_SHOW"
                                          outputs="id,shortName,inn,desc,closed"/>
                ...
                <fields>
                    <field name="responsibleUser" [b]foreignKey="users.id"[/b]/>
                ....
                results in
                Code:
                === 2013-01-03 12:10:33,249 [0-30] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                    criteria:{
                    },
                    operationConfig:{
                        dataSource:"jurPersons",
                        operationType:"fetch",
                        textMatchStyle:"substring"
                    },
                    startRow:0,
                    endRow:75,
                    componentId:"isc_EtgListGrid_0",
                    appID:"builtinApplication",
                    operation:"listFetch",
                    oldValues:{
                    }
                }
                === 2013-01-03 12:10:33,249 [0-30] INFO  IDACall - Performing 1 operation(s)
                === 2013-01-03 12:10:33,249 [0-30] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                === 2013-01-03 12:10:33,249 [0-30] DEBUG DeclarativeSecurity - DataSource jurPersons is not in the pre-checked list, processing...
                === 2013-01-03 12:10:33,249 [0-30] DEBUG AppBase - [builtinApplication.listFetch] No userTypes defined, allowing anyone access to all operations for this application
                === 2013-01-03 12:10:33,249 [0-30] DEBUG AppBase - [builtinApplication.listFetch] No public zero-argument method named '_listFetch' found, performing generic datasource operation
                === 2013-01-03 12:10:33,250 [0-30] INFO  HibernateDataSource - [builtinApplication.listFetch] Performing fetch operation with
                	criteria: {}	values: {}
                === 2013-01-03 12:10:33,254 [0-30] DEBUG HibernateTransaction - [builtinApplication.listFetch] Started new transaction "816321853"
                === 2013-01-03 12:10:33,254 [0-30] INFO  HibernateDataSource - [builtinApplication.listFetch] Query string: select _JurPerson, responsibleUser1, base2, legalForm3, post4 from ru.eurotechnologygroup.etgcrm.server.model.JurPerson _JurPerson  [b]left outer join _JurPerson.responsibleUser responsibleUser1[/b] left outer join _JurPerson.base base2 left outer join _JurPerson.legalForm legalForm3 left outer join _JurPerson.post post4
                while
                Code:
                <field name="responsibleUser"/>
                results in correct query
                Code:
                === 2013-01-03 12:12:18,928 [0-34] INFO  HibernateDataSource - [builtinApplication.listFetch] Query string: select _JurPerson, base1, legalForm2, post3 from ru.eurotechnologygroup.etgcrm.server.model.JurPerson _JurPerson  left outer join _JurPerson.base base1 left outer join _JurPerson.legalForm legalForm2 left outer join _JurPerson.post post3
                From my point of view "outputs" should exactly define which fields should be included in joins no matter what.

                Please, confirm that issue is being processed.

                TY.

                Comment


                  #9
                  A developer has been assigned to look into this - we will post further news on this thread, probably next week sometime

                  Comment


                    #10
                    Hibernate outputs problem is now fixed. No more unnecessary joins included in queries.

                    Comment


                      #11
                      Thx a lot. Will 01/16 3.1 build include this fix?

                      Comment


                        #12
                        Yes, it will. Fixes were committed before 01/16.

                        Comment


                          #13
                          Thanks, sabaka, but seems like the problem is still present in some way.

                          Code:
                          <operationBinding operationType="fetch" operationId="listFetch"
                                            outputs="id,subject"/>
                          id and subject are just simple bean fields (Long and String) no joins should be made.

                          Code:
                          === 2013-01-18 21:30:02,974 [0-15] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                              criteria:{
                              },
                              operationConfig:{
                                  dataSource:"contacts",
                                  operationType:"fetch",
                                  textMatchStyle:"substring"
                              },
                              startRow:0,
                              endRow:75,
                              sortBy:[
                                  "-id"
                              ],
                              componentId:"isc_EtgListGrid_0",
                              appID:"builtinApplication",
                              operation:"listFetch",
                              oldValues:{
                              }
                          }
                          === 2013-01-18 21:30:02,974 [0-15] INFO  IDACall - Performing 1 operation(s)
                          === 2013-01-18 21:30:02,974 [0-15] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                          === 2013-01-18 21:30:02,974 [0-15] DEBUG DeclarativeSecurity - DataSource contacts is not in the pre-checked list, processing...
                          === 2013-01-18 21:30:02,974 [0-15] DEBUG AppBase - [builtinApplication.listFetch] No userTypes defined, allowing anyone access to all operations for this application
                          === 2013-01-18 21:30:02,975 [0-15] DEBUG AppBase - [builtinApplication.listFetch] No public zero-argument method named '_listFetch' found, performing generic datasource operation
                          === 2013-01-18 21:30:02,975 [0-15] INFO  HibernateDataSource - [builtinApplication.listFetch] Performing fetch operation with
                          	criteria: {}	values: {}
                          === 2013-01-18 21:30:02,980 [0-15] DEBUG HibernateTransaction - [builtinApplication.listFetch] Started new transaction "257198896"
                          === 2013-01-18 21:30:02,981 [0-15] INFO  HibernateDataSource - [builtinApplication.listFetch] Query string: select _Contact, priority1, type2, result3, curator4, executor5, contactPerson6, jurPerson7 from ru.eurotechnologygroup.etgcrm.server.model.Contact _Contact  left outer join _Contact.priority priority1 left outer join _Contact.type type2 left outer join _Contact.result result3 left outer join _Contact.curator curator4 left outer join _Contact.executor executor5 left outer join _Contact.contactPerson contactPerson6 left outer join contactPerson6.jurPerson jurPerson7 order by _Contact.id desc
                          === 2013-01-18 21:30:02,981 [0-15] DEBUG SQL - select count(*) as col_0_0_ from Contact contact0_ left outer join rubsection rubsection1_ on contact0_.CPriorityRSID=rubsection1_.RSID left outer join rubsection rubsection2_ on contact0_.CTypeRSID=rubsection2_.RSID left outer join rubsection rubsection3_ on contact0_.CResultRSID=rubsection3_.RSID left outer join suser user4_ on contact0_.CCuratorEmplID=user4_.USERID left outer join suser user5_ on contact0_.ExecutorEmplID=user5_.USERID left outer join ContactPerson contactper6_ on contact0_.CPID=contactper6_.CPID left outer join CA jurperson7_ on contactper6_.CAID=jurperson7_.CAID
                          === 2013-01-18 21:30:02,988 [0-15] DEBUG SQL - select top 75 contact0_.CID as CID14_0_, rubsection1_.RSID as RSID9_1_, rubsection2_.RSID as RSID9_2_, rubsection3_.RSID as RSID9_3_, user4_.USERID as USERID0_4_, user5_.USERID as USERID0_5_, contactper6_.CPID as CPID13_6_, jurperson7_.CAID as CAID11_7_, contact0_.CPID as CPID14_0_, contact0_.CCuratorEmplID as CCurato11_14_0_, contact0_.CDateEnd as CDateEnd14_0_, contact0_.CDateStart as CDateStart14_0_, contact0_.CDesc as CDesc14_0_, contact0_.CIsDone as CIsDone14_0_, contact0_.ExecutorEmplID as Executo12_14_0_, contact0_.CIsIncoming as CIsIncom6_14_0_, contact0_.CPriorityRSID as CPriori13_14_0_, contact0_.CIsRemind as CIsRemind14_0_, contact0_.CRemindDate as CRemindD8_14_0_, contact0_.CResultRSID as CResult14_14_0_, contact0_.CSubject as CSubject14_0_, contact0_.CTypeRSID as CTypeRSID14_0_, rubsection1_.RSHIDDEN as RSHIDDEN9_1_, rubsection1_.RSNAME as RSNAME9_1_, rubsection1_.RSNAMEADD as RSNAMEADD9_1_, rubsection1_.RSPARENTID as RSPARENTID9_1_, rubsection1_.RUBID as RUBID9_1_, rubsection2_.RSHIDDEN as RSHIDDEN9_2_, rubsection2_.RSNAME as RSNAME9_2_, rubsection2_.RSNAMEADD as RSNAMEADD9_2_, rubsection2_.RSPARENTID as RSPARENTID9_2_, rubsection2_.RUBID as RUBID9_2_, rubsection3_.RSHIDDEN as RSHIDDEN9_3_, rubsection3_.RSNAME as RSNAME9_3_, rubsection3_.RSNAMEADD as RSNAMEADD9_3_, rubsection3_.RSPARENTID as RSPARENTID9_3_, rubsection3_.RUBID as RUBID9_3_, user4_.USERBLOCKED as USERBLOC2_0_4_, user4_.USERDATEBIRTH as USERDATE3_0_4_, user4_.DID as DID0_4_, user4_.USEREMAIL as USEREMAIL0_4_, user4_.USERFIRSNAME as USERFIRS5_0_4_, user4_.USERLASTNAME as USERLAST6_0_4_, user4_.USERDATELASTREADNEWS as USERDATE7_0_4_, user4_.USERLOGIN as USERLOGIN0_4_, user4_.USERMASKIP as USERMASKIP0_4_, user4_.USERPASSWORD as USERPAS10_0_4_, user4_.USERPHONE as USERPHONE0_4_, user4_.USERPOSTRSID as USERPOS15_0_4_, user4_.USERPATRONYMIC as USERPAT12_0_4_, user4_.USERWARRANT as USERWAR13_0_4_, user5_.USERBLOCKED as USERBLOC2_0_5_, user5_.USERDATEBIRTH as USERDATE3_0_5_, user5_.DID as DID0_5_, user5_.USEREMAIL as USEREMAIL0_5_, user5_.USERFIRSNAME as USERFIRS5_0_5_, user5_.USERLASTNAME as USERLAST6_0_5_, user5_.USERDATELASTREADNEWS as USERDATE7_0_5_, user5_.USERLOGIN as USERLOGIN0_5_, user5_.USERMASKIP as USERMASKIP0_5_, user5_.USERPASSWORD as USERPAS10_0_5_, user5_.USERPHONE as USERPHONE0_5_, user5_.USERPOSTRSID as USERPOS15_0_5_, user5_.USERPATRONYMIC as USERPAT12_0_5_, user5_.USERWARRANT as USERWAR13_0_5_, contactper6_.CPDateBirth as CPDateBi2_13_6_, contactper6_.CuratorEmplID as Curator10_13_6_, contactper6_.CPDepRSID as CPDepRSID13_6_, contactper6_.CPDesc as CPDesc13_6_, contactper6_.CPEmail as CPEmail13_6_, contactper6_.CPFirstName as CPFirstN5_13_6_, contactper6_.CAID as CAID13_6_, contactper6_.CPLastName as CPLastName13_6_, contactper6_.CPTel as CPTel13_6_, contactper6_.CPPostRSID as CPPostRSID13_6_, contactper6_.CPDateRegister as CPDateRe8_13_6_, contactper6_.RegisterEmplID as Registe14_13_6_, contactper6_.CPSurName as CPSurName13_6_, jurperson7_.CABank as CABank11_7_, jurperson7_.CABankSortingCode as CABankSo3_11_7_, jurperson7_.rsbaseid as rsbaseid11_7_, jurperson7_.cabik as cabik11_7_, jurperson7_.CACLOSED as CACLOSED11_7_, jurperson7_.cadatecertificate as cadatece6_11_7_, jurperson7_.CADATEMODIFY as CADATEMO7_11_7_, jurperson7_.CADATEWARRANT as CADATEWA8_11_7_, jurperson7_.CADESC as CADESC11_7_, jurperson7_.caegrulnum as caegrulnum11_7_, jurperson7_.CAEMAIL as CAEMAIL11_7_, jurperson7_.CAENDDATEWARRANT as CAENDDA12_11_7_, jurperson7_.cafax as cafax11_7_, jurperson7_.cafioaccounter as cafioac14_11_7_, jurperson7_.CAFIOPOST as CAFIOPOST11_7_, jurperson7_.cafiopostshort as cafiopo16_11_7_, jurperson7_.CAINN as CAINN11_7_, jurperson7_.CAJURADDRESS as CAJURAD18_11_7_, jurperson7_.cakors as cakors11_7_, jurperson7_.CAKPP as CAKPP11_7_, jurperson7_.RSLegalFormID as RSLegal37_11_7_, jurperson7_.CANAME as CANAME11_7_, jurperson7_.canumcertificate as canumce22_11_7_, jurperson7_.CANUMWARRANT as CANUMWA23_11_7_, jurperson7_.caokonx as caokonx11_7_, jurperson7_.caokpo as caokpo11_7_, jurperson7_.caokved as caokved11_7_, jurperson7_.CAOGRN as CAOGRN11_7_, jurperson7_.CAPASSWORD as CAPASSWORD11_7_, jurperson7_.caphone as caphone11_7_, jurperson7_.RSPOSTID as RSPOSTID11_7_, jurperson7_.CAPOSTADDRESS as CAPOSTA30_11_7_, jurperson7_.userid as userid11_7_, jurperson7_.cars as cars11_7_, jurperson7_.caseriecertificate as caserie32_11_7_, jurperson7_.CASHORTNAME as CASHORT33_11_7_, jurperson7_.casitekors as casitekors11_7_, jurperson7_.CAUSERNAME as CAUSERNAME11_7_ from Contact contact0_ left outer join rubsection rubsection1_ on contact0_.CPriorityRSID=rubsection1_.RSID left outer join rubsection rubsection2_ on contact0_.CTypeRSID=rubsection2_.RSID left outer join rubsection rubsection3_ on contact0_.CResultRSID=rubsection3_.RSID left outer join suser user4_ on contact0_.CCuratorEmplID=user4_.USERID left outer join suser user5_ on contact0_.ExecutorEmplID=user5_.USERID left outer join ContactPerson contactper6_ on contact0_.CPID=contactper6_.CPID left outer join CA jurperson7_ on contactper6_.CAID=jurperson7_.CAID order by contact0_.CID desc
                          === 2013-01-18 21:30:03,012 [0-15] INFO  DSResponse - [builtinApplication.listFetch] DSResponse: List with 5 items
                          As it can be seen - there are some joins in hql/sql.

                          From my point of view, the HQL should look like

                          Code:
                          select _Contact from ru.eurotechnologygroup.etgcrm.server.model.Contact _Contact order by _Contact.id desc
                          This is for v8.3p_2013-01-18/PowerEdition Deployment (built 2013-01-18)

                          N.B. All foreign key fields in Hibernate bean declared LAZY.

                          Comment


                            #14
                            I've looked this over both with active version and with older one, but cannot reproduce your issue. For me everything works fine - unnecessary joins are *not* included in queries. If the problem still exists, could you provide more information?
                            - complete ds.xml file
                            - complete request execution log with debug enabled

                            just for your information: outputs limitation has nothing to do with foreign keys being declared lazy in Hibernate bean. It just skips all joins that are not necessary to select fields based on outputs setting.

                            Comment


                              #15
                              There's no problem, when ds.xml looks like this:

                              Code:
                              <DataSource ID="contacts" serverConstructor="spring:EtgHibernateDataSource"
                                          serverType="hibernate" beanClassName="ru.eurotechnologygroup.etgcrm.server.model.Contact"
                                          schemaBean="ru.eurotechnologygroup.etgcrm.server.model.Contact" showPrompt="false">
                                  <operationBindings>
                                      <operationBinding operationType="fetch" operationId="listFetch" outputs="id,subject"/>
                                  </operationBindings>
                                  <fields>
                                      <field name="id" hidden="false"/>
                                      <field name="subject"/>
                                  </fields>
                              </DataSource>
                              Note, that Hibernate bean contains much more fields.

                              But when extra fields (which are not included in outputs) added, extra joins are performed.

                              ds.xml with extra fields
                              Code:
                              <DataSource ID="contacts" serverConstructor="spring:EtgHibernateDataSource"
                                          serverType="hibernate" beanClassName="ru.eurotechnologygroup.etgcrm.server.model.Contact"
                                          schemaBean="ru.eurotechnologygroup.etgcrm.server.model.Contact" showPrompt="false">
                                  <operationBindings>
                                      <operationBinding operationType="fetch" operationId="listFetch" outputs="id,subject"/>
                                  </operationBindings>
                                  <fields>
                                      <field name="id" hidden="false"/>
                                      <field name="subject"/>
                                      <field name="resultName" valueXPath="result/name"/>
                                      <field name="result" foreignKey="rubSections.id"/>
                                  </fields>
                              </DataSource>
                              log
                              Code:
                              === 2013-01-25 06:15:03,300 [0-12] INFO  RequestContext - URL: '/etgcrm/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0': Moz (Gecko) with Accept-Encoding header
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Host:127.0.0.1:8888
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Accept-Encoding:gzip, deflate
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Content-Type:application/x-www-form-urlencoded; charset=UTF-8
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Referer:http://127.0.0.1:8888/etgcrm.jsp?gwt.codesvr=127.0.0.1:9997
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Content-Length:1095
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Cookie:GLog=%7B%0D%20%20%20%20left%3A1032%2C%20%0D%20%20%20%20top%3A222%2C%20%0D%20%20%20%20width%3A825%2C%20%0D%20%20%20%20height%3A703%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20Log%3A3%2C%20%0D%20%20%20%20%20%20%20%20ListGrid%3A3%2C%20%0D%20%20%20%20%20%20%20%20TreeGrid%3A3%2C%20%0D%20%20%20%20%20%20%20%20ResultTree%3A3%2C%20%0D%20%20%20%20%20%20%20%20ResultSet%3A3%2C%20%0D%20%20%20%20%20%20%20%20fetchTrace%3A3%2C%20%0D%20%20%20%20%20%20%20%20ComboBoxItem%3A3%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A3%2C%20%0D%20%20%20%20trackRPC%3Atrue%0D%7D; JSESSIONID=y0ka1zrinpc5; isc_cState=ready
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Connection:keep-alive
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Pragma:no-cache
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - Header Name:Value pair: Cache-Control:no-cache
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - session exists: y0ka1zrinpc5
                              === 2013-01-25 06:15:03,300 [0-12] DEBUG IDACall - remote user: admin
                              === 2013-01-25 06:15:03,302 [0-12] DEBUG XML - Parsed XML from (in memory stream): 1ms
                              === 2013-01-25 06:15:03,303 [0-12] DEBUG RPCManager - Processing 1 requests.
                              === 2013-01-25 06:15:03,308 [0-12] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                                  criteria:{
                                  },
                                  operationConfig:{
                                      dataSource:"contacts",
                                      operationType:"fetch",
                                      textMatchStyle:"substring"
                                  },
                                  startRow:0,
                                  endRow:75,
                                  sortBy:[
                                      "-id"
                                  ],
                                  componentId:"isc_EtgListGrid_0",
                                  appID:"builtinApplication",
                                  operation:"listFetch",
                                  oldValues:{
                                  }
                              }
                              === 2013-01-25 06:15:03,308 [0-12] INFO  IDACall - Performing 1 operation(s)
                              === 2013-01-25 06:15:03,308 [0-12] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                              === 2013-01-25 06:15:03,308 [0-12] DEBUG DeclarativeSecurity - DataSource contacts is not in the pre-checked list, processing...
                              === 2013-01-25 06:15:03,308 [0-12] DEBUG AppBase - [builtinApplication.listFetch] No userTypes defined, allowing anyone access to all operations for this application
                              === 2013-01-25 06:15:03,308 [0-12] DEBUG AppBase - [builtinApplication.listFetch] No public zero-argument method named '_listFetch' found, performing generic datasource operation
                              === 2013-01-25 06:15:03,308 [0-12] INFO  HibernateDataSource - [builtinApplication.listFetch] Performing fetch operation with
                              	criteria: {}	values: {}
                              === 2013-01-25 06:15:03,312 [0-12] DEBUG HibernateTransaction - [builtinApplication.listFetch] Started new transaction "219453294"
                              === 2013-01-25 06:15:03,312 [0-12] INFO  HibernateDataSource - [builtinApplication.listFetch] Query string: select _Contact, result1 from ru.eurotechnologygroup.etgcrm.server.model.Contact _Contact  left outer join _Contact.result result1 order by _Contact.id desc
                              === 2013-01-25 06:15:03,312 [0-12] DEBUG SQL - select count(*) as col_0_0_ from Contact contact0_ left outer join rubsection rubsection1_ on contact0_.CResultRSID=rubsection1_.RSID
                              === 2013-01-25 06:15:03,317 [0-12] DEBUG SQL - select top 75 contact0_.CID as CID14_0_, rubsection1_.RSID as RSID9_1_, contact0_.CPID as CPID14_0_, contact0_.CCuratorEmplID as CCurato11_14_0_, contact0_.CDateEnd as CDateEnd14_0_, contact0_.CDateStart as CDateStart14_0_, contact0_.CDesc as CDesc14_0_, contact0_.CIsDone as CIsDone14_0_, contact0_.ExecutorEmplID as Executo12_14_0_, contact0_.CIsIncoming as CIsIncom6_14_0_, contact0_.CPriorityRSID as CPriori13_14_0_, contact0_.CIsRemind as CIsRemind14_0_, contact0_.CRemindDate as CRemindD8_14_0_, contact0_.CResultRSID as CResult14_14_0_, contact0_.CSubject as CSubject14_0_, contact0_.CTypeRSID as CTypeRSID14_0_, rubsection1_.RSHIDDEN as RSHIDDEN9_1_, rubsection1_.RSNAME as RSNAME9_1_, rubsection1_.RSNAMEADD as RSNAMEADD9_1_, rubsection1_.RSPARENTID as RSPARENTID9_1_, rubsection1_.RUBID as RUBID9_1_ from Contact contact0_ left outer join rubsection rubsection1_ on contact0_.CResultRSID=rubsection1_.RSID order by contact0_.CID desc
                              === 2013-01-25 06:15:03,324 [0-12] INFO  DSResponse - [builtinApplication.listFetch] DSResponse: List with 5 items
                              === 2013-01-25 06:15:03,324 [0-12] INFO  HibernateTransaction - [builtinApplication.listFetch] Attempting to commit 0 database update(s)
                              === 2013-01-25 06:15:03,324 [0-12] DEBUG HibernateTransaction - [builtinApplication.listFetch] Committing transaction "219453294"
                              === 2013-01-25 06:15:03,332 [0-12] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
                              === 2013-01-25 06:15:03,337 [0-12] DEBUG RPCManager - non-DMI response, dropExtraFields: false
                              === 2013-01-25 06:15:03,337 [0-12] DEBUG HibernateTransaction - Closing session "219453294"
                              === 2013-01-25 06:15:03,337 [0-12] DEBUG HibernateTransaction - Removed transaction "219453294"
                              hibernate bean if you need it
                              Code:
                              @Entity
                              @Table(name = "Contact")
                              public class Contact implements Serializable
                              {
                                  private Long id;
                                  private User curator;
                                  private ContactPerson contactPerson;
                                  private RubSection priority;
                                  private RubSection result;
                                  private RubSection type;
                                  private Date dateEnd;
                                  private Date dateStart;
                                  private String desc;
                                  private Boolean done;
                                  private Boolean incoming;
                                  private Boolean remind;
                                  private Date remindDate;
                                  private String subject;
                                  private User executor;
                              
                                  @Id
                                  @GeneratedValue(strategy = GenerationType.IDENTITY)
                                  @Column(name = "CID")
                                  public Long getId()
                                  {
                                      return id;
                                  }
                              
                                  public void setId(Long id)
                                  {
                                      this.id = id;
                                  }
                              
                                  @ManyToOne(targetEntity = User.class, fetch = FetchType.LAZY)
                                  @JoinColumn(name = "CCuratorEmplID")
                                  public User getCurator()
                                  {
                                      return curator;
                                  }
                              
                                  public void setCurator(User curator)
                                  {
                                      this.curator = curator;
                                  }
                              
                                  @ManyToOne(targetEntity = ContactPerson.class, fetch = FetchType.LAZY)
                                  @JoinColumn(name = "CPID")
                                  public ContactPerson getContactPerson()
                                  {
                                      return contactPerson;
                                  }
                              
                                  public void setContactPerson(ContactPerson contactPerson)
                                  {
                                      this.contactPerson = contactPerson;
                                  }
                              
                                  @ManyToOne(targetEntity = RubSection.class, fetch = FetchType.LAZY)
                                  @JoinColumn(name = "CPriorityRSID")
                                  public RubSection getPriority()
                                  {
                                      return priority;
                                  }
                              
                                  public void setPriority(RubSection priority)
                                  {
                                      this.priority = priority;
                                  }
                              
                                  @ManyToOne(targetEntity = RubSection.class, fetch = FetchType.LAZY)
                                  @JoinColumn(name = "CResultRSID")
                                  public RubSection getResult()
                                  {
                                      return result;
                                  }
                              
                                  public void setResult(RubSection result)
                                  {
                                      this.result = result;
                                  }
                              
                                  @ManyToOne(targetEntity = RubSection.class, fetch = FetchType.LAZY)
                                  @JoinColumn(name = "CTypeRSID")
                                  public RubSection getType()
                                  {
                                      return type;
                                  }
                              
                                  public void setType(RubSection type)
                                  {
                                      this.type = type;
                                  }
                              
                                  @Column(name = "CDateEnd")
                                  public Date getDateEnd()
                                  {
                                      return dateEnd;
                                  }
                              
                                  public void setDateEnd(Date dateEnd)
                                  {
                                      this.dateEnd = dateEnd;
                                  }
                              
                                  @Column(name = "CDateStart")
                                  public Date getDateStart()
                                  {
                                      return dateStart;
                                  }
                              
                                  public void setDateStart(Date dateStart)
                                  {
                                      this.dateStart = dateStart;
                                  }
                              
                                  @Column(name = "CDesc")
                                  public String getDesc()
                                  {
                                      return desc;
                                  }
                              
                                  public void setDesc(String desc)
                                  {
                                      this.desc = desc;
                                  }
                              
                                  @Column(name = "CIsDone")
                                  public Boolean getDone()
                                  {
                                      return done;
                                  }
                              
                                  public void setDone(Boolean done)
                                  {
                                      this.done = done;
                                  }
                              
                                  @Column(name = "CIsIncoming")
                                  public Boolean getIncoming()
                                  {
                                      return incoming;
                                  }
                              
                                  public void setIncoming(Boolean incoming)
                                  {
                                      this.incoming = incoming;
                                  }
                              
                                  @Column(name = "CIsRemind")
                                  public Boolean getRemind()
                                  {
                                      return remind;
                                  }
                              
                                  public void setRemind(Boolean remind)
                                  {
                                      this.remind = remind;
                                  }
                              
                                  @Column(name = "CRemindDate")
                                  public Date getRemindDate()
                                  {
                                      return remindDate;
                                  }
                              
                                  public void setRemindDate(Date remindDate)
                                  {
                                      this.remindDate = remindDate;
                                  }
                              
                                  @Column(name = "CSubject")
                                  public String getSubject()
                                  {
                                      return subject;
                                  }
                              
                                  public void setSubject(String subject)
                                  {
                                      this.subject = subject;
                                  }
                              
                                  @ManyToOne(targetEntity = User.class, fetch = FetchType.LAZY)
                                  @JoinColumn(name = "ExecutorEmplID")
                                  public User getExecutor()
                                  {
                                      return executor;
                                  }
                              
                                  public void setExecutor(User executor)
                                  {
                                      this.executor = executor;
                                  }
                              }
                              If provided log is not enough, please tell, what packages are you interested in and i'll set them to DEBUG?

                              Comment

                              Working...
                              X