Database-based queue abstraction in Java