I am updating my database value using the following function which is updated on Startup,
if(location_port==1){
update(connection)
.where(connection.condition.eq(1))
.set(connection.source_name, "Stephenville Crossing")
.execute();
update(connection)
.where(connection.condition.eq(2))
.set(connection.destination_name, "Stephenville Crossing")
.execute();
}
And I have these values connected with agent parameter.
So here is my problem: The values do update after I close the simulation. And if i run the model it works. But is there a way to do this during the current simulation?
N.B: I do have learned that anylogic used cached DB values by default. Is there a way to use non cached values, so that my agent parameters get the updated value at startup time?
Yes. Every query function has an overloaded "brother" function that lets you specify if you want to access the cached or (slower) non-cached version.Just check the code-complete API calls.
For example, the count()
call also has a count(boolean cached)
version. Same with firstResult(...)
Or use List<Tuple> rows = selectFrom(myTable).list();
as this is always non-cached