我的項目最初是由seam-gen生成的,動作「List」bean沒有按照我的預期工作。限制數組具有來自表的所有屬性,並且表現得像所有參數都是必需的。在列表中看到婁:SEAM ENTITYQUERY - 有限制seam-gem示例的問題
package br.com.autenticis.comvenif_red_web.session;
import br.com.autenticis.comvenif_red_web.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;
@Name("t233Ev01List")
public class T233Ev01List extends EntityQuery<T233Ev01> {
private static final String EJBQL = "select t233Ev01 from T233Ev01 t233Ev01";
private static final String[] RESTRICTIONS = {
//"lower(t233Ev01.placaUnica) like lower(concat(#{t233Ev01List.t233Ev01.placaUnica},'%'))",};
"lower(t233Ev01.placaUnica) like lower(concat(#{t233Ev01List.t233Ev01.placaUnica},'%'))",
"lower(t233Ev01.renavam) like lower(concat(#{t233Ev01List.t233Ev01.renavam},'%'))",
"lower(t233Ev01.numIdentProprietario) like lower(concat(#{t233Ev01List.t233Ev01.numIdentProprietario},'%'))",
"lower(t233Ev01.nomeProprietario) like lower(concat(#{t233Ev01List.t233Ev01.nomeProprietario},'%'))",
"lower(t233Ev01.anoFabricacao) like lower(concat(#{t233Ev01List.t233Ev01.anoFabricacao},'%'))",
"lower(t233Ev01.anoModelo) like lower(concat(#{t233Ev01List.t233Ev01.anoModelo},'%'))",
"lower(t233Ev01.ufByUfEmissao) like lower(concat(#{t233Ev01List.t233Ev01.ufByUfEmissao},'%'))",
"lower(t233Ev01.numeroCrv) like lower(concat(#{t233Ev01List.t233Ev01.numeroCrv},'%'))",
"lower(t233Ev01.dataEmissao) like lower(concat(#{t233Ev01List.t233Ev01.dataEmissao},'%'))",
"lower(t233Ev01.numeroVia) like lower(concat(#{t233Ev01List.t233Ev01.numeroVia},'%'))",
"lower(t233Ev01.codigoSegurancaCrv) like lower(concat(#{t233Ev01List.t233Ev01.codigoSegurancaCrv},'%'))",
"lower(t233Ev01.tipoDocCartorio) like lower(concat(#{t233Ev01List.t233Ev01.tipoDocCartorio},'%'))",
"lower(t233Ev01.numIdentCartorio) like lower(concat(#{t233Ev01List.t233Ev01.numIdentCartorio},'%'))",
"lower(t233Ev01.numIdentCv) like lower(concat(#{t233Ev01List.t233Ev01.numIdentCv},'%'))",};
private T233Ev01 t233Ev01;
public T233Ev01List() {
t233Ev01 = new T233Ev01();
t233Ev01.setId(new T233Ev01Id());
setEjbql(EJBQL);
setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
setMaxResults(25);
}
public T233Ev01 getT233Ev01() {
return t233Ev01;
}
}
當我只需填寫表格,例如現場「加泰羅尼亞總聯合會」,都是這樣產生的所有字段的SQL:
SELECT *
FROM (SELECT t233ev01x0_.idtransacao AS idtransa1_26_,
t233ev01x0_.dia_juliano AS dia2_26_,
t233ev01x0_.uf_imovel_comprador AS uf38_26_,
t233ev01x0_.uf_imovel_cartorio AS uf37_26_,
t233ev01x0_.uf_emissao AS uf36_26_,
t233ev01x0_.placa_unica AS placa3_26_,
t233ev01x0_.renavam AS renavam26_,
t233ev01x0_.num_ident_proprietario AS num5_26_,
t233ev01x0_.nome_proprietario AS nome6_26_,
t233ev01x0_.ano_fabricacao AS ano7_26_,
t233ev01x0_.ano_modelo AS ano8_26_,
t233ev01x0_.numero_crv AS numero9_26_,
t233ev01x0_.data_emissao AS data10_26_,
t233ev01x0_.numero_via AS numero11_26_,
t233ev01x0_.codigo_seguranca_crv AS codigo12_26_,
t233ev01x0_.tipo_doc_comprador AS tipo13_26_,
t233ev01x0_.num_ident_comprador AS num14_26_,
t233ev01x0_.nome_comprador AS nome15_26_,
t233ev01x0_.nome_logradouro_comprador AS nome16_26_,
t233ev01x0_.numero_imovel_comprador AS numero17_26_,
t233ev01x0_.complemento_imovel_comprador AS complem18_26_,
t233ev01x0_.bairro_imovel_comprador AS bairro19_26_,
t233ev01x0_.cod_municipio_imovel_comprador AS cod20_26_,
t233ev01x0_.cep_imovel_comprador AS cep21_26_,
t233ev01x0_.cod_municipio_local_venda AS cod22_26_,
t233ev01x0_.data_venda AS data23_26_,
t233ev01x0_.tipo_doc_cartorio AS tipo24_26_,
t233ev01x0_.num_ident_cartorio AS num25_26_,
t233ev01x0_.nome_cartorio AS nome26_26_,
t233ev01x0_.nome_logradouro_cartorio AS nome27_26_,
t233ev01x0_.numero_imovel_cartorio AS numero28_26_,
t233ev01x0_.complemento_imovel_cartorio AS complem29_26_,
t233ev01x0_.bairro_imovel_cartorio AS bairro30_26_,
t233ev01x0_.cod_municipio_imovel_cartorio AS cod31_26_,
t233ev01x0_.cep_imovel_cartorio AS cep32_26_,
t233ev01x0_.ddd_tel_cartorio AS ddd33_26_,
t233ev01x0_.num_tel_cartorio AS num34_26_,
t233ev01x0_.num_ident_cv AS num35_26_
FROM autenticis_comvenif.t233_ev01 t233ev01x0_
WHERE (LOWER (t233ev01x0_.renavam) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.ano_fabricacao) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.ano_modelo) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.numero_crv) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.data_emissao) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.numero_via) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.tipo_doc_cartorio) LIKE LOWER (? || '%'))
AND (LOWER (t233ev01x0_.num_ident_cv) LIKE LOWER (? || '%')))
WHERE ROWNUM <= ?
我不想放入查詢中,未填充的字段(空)。我沒有找到任何關於「動態限制」的例子,或者使用EntityQuery來做到這一點。