Failure to Read Updated AnyLogic DB Values

馋奶兔 提交于 2019-12-04 17:04:33

selectFrom and other select queries use cached tables by default. Cache is not affected by update function, it changes original tables. You may force the functions to use non-cached tables using False value of boolean argument.

In case of SQL string it is the first argument of the function:

// read from cache
selectUniqueValue( double.class, "SELECT processing_time FROM processing_times WHERE part = agent.name;"); // or
selectUniqueValue( true, double.class, "SELECT processing_time FROM processing_times WHERE part = agent.name;");

 // read from original
selectUniqueValue( false, double.class, "SELECT processing_time FROM processing_times WHERE part = agent.name;");

In case of queryDSL Java code, it is the first argument of the final function:

// read from cache
selectFrom(branches)
    .where(branches.al_id.eq(9))
    .firstResult( branches.branch ); // or
selectFrom(branches)
    .where(branches.al_id.eq(9))
    .firstResult( true, branches.branch );

// read from original
selectFrom(branches)
    .where(branches.al_id.eq(9))
    .firstResult( false, branches.branch );
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!