JetBrains / JetBrains/Exposed

What is the way to create DAO entity with a pre-defined value for a foreign key reference?

Open
#1,248 5 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

For instance, here's a sample from readme:

```kotlin
class User(id: EntityID) : IntEntity(id) {
companion object : IntEntityClass(Users)

var name by Users.name
var city by City referencedOn Users.city
var age by Users.age
}
```

Suppose I know `id` for `"St. Petersburg"` city is 42.
How could I create a user without loading the city?

```kotlin
User.new {
name = "a"
city = 42 // <-- ??? is there a way to specify the value without loading the city first?
age = 5
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.