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

Load before flush leads to exception. #1472

Closed
neetkee opened this issue Mar 14, 2022 · 0 comments
Closed

Load before flush leads to exception. #1472

neetkee opened this issue Mar 14, 2022 · 0 comments

Comments

@neetkee
Copy link
Contributor

neetkee commented Mar 14, 2022

Hello.

Exception will be thrown if:

  • entity has one-to-many relations
  • entity has autoincrement id
  • load() is invoked on these relations before entity flush

I'm not sure if it's a normal behaviour or a bug, but with UUID primary key, it works fine.

Stacktrace:

NULL in non-nullable column
java.lang.IllegalStateException: NULL in non-nullable column
	at org.jetbrains.exposed.sql.IColumnType$DefaultImpls.valueToString(ColumnType.kt:50)
	at org.jetbrains.exposed.sql.ColumnType.valueToString(ColumnType.kt:84)
	at org.jetbrains.exposed.sql.QueryBuilder.registerArguments$toString(Expression.kt:86)
	at org.jetbrains.exposed.sql.QueryBuilder.registerArguments(Expression.kt:89)
	at org.jetbrains.exposed.sql.QueryBuilder.registerArgument(Expression.kt:80)
	at org.jetbrains.exposed.sql.ops.InListOrNotInListBaseOp.registerValues(InListOps.kt:65)
	at org.jetbrains.exposed.sql.ops.InListOrNotInListBaseOp.access$registerValues(InListOps.kt:11)
	at org.jetbrains.exposed.sql.ops.InListOrNotInListBaseOp$toQueryBuilder$1.invoke(InListOps.kt:46)
	at org.jetbrains.exposed.sql.ops.InListOrNotInListBaseOp$toQueryBuilder$1.invoke(InListOps.kt:23)
	at org.jetbrains.exposed.sql.QueryBuilder.invoke(Expression.kt:20)
	at org.jetbrains.exposed.sql.ops.InListOrNotInListBaseOp.toQueryBuilder(InListOps.kt:23)
	at org.jetbrains.exposed.sql.QueryBuilder.append(Expression.kt:59)
	at org.jetbrains.exposed.sql.QueryBuilder.unaryPlus(Expression.kt:68)
	at org.jetbrains.exposed.sql.Query$prepareSQL$1.invoke(Query.kt:124)
	at org.jetbrains.exposed.sql.Query$prepareSQL$1.invoke(Query.kt:106)
	at org.jetbrains.exposed.sql.QueryBuilder.invoke(Expression.kt:20)
	at org.jetbrains.exposed.sql.Query.prepareSQL(Query.kt:106)
	at org.jetbrains.exposed.sql.AbstractQuery.arguments(AbstractQuery.kt:35)
	at org.jetbrains.exposed.sql.AbstractQuery.arguments(AbstractQuery.kt:8)
	at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:31)
	at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:144)
	at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:130)
	at org.jetbrains.exposed.sql.AbstractQuery.iterator(AbstractQuery.kt:61)
	at org.jetbrains.exposed.sql.IterableExKt$mapLazy$1.iterator(IterableEx.kt:129)

Issue project: https://github.com/neetkee/exposed-load-issue-demo. There is a test to reproduce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants