modify entity outside transaction

Viewed 127

I just started with kotlin exposed and looking into documentation as i am really surprised with semantic of working with "detached entities". To keep things straight: Is it possible to modify entity object OUTSIDE of transaction and then attach it (effectively to have it updated) in other transactions ?

I have worked for a number of years with hibernate/JPA and it has been some kind of "standard" flow in which:

  • entity object is returned from DAO(repository) layer to a "service layer",
  • it is then modified in a service layer,
  • finally it is sent back to DAO layer for changes to be persisted.

In kotlin exposed if i try to modify a single scalar property outside of transaction sth like

 location.postcode = "other postCode"

an exception (No transaction in context.) is thrown.

Is it intended ?

1 Answers

I don't think it'll work. Official document says all CRUD operations should be done in transaction.

Related