0

I have an entity with a composite key

@Entity
data class Page(
  @EmbeddedId
  val pageId : PageId,
  ...
)

@Embeddable
data class PageId (
  @Column(name = "id")
  val id: UUID,
  @Column(name = "is_published")
  val isPublished: Boolean
)

But I need to respect the existing column names in the db table, which are 'id' and 'is_published' But querying the db with a JDBCRepository I get the error:

SQL Error executing Query: ERROR: column page_.page_id_published does not exist

Is there any way that I can map the columns correctly?

Tilman Rossmy
  • 181
  • 2
  • 10

1 Answers1

0

Try and error led me to the answer, somehow Micronaut does not like a Boolean to be named 'isPublished', when I rename it to 'published' it works fine:

data class PageId (
    @MappedProperty(value  = "id")
    val id: UUID,
    @MappedProperty(value = "is_published")
    val published: Boolean)
Tilman Rossmy
  • 181
  • 2
  • 10