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

id select will throw exception #619

Closed
zouzg opened this issue Aug 9, 2019 · 4 comments
Closed

id select will throw exception #619

zouzg opened this issue Aug 9, 2019 · 4 comments

Comments

@zouzg
Copy link

zouzg commented Aug 9, 2019

Any DAO style table, If you used extend LongIdTable("xxxx") or IntIdTable("xxx"), if you select by id, for example, if i have a table like this

object User : LongIdTable("user") {
    val name_ = varchar("name", length = 40)
}

Then I use below DAO API to select

val users = User.select { User.id.greater(100) }.limit(100).toList()

It will throw exception like below:

image

Error:(61, 53) Kotlin: None of the following functions can be called with the arguments supplied: 
public final infix fun <T : Comparable<Long>, S : Long?> ExpressionWithColumnType<in ???>.greaterEq(t: Long): Op<Boolean> defined in org.jetbrains.exposed.sql.SqlExpressionBuilder
public final fun <T : Comparable<EntityID<Long>>, S : EntityID<Long>?> ExpressionWithColumnType<in EntityID<Long>>.greaterEq(other: Expression<EntityID<Long>>): Op<Boolean> defined in org.jetbrains.exposed.sql.SqlExpressionBuilder

While I not extend the LongIdTable, used our own id field, everythink will be OK.

object User : Table("user") {
    val id = long("id").autoIncrement().primaryKey()
    val name_ = varchar("name", length = 40)
}
@Tapac
Copy link
Contributor

Tapac commented Aug 9, 2019

There are no overloaded greater/less functions for EntityID columns yet.
You could use User.id greater EntityID(100L, User) instead.

@zouzg
Copy link
Author

zouzg commented Aug 10, 2019

@Tapac Yes, thanks it works.
But it will confuse user, why not overloaded?

@Tapac
Copy link
Contributor

Tapac commented Aug 28, 2019

Fixed in master. All functions (greater/greaterEq/less/lessEq) were overloaded.

@Tapac Tapac closed this as completed Aug 28, 2019
@zouzg
Copy link
Author

zouzg commented Oct 9, 2019

perfect!

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

No branches or pull requests

2 participants