https://kotlinlang.org logo
#exposed
Title
# exposed
b

Brian Estrada

05/05/2022, 3:07 PM
I have a question
Does anyone know if you can lazy load columns in exposed? I tried googling but wasn’t able to find any solid answers
I’m having an issue with having a huge blob as a column so it makes loading a ton of rows really slow
h

hfhbd

05/05/2022, 3:26 PM
Hm, it should load lazily by default. Do you have a sample?
b

Brian Estrada

05/05/2022, 9:23 PM
hmm looking now, I realize that the underlying column was actually set as ColumnType()
Untitled.cpp
I was doing something like this
Copy code
override fun readObject(rs: ResultSet, index: Int): Any? {
        val value = super.readObject(rs, index)
        return if (eagerLoading && value != null) {
            valueFromDB(value)
        } else {
            value
        }
    }
I took some inspiration from the
TextColumnType()
and it seems like it’s working now? but not sure any feedback is welcome
h

hfhbd

05/06/2022, 6:11 AM
Yes, I would use the TextColumnType too. BTW you could use it as base class.
4 Views