Finally got PVT working with the database