SmartClient Version: v9.1p_2015-01-02/PowerEdition Deployment (built 2015-01-02)
Hi again,
I'm trying to integrate hibrante Data sources with my existing project. And it seems I connected the data base with my DS just fine. The problem is filtering the data.
I tried the approach from
But I keep getting this info:
or
DS xml:
Main ODB class:
QueryInfoODB
Test call:
Consol:
DSRequest:
What I intend to do is to filter my query_message_persist_results table by id of the QueryInfo. The query infos are fetched as Records although I haven't specified a type for them in the DS. In all I only need the ID of the queryInfo as filterable field.
Hi again,
I'm trying to integrate hibrante Data sources with my existing project. And it seems I connected the data base with my DS just fine. The problem is filtering the data.
I tried the approach from
Code:
http://www.smartclient.com/smartgwtee-latest/javadoc/com/smartgwt/client/docs/JpaHibernateRelations.html
Code:
Field name: 'queryInfo' specified in criteria is non-persistent. Skipping.
Code:
Field name: 'id' specified in criteria is non-persistent. Skipping.
Code:
<DataSource
ID="messages"
serverType="hibernate"
beanClassName="com.evizone.rbp.model.persist.QueryMessagePersistResultODB"
schema="$schema"
tableName="query_message_persist_results"
titleField="messages"
progressiveLoading="false"
dropExtraFields="false"
>
<fields>
<field name="queryInfo" foreignKey="queryInfo.id"/>
<field name="tags" type="tags" multiple="true" foreignKey="tags.key"/>
<field includeFrom="queryInfo.id" hidden="true" />
</fields>
</DataSource>
Code:
public class QueryMessagePersistResultODB implements ISysCreationDateAware, IKeyIdentity<QueryMessagePersistPK> {
/**
* @author rrzepa
*/
private static final long serialVersionUID = 1L;
private QueryMessagePersistPK key;
private QueryInfoODB queryInfo;
private Date sentDate;
private MessageTechnology technology;
private String sender;
private String recipient;
private String cc;
private String bcc;
private String subject;
private long hadoopFileId;
private MessageReviewStatus reviewStatus;
private MessagePrivilegeStatus privilegeStatus;
private MessageExternType externType;
private Date sysCreationDate = new Date();
private Date importDate;
private Date reviewUpdateDate;
private boolean annotated;
private long employeeId;
private SamplingType source;
private int riskLevel;
private String attachmentsHadoopFilesIds;
private boolean withAttachment;
private long[] legalHoldsIds;
private long[] exportsIds;
private CaseRelevantStatus caseRelevantStatus = CaseRelevantStatus.NOT_ASSIGNED; // // reflected from CaseMessage.relevantStatus
private String tagsIds;
private List<TagPersistODB> tags;
//
//
// public long getQueryInfoId() {
// return queryInfoId;
// }
@OneToMany(fetch = FetchType.LAZY)
@JoinColumns({ @JoinColumn(name = TagPersistODB_.$message_id, insertable = false, updatable = false),
@JoinColumn(name = TagPersistODB_.$queryInfo, insertable = false, updatable = false) })
public List<TagPersistODB> getTags() {
return tags;
}
public void setTags(List<TagPersistODB> tags) {
this.tags = tags;
}
public void setCaseRelevantStatus(CaseRelevantStatus caseRelevantStatus) {
this.caseRelevantStatus = caseRelevantStatus;
}
@Enumerated
public CaseRelevantStatus getCaseRelevantStatus() {
return caseRelevantStatus;
}
@NotNull
public long getEmployeeId() {
return employeeId;
}
@Enumerated
public SamplingType getSource() {
return source;
}
public int getRiskLevel() {
return riskLevel;
}
@Override
@EmbeddedId
public QueryMessagePersistPK getKey() {
return key;
}
//@NotNull
@FieldSQL
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name = QueryMessagePersistResultODB_.$queryInfo, referencedColumnName="id", insertable = false, updatable = false)
public QueryInfoODB getQueryInfo() {
return queryInfo;
}
@Temporal(TemporalType.TIMESTAMP)
public Date getReviewUpdateDate() {
return reviewUpdateDate;
}
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@Override
public Date getSysCreationDate() {
return sysCreationDate;
}
public String getTagsIds() {
return tagsIds;
}
@NotNull
@Temporal(TemporalType.TIMESTAMP)
//@Column(updatable = false, nullable = false)
public Date getSentDate() {
return sentDate;
}
@Enumerated
@NotNull
//@Column(updatable = false, nullable = false)
public MessageTechnology getTechnology() {
return technology;
}
@Size(max = 255, message = "wrong size of sender")
public String getSender() {
return sender;
}
//@Lob
public String getRecipient() {
return recipient;
}
//@Lob
public String getCc() {
return cc;
}
//@Lob
public String getBcc() {
return bcc;
}
@Size(max = 555, message = "wrong size of subject")
public String getSubject() {
return subject;
}
public long getHadoopFileId() {
return hadoopFileId;
}
@NotNull
public boolean isWithAttachment() {
return withAttachment;
}
@Transient
public long[] getExportsIds() {
return exportsIds;
}
public boolean isAnnotated() {
return annotated;
}
@Enumerated
@NotNull
public MessageReviewStatus getReviewStatus() {
return reviewStatus;
}
@Enumerated
@NotNull
public MessagePrivilegeStatus getPrivilegeStatus() {
return privilegeStatus;
}
@Enumerated
@NotNull
public MessageExternType getExternType() {
return externType;
}
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@Column(updatable = false, nullable = false)
public Date getImportDate() {
return importDate;
}
@Transient
public long[] getLegalHoldsIds() {
return legalHoldsIds;
}
public String getAttachmentsHadoopFilesIds() {
return attachmentsHadoopFilesIds;
}
etc...
Code:
public class QueryInfoODB implements ISysCreationDateAware, IIdentity {
/**
*
*/
private static final long serialVersionUID = 1L;
private long id;
private String name;
private long creatorId;
private String creatorName;
private Date sysCreationDate = new Date();
private int numberOfResult;
private int executionTime; //mns
private long folderId;
private Integer deletedMsgsCount = 0;
private UserQueryType queryType = UserQueryType.COMPLIANCE_ADHOC_QUERY;
private Date activeToDate;
private QueryState queryStatus = QueryState.NEW;
private long queryParamsVersion;
private String queryParams;
private long queryParamsId;
private PersistQueryStatus status = PersistQueryStatus.ACTIVE;
private Long caseId;
private Boolean queryStoped = false;
private Date latestQueryMessage;
private Date earliestQueryMessage;
private String serverId;
private Long workPackageId;
private Long minMessageId;
private Long maxMessageId;
public QueryInfoODB() {
}
public QueryInfoODB(long id) {
this.id = id;
}
@Id
@Override
public long getId() {
return id;
}
etc...
Code:
DataSource ds = DataSourceProvider.getMessageDS();
Criterion crit = new Criterion("queryInfo", OperatorId.EQUALS, 75309);
ListGrid grid = new ListGrid();
grid.draw();
grid.setDataSource(ds);
grid.fetchData(crit, new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
int i = dsResponse.getTotalRows();
System.out.println(i);
}
});
Code:
=== 2015-01-09 16:18:31,325 [l0-7] INFO RequestContext - URL: '/com_evizone_rbp_ui/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0': Moz (Gecko) with Accept-Encoding header
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG XML - Parsed XML from (in memory stream): 4ms
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG ISCKeyedObjectPool - Borrowing object for 'transaction'
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG ISCKeyedObjectPool - Borrowing object for 'Object'
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG ISCKeyedObjectPool - Borrowing object for 'List'
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG ISCKeyedObjectPool - Borrowing object for 'elem'
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG RPCManager - Processing 1 requests.
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG ISCKeyedObjectPool - Borrowing object for 'messages'
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG RPCManager - Request #1 (DSRequest) payload: {
criteria:{
fieldName:"queryInfo",
operator:"equals",
value:75309,
_constructor:"AdvancedCriteria"
},
operationConfig:{
dataSource:"messages",
operationType:"fetch",
textMatchStyle:"exact"
},
startRow:0,
endRow:75,
componentId:"isc_ListGrid_3",
appID:"builtinApplication",
operation:"messages_fetch",
oldValues:{
fieldName:"queryInfo",
operator:"equals",
value:75309,
_constructor:"AdvancedCriteria"
}
}
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG ISCKeyedObjectPool - Borrowing object for 'queryInfo'
=== 2015-01-09 16:18:31,330 [l0-7] WARN DataSource - includeFrom field named 'id' refers to a related DataSource ('queryInfo') that does not exist. Ignoring this field.
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG DeclarativeSecurity - DataSource messages is not in the pre-checked list, processing...
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG AppBase - [builtinApplication.messages_fetch] No userTypes defined, allowing anyone access to all operations for this application
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG AppBase - [builtinApplication.messages_fetch] No public zero-argument method named '_messages_fetch' found, performing generic datasource operation
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG MultipleFieldCriteriaTransformer - [builtinApplication.messages_fetch] Transformed criteria {
value:75309,
fieldName:"queryInfo",
operator:"equals",
_constructor:"AdvancedCriteria"
}
=== 2015-01-09 16:18:31,330 [l0-7] INFO HibernateDataSource - [builtinApplication.messages_fetch] Performing fetch operation with
criteria: {value:75309,fieldName:"queryInfo",operator:"equals",_constructor:"AdvancedCriteria"} values: {value:75309,fieldName:"queryInfo",operator:"equals",_constructor:"AdvancedCriteria"}
=== 2015-01-09 16:18:31,330 [l0-7] DEBUG HibernateTransaction - [builtinApplication.messages_fetch] Started new transaction "1182516089"
=== 2015-01-09 16:18:31,330 [l0-7] WARN HibernateDataSource - [builtinApplication.messages_fetch] Field name: 'queryInfo' specified in criteria is non-persistent. Skipping.
=== 2015-01-09 16:18:31,330 [l0-7] INFO HibernateDataSource - [builtinApplication.messages_fetch] Query string: select _QueryMessagePersistResultODB from com.evizone.rbp.model.persist.QueryMessagePersistResultODB _QueryMessagePersistResultODB
Code:
{
dataSource:"messages",
operationType:"fetch",
componentId:"isc_ListGrid_0",
data:{
fieldName:"queryInfo",
operator:"equals",
value:75309
},
startRow:0,
endRow:75,
textMatchStyle:"exact",
resultSet:[ResultSet ID:isc_ResultSet_0 (dataSource: messages, created by: isc_ListGrid_0)],
callback:{
caller:[ResultSet ID:isc_ResultSet_0 (dataSource: messages, created by: isc_ListGrid_0)],
methodName:"fetchRemoteDataReply"
},
willHandleError:true,
showPrompt:true,
prompt:"Finding Records that match your criteria...",
oldValues:{
fieldName:"queryInfo",
operator:"equals",
value:75309
},
requestId:"messages$6270",
internalClientContext:{
requestIndex:1
},
fallbackToEval:false,
lastClientEventThreadCode:"MUP9",
bypassCache:true
}