in my service layer i want to insert transaction-ally if insert than all the three row are inserted in database !!
Service Layer is
def service(userRow, addressDao, contactDao) = DB.withTransaction { implicit session =>
userDao.insert(userRow)
addressDao.insert(addressRow)
contactDao.insert(contactRow)
}
my dao layer is
def insert(userRow: UsersRow) = DB.withTransaction { implicit session =>
user += userRow
}
change your insert method to
The session will be propagated and all inserts use the same session. If the session is using a transaction as your example did, then it will be done in the same transaction.