小编Cos*_*tar的帖子

symfony2表单禁用

我使用相同的表单来"预览"对象,因为我要"编辑/更新"同一个对象.在我showAction()的控制器中,我有以下代码:

$form = $this->createForm(new SalesEntityType($entity), $entity, array('read_only' => true) );
Run Code Online (Sandbox Code Playgroud)

此代码适用于主要表单,但有许多子表单通过包含成为其中的一部分.show.html.twig中的一个例子是:

{% include 'TargetCommonBundle:Hours:hoursForm.html.twig' with { form: hours } %}
Run Code Online (Sandbox Code Playgroud)

不幸的是,父表单上的read_only设置似乎没有级联到包含的子表单.有办法处理这个吗?

php forms subforms symfony twig

12
推荐指数
1
解决办法
6789
查看次数

java.sql.SQLNonTransientException:[Amazon] [JDBC](10900)并非所有参数都已填充

我正在使用Spring @EnableAsync和@Async注释构建一个多线程的Spring Boot应用程序.当我使用单个线程(CorePoolSize 1,MaxPoolSize 1)运行应用程序时,一切都按预期工作.当我将池大小增加到1以上似乎是随机出现时,我得到java.sql.SQLNonTransientException:[Amazon] JDBC并非所有参数都已填充.调用Amazon AWS Redshift数据库时出错.

在ServiceProcessBean.java中,我自动连接了我的ProcessService类(要完成的线程工作)和ShipmentDAO,它加载了一个由ProcessService.process()方法处理的装运ID列表,代码如下.

@Component
public class ShipmentBatchBean {

  private Logger logger = LoggerFactory.getLogger(this.getClass());

  @Autowired
  private ShipmentDAO shipmentDAO;

  @Autowired
  private ProcessService processService;

  @Scheduled(
    initialDelayString = "${executor.delay.initial}",
    fixedDelayString = "${executor.delay.fixed}"
  )
  public void cronJob() throws InterruptedException, ExecutionException {

    List<CompletableFuture<Boolean>> asyncResponse = new ArrayList<>();

    logger.info("Starting cronJob() method");

    try {
      List<String> shipments = shipmentDAO.getAllShipmentsReadyForIeta();
      logger.info("There are {} shipments to be processed in the data store", 
          shipments.size());

      for(String shipment : shipments) {
        asyncResponse.add(processService.process(shipment));
      }
    } catch (Exception …
Run Code Online (Sandbox Code Playgroud)

java spring-jdbc amazon-redshift spring-boot spring-async

6
推荐指数
1
解决办法
1620
查看次数