title: Kotlin Exposed create entity with reference
body: <p>I am trying to write a CRUD service using Exposed on Kotlin. I have a table with many-to-one reference. When I am trying to do an insert I am getting</p>
  <blockquote>
  <p>java.lang.IllegalStateException: No transaction in context.</p>
  </blockquote>
  <p>Here is table and entity</p>
  <pre><code>object Contacts : IntIdTable(&quot;ph_contact&quot;){
      var firstName = varchar(&quot;first_name&quot;,255)
      var lastName = varchar(&quot;last_name&quot;,255)
      var phone = varchar(&quot;phone&quot;,4096)
      var email = varchar(&quot;email&quot;,4096)
      var user = reference(&quot;user&quot;,Users)
  }
  
  class ContactEntity (id: EntityID&lt;Int&gt;): IntEntity(id){
      companion object : IntEntityClass&lt;ContactEntity&gt;(Contacts)
  
      var firstName by Contacts.firstName
      var lastName by Contacts.lastName
      var phone by Contacts.phone
      var email by Contacts.email
      var user by UserEntity referencedOn Contacts.user
  
  
      fun toContact() = Contact(id.value,user.id.value,firstName,lastName,phone,email)
  
  }
  
  
  data class Contact(
      val id: Int,
      val userId: Int,
      val firstName: String,
      val lastName: String,
      val phone: String,
      val email: String
  )
  </code></pre>
  <p>Here is service method for creation</p>
  <pre><code>fun createContact(contact: Contact) = transaction {
  
          ContactEntity.new {
  
             this.firstName=contact.firstName
             this.lastName=contact.lastName
             this.phone=contact.phone
             this.email=contact.email
             this.user= UserEntity[contact.userId]
  
          }
      }
  </code></pre>
  <p>The error is thrown when I call toContact() method after saving the entity</p>
  <blockquote>
  <p>var contact = contactEntity.toContact()</p>
  </blockquote>
  <p>What is the correct way to perform creation of such entity?</p>