Data access code in Scala