Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchUpdateStatement results in IllegalStateException: Table.columnName is already initialized #386

Closed
jon-mey opened this issue Sep 12, 2018 · 0 comments
Assignees
Labels

Comments

@jon-mey
Copy link

jon-mey commented Sep 12, 2018

Based on this example I'm trying to get a BatchUpdateStatement to work:

Database.connect("jdbc:h2:tcp://localhost/~/h2/test", "org.h2.Driver", "sa")

...

transaction {
    addLogger(StdOutSqlLogger)

    BatchUpdateStatement(Areas).apply {
        listOf(1, 2).forEach {
            addBatch(EntityID(it, Areas))
            this[Areas.networkType] = it.toString()
        }
    }.execute(this)
}

...

object Areas : IntIdTable() {
    val latitude = double("latitude")
    val longitude = double("longitude")
    val accuracy = float("accuracy")
    val performance = double("performance")
    val networkType = text("networkType")
}

However, on the second iteration of the loop IllegalStateException is thrown:

Exception in thread "main" java.lang.IllegalStateException: Areas.networkType is already initialized

Am I doing something wrong here?

@Tapac Tapac self-assigned this Sep 12, 2018
@Tapac Tapac added the bug label Sep 12, 2018
@Tapac Tapac closed this as completed Sep 12, 2018
Tapac added a commit that referenced this issue Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants