如何在JPQL查询中使用数组列表?我想要这样的事情:我正在传递这个
private static final String[] MASKS = {"30109", "30111"};
Run Code Online (Sandbox Code Playgroud)
成
public List<Account> findAccount(String[] Masks){
StringBuilder sb = new StringBuilder("from AccountTable a where SUBSTRING(a.Account,1,5) in :Masks ");
Query q = em.createQuery(sb.toString(), AccountTable.class)
.setParameter("Masks",Masks);
}
Run Code Online (Sandbox Code Playgroud)
目前,错误是
Encountered array-valued parameter binding, but was expecting [java.lang.String (n/a)]; nested exception is java.lang.IllegalArgumentException: Encountered array-valued parameter binding, but was expecting [java.lang.String (n/a)]
Run Code Online (Sandbox Code Playgroud) 这个问题与此有关.现在我想为字段值等于某个值的行着色.
@FXML
private TableView<FaDeal> tv_mm_view;
@FXML
private TableColumn<FaDeal, String> tc_inst;
tc_inst.setCellValueFactory(cellData -> new SimpleStringProperty(""+cellData.getValue().getInstrumentId()));
tc_inst.setCellFactory(column -> new TableCell<FaDeal, String>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setText(null);
} else {
setText(item);
// Style row where balance < 0 with a different color.
TableRow currentRow = getTableRow();
if (item.equals("1070")) {
currentRow.setStyle("-fx-background-color: tomato;");
} else currentRow.setStyle("");
}
}
});
Run Code Online (Sandbox Code Playgroud)
问题是我不想tc_inst在我的表格中显示.出于这个原因,我将visible复选框设置SceneBuilder为false.在这种情况下,着色部分根本不起作用.如何隐藏tc_inst以便着色有效?
我曾经习惯DecimalFormat df = new DecimalFormat("#,###.00");格式化BigDecimal.
现在,我想使用该格式化的值(比如它是'1 250,00')来创建new BigDecimal.我试过这个:
BigDecimal result = new BigDecimal(model.getValue().replace(",",".").replace(" ",""));
Run Code Online (Sandbox Code Playgroud)
但是space1 250和2之间的1到2不会被替换.我该如何解决?
例:
DecimalFormat df = new DecimalFormat("#,###.00");
BigDecimal example = new BigDecimal("1250");
String str = df.format(example);
System.out.println(str.replace(",",".").replace(" ",""));
Run Code Online (Sandbox Code Playgroud) 值演员和参考演员有什么区别?为什么其中一个调用转换(又称创建新对象)而其他不调用?在rhs上使用铸造的注意事项是什么?
假设这是Derived.为什么那些人实际上不会施放到Base?
*this = (Base&) rhs
(Base)* this = rhs
Run Code Online (Sandbox Code Playgroud)
你能用简单的例子来表示吗?
我有一个存储过程,看起来像这样:
create procedure test as
begin
if exists(
select 1 from sys.columns
where Name = N'Column2'
and Object_ID = Object_ID(Table2')
)
select Column2 from Table2
end
Run Code Online (Sandbox Code Playgroud)
我想在db2上不存在Column2的情况下运行此过程.我不想接受SP的存在检查.目前的错误是:
消息207,级别16,状态1,过程测试,第39行[批次开始行0]无效的列名称"Column2".
有没有办法这样做?为什么是,为什么不呢?
例如,如果你检查存在表并选择不存在的表有效吗?
我有两列(第一列包含值0,第二列包含值1).
此语句返回1,而不是01
Cells(1, 26).Value = CStr(Cells(1, 24).Value) & CStr(Cells(1, 25).Value)
Run Code Online (Sandbox Code Playgroud)
我想在第3列中将它们连接起来01.我该怎么做呢?
在SQL Server中是否可以以这种方式检查表是否存在?如果它不存在,它将运行catch
declare @SQL varchar(4444)
select @SQL = '
begin try
select * from ServerName.DBName.dbo.TableNAme
end try
begin catch
select 1
end catch'
exec (@SQL)
Run Code Online (Sandbox Code Playgroud)
我不想使用这里描述的解决方案,因为我想使用与上面完全相同的表结构.
原因:我将在循环中运行多个动态查询,并且在ServerName,DbName,TableName之上将作为参数传递.