java/db: Added double handling for entity object.