Pepperbc
07/04/2020, 3:42 AMJoel
07/17/2020, 9:29 PMDatabase.connect
is the default db? This is inconvenient when working with Spring Boot because bean creation order is undefined.Joel
08/03/2020, 1:22 PMtapac
08/03/2020, 10:16 PMYoavya
08/04/2020, 7:31 AMcolumnX.count()
in the slice part of the query.
I want to do something like this
count(*) filter ( where columnX in ('a', 'b') ) as custom_count
is there an easy way to achieve this?
Thanks 🙂Joel
08/04/2020, 11:36 AMTobias G. Waaler
08/06/2020, 6:27 PMadjustSlice
function from
fun adjustSlice(body: ColumnSet.() -> FieldSet): Query = apply { set = set.source.body() }
to something like
fun adjustSlice(body: ColumnSet.(FieldSet) -> FieldSet): Query = apply { set = set.source.body(set) }
That way you can get a hold of fields that are currently a part of the fieldset for the query and do things like adding additional fields (or even removing fields).
To me this was useful when I wanted to add a single extra field to the slice, depending on some condition. Currently I've created this extension function that I'm using, and it works quite well:
fun Query.addToSlice(vararg columns: Expression<*>): Query {
return adjustSlice {
slice(this@addToSlice.set.fields + columns)
}
}
Joel
08/12/2020, 3:42 PMBigDecimal
correctly but it appears that Exposed is rounding the precision to that of the original column.mmaillot
08/18/2020, 2:35 PMUUIDTable
`Intervention`with a child: val foreignEnterprise = reference("foreign_enterprise", ForeignEnterprises.id)
. I want to get the foreign enteprise for an intervention. I have the InterventionUuid
. How can I do ? In SQL, I do: SELECT foreign_enterprise.* from foreign_enterprise, intervention WHERE intervention.foreign_enteprise_id = foreign_enterprise_id AND intervention.id ='`INPUT_UUID`'.Philipp Mayer
08/18/2020, 4:02 PMobject Sensors : IntIdTable() {
val roomId = reference("id", Rooms.id).nullable()
val name = text("name")
}
And now I just want to select all rows and map them to my domain Object:
class Sensor(
val id: Int?,
val roomId: Int?,
val name: String
)
Sensors.selectAll().map {
Sensor(it[id], it[roomId], it[name])
}
However, if I do it as shown, I get an alert saying that it[id]
is of type string (while I expect an int).
Ist htere a better way? Why is it like that, even though my table definition is different?
Thanks in advance!Ivan
08/19/2020, 4:52 AMmanlan
08/22/2020, 4:29 AMzero_coding
08/23/2020, 8:40 AMdarkmoon_uk
08/24/2020, 2:23 PMzero_coding
08/26/2020, 11:21 AMobject Genders : Table() {
val value: Column<String> = varchar("value", 1)
val description: Column<String> = varchar("description", 20)
override val primaryKey = PrimaryKey(value)
}
As next, I would like to create an Entity class for it and I have tried:
class Gender(v: EntityID<String>) : Entity<String>(v) {
companion object : EntityClass<String, Gender>(???)
var value by Genders.value
var description by Genders.description
}
zero_coding
08/30/2020, 8:50 AMtransaction
and later do the transaction.Wyatt Kennedy
08/31/2020, 7:58 PMMranders
09/01/2020, 8:35 AMmp
09/01/2020, 10:11 AMsealed class A {
abstract val a: Int
data class B(val b: String, override val a: Int) : A()
data class C(val c: Boolean, override val a: Int) : A()
}
persist those B,C classes to single table, with nullable b and c fields - make it any sense from exposed point of view?
I’ve tried to google some samples for this but without success. thats why interesting to ask about it( maybe this idea some example of sick imagination of mine 😃)neetkee
09/02/2020, 9:32 AMDas135
09/03/2020, 1:38 PMtransaction {
FirstObject.selectAll()
supplyAsync {
runBlocking {
SecondObject.selectAll()
}
}
}
I need to do both calls inside one transaction.
When calling SecondObject.selectAll()
, I got exception No transaction in context
. https://github.com/JetBrains/Exposed/wiki/Transactions#working-with-coroutines -> This should probably help me, but I did not fully understand how to use it.manlan
09/11/2020, 8:45 PMDmitry Lapshin
09/16/2020, 12:30 PMJoel
09/16/2020, 2:52 PMSELECT 1
degreat
09/19/2020, 11:49 AMINSERT IGNORE...
throws an exception when using H2. I'm up-to-date with exposed and h2 drivers... Am I missing anything else?Mihael
09/22/2020, 12:48 PMpaulex
09/26/2020, 10:11 AMVinicius Araujo
09/30/2020, 1:19 AMfun addA() = transaction{A insert statement}
fun addB() = trabsaction{B insert statement}
suspend fun applyAandB() = coroutineScope {
launch { addA() }
launch { addB() }
}
would them execute asyncronously?Júlio Santos
09/30/2020, 5:52 PMEmployee.select { Employee.id = id and (Employee.name = name)}
is that correct?Reprator
10/04/2020, 4:06 PM