想拥有以下数据表结构:
+--------------------------------------------------------------+
| dynamic | dynamic | dynamic |
|--------------------------------------------------------------|
| col1 | col2 | col3 | col1 | col2 | col3 | col1 | col2 | col3 |
|--------------------------------------------------------------|
| data | data | data | data | data | data | data | data | data |
Run Code Online (Sandbox Code Playgroud)
原因是,我不知道在我请求数据库之前必须显示多少列.col1,col2,col3中的列始终相同.
我尝试使用以下数据表:
<h:form id="form">
<h:panelGrid columns="3" style="margin:10px 0">
<p:outputLabel for="template" value="Adid:" style="font-weight:bold"/>
<p:inputText id="template" value="#{reportingView.adId}" size="50"/>
<p:commandButton update="kpi_table" actionListener="#{reportingView.updateColumns}" value="Create Data" process="@parent" icon="ui-icon-refresh" oncomplete="PF('carsTable').clearFilters()"/>
</h:panelGrid>
<p:dataTable id="reportingTable" var="pi" value="#{reportingView.indicators}" widgetVar="indicatorTable" filteredValue="#{reportingView.filteredValues}"> …
Run Code Online (Sandbox Code Playgroud) 有这个搜索查询:
final SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(QueryBuilders.rangeQuery("updateTime").gte(LocalDate.now())).build();
final List<ActivityValue> listOf = elasticsearchTemplate.queryForList(searchQuery, ActivityValue.class);
Run Code Online (Sandbox Code Playgroud)
对于实体 ActivityValue:
@Document(indexName = "tracking1", type = "activity")
public class ActivityValue {
@Id
private String id;
@Field(type = FieldType.Date, index = false, store = true, format = DateFormat.custom, pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate updateTime;
@Field(type = FieldType.Object, includeInParent = true)
private Vendor vendor;
@Field(type = FieldType.Object, includeInParent = true)
private QCriteria quality;
public ActivityValue() {
}
//setter and getter
}
Run Code Online (Sandbox Code Playgroud)
如果我运行查询并尝试接收列表,我会收到以下异常: …