Skip to content

@Column not processed as expected regarding updatable #13

@ChristianSch

Description

@ChristianSch

Hi guys,

Using the aforementioned annotation (as you do in the examples) with @Column(updatable=false) doesn't do anything.

@Entity
data class Customer(
        @Id
        val uuid: UUID = UUID.randomUUID(),

        val email: String,

        @Column(updatable = false)
        val name: String,

        @Embedded
        var address: CustomerAddress = CustomerAddress(),

        var groupId: String?
)

generates the following mapping (mapping.kt):

fun UpdateBuilder<Any>.from(customer: Customer) {
  	this[CustomerTable.uuid] = customer.uuid
  	this[CustomerTable.email] = customer.email
  	this[CustomerTable.name] = customer.name
  	this[CustomerTable.groupId] = customer.groupId
  	this[CustomerTable.addressCity] = customer.address.city
  	this[CustomerTable.addressCountry] = customer.address.country
  	this[CustomerTable.addressLine1] = customer.address.line1
  	this[CustomerTable.addressLine2] = customer.address.line2
  	this[CustomerTable.addressPostalCode] = customer.address.postalCode
  	this[CustomerTable.addressState] = customer.address.state
}

I expect the uuid and the name to not be included in this generated update mapping.

So it would be nice to either have documentation on what you actually process (found it here indirectly though). I feel like it's weird behaviour btw that I can just update an id after creation. My question is: can I somehow prevent updating with krush? If not, would it be something you'd consider implementing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions