Why not encapsulate the constant access through Dao traitthat which is introduced into the actor himself. Thus, you can have an actor of perseverance that is separate from the preservation mechanism itself:
class DaoActor(val dao: Dao) extends Actor {
def act() = {
loop {
react {
case SaveTrade(trade) => dao.save(trade)
case ReadTrades(date) => dao.lookup(date) }
}
}
}
What's more, yours Daocan be encoded in Java, so you can add annotation there @Transactional.
source
share