v8.3d_2012-11-19/PowerEdition Deployment (built 2012-11-19)
Seems like SQL Templating is not working with HibernateDataSource or i misunderstand something.
Setting custom clauses in ds.xml file have no impact on generated HQL/SQL.
ds.xml
Hibernate-bean
ListGrid
Generated HQL/SQL
I've tried to use operationId to exclude an error in ds.xml file. Fetch operation is found correctly by id, but still no impact on HQL/SQL.
Seems like SQL Templating is not working with HibernateDataSource or i misunderstand something.
Setting custom clauses in ds.xml file have no impact on generated HQL/SQL.
ds.xml
Code:
<DataSource ID="roles" serverType="hibernate" beanClassName="ru.eurotechnologygroup.etgcrm.server.model.Role"
schemaBean="ru.eurotechnologygroup.etgcrm.server.model.Role">
<operationBindings>
<operationBinding operationType="fetch">
<orderClause>name</orderClause>
</operationBinding>
</operationBindings>
<fields>
<field name="name" title="Название" length="20" required="true" hidden="true"/>
<field name="desc" title="Описание" length="100" required="true"/>
<field name="groupName" title="Группа" type="text" valueXPath="group/name" hidden="true"/>
<field name="group" title="Группа" displayField="groupName" hidden="true"/>
</fields>
</DataSource>
Code:
@Entity
@Table(name = "srole")
public class Role implements Serializable
{
private Long id;
private String name;
private String desc;
private RoleGroup group;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "urid")
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
@Column(name = "urname")
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
@Column(name = "roledesc")
public String getDesc()
{
return desc;
}
public void setDesc(String desc)
{
this.desc = desc;
}
@ManyToOne(targetEntity = RoleGroup.class, fetch = FetchType.LAZY)
@JoinColumn(name = "urgroupid")
public RoleGroup getGroup()
{
return group;
}
public void setGroup(RoleGroup group)
{
this.group = group;
}
@Override
public String toString()
{
return "Role{" +
"id=" + id +
", name='" + name + '\'' +
", desc='" + desc + '\'' +
'}';
}
}
Code:
ListGrid listGrid = new ListGrid();
listGrid.setDataSource(ds);
listGrid.setShowAllRecords(true);
listGrid.setAutoFetchData(true);
Code:
=== 2012-11-20 11:55:27,280 [l0-1] DEBUG RPCManager - Request #1 (DSRequest) payload: {
criteria:{
},
operationConfig:{
dataSource:"roles",
operationType:"fetch",
textMatchStyle:"substring"
},
startRow:0,
endRow:75,
componentId:"isc_ListGrid_0",
appID:"builtinApplication",
operation:"roles_fetch",
oldValues:{
}
}
=== 2012-11-20 11:55:27,281 [l0-1] INFO IDACall - Performing 1 operation(s)
=== 2012-11-20 11:55:27,283 [l0-1] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
=== 2012-11-20 11:55:27,283 [l0-1] DEBUG DeclarativeSecurity - DataSource roles is not in the pre-checked list, processing...
=== 2012-11-20 11:55:27,283 [l0-1] DEBUG AppBase - [builtinApplication.roles_fetch] No userTypes defined, allowing anyone access to all operations for this application
=== 2012-11-20 11:55:27,283 [l0-1] DEBUG AppBase - [builtinApplication.roles_fetch] No public zero-argument method named '_roles_fetch' found, performing generic datasource operation
=== 2012-11-20 11:55:27,284 [l0-1] INFO HibernateDataSource - [builtinApplication.roles_fetch] Performing fetch operation with
criteria: {} values: {}
=== 2012-11-20 11:55:27,289 [l0-1] DEBUG HibernateTransaction - [builtinApplication.roles_fetch] Started new transaction "2027850552"
=== 2012-11-20 11:55:27,289 [l0-1] INFO HibernateDataSource - [builtinApplication.roles_fetch] Query string: [b]select _Role, group1 from ru.eurotechnologygroup.etgcrm.server.model.Role _Role left outer join _Role.group group1[/b]
=== 2012-11-20 11:55:27,294 [l0-1] DEBUG SQL - select count(*) as col_0_0_ from srole role0_
=== 2012-11-20 11:55:27,304 [l0-1] DEBUG SQL - [b]select top 75 role0_.urid as urid1_0_, rolegroup1_.SRGID as SRGID2_1_, role0_.roledesc as roledesc1_0_, role0_.urgroupid as urgroupid1_0_, role0_.urname as urname1_0_, rolegroup1_.SRGNAME as SRGNAME2_1_, rolegroup1_.SRGPOS as SRGPOS2_1_ from srole role0_ left outer join srolegroup rolegroup1_ on role0_.urgroupid=rolegroup1_.SRGID[/b]
=== 2012-11-20 11:55:27,317 [l0-1] INFO DSResponse - [builtinApplication.roles_fetch] DSResponse: List with 14 items
=== 2012-11-20 11:55:27,317 [l0-1] INFO HibernateTransaction - [builtinApplication.roles_fetch] Attempting to commit 0 database update(s)
=== 2012-11-20 11:55:27,318 [l0-1] DEBUG HibernateTransaction - [builtinApplication.roles_fetch] Committing transaction "2027850552"
Comment