You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Strange "import" text
import ?;
import extends;
import foo.bar.Feature;
import foo.bar.QDGameProdEntity;
// Some things are omitted
lateinit var feature: PScalar<QDGameProdEntity, Set<? extends Feature>>
Why does the Java code <? extends Feature> appear here ?
Steps to reproduce
packagefoo.barimportfoo.bar.Featureimportio.ebean.*importio.ebean.annotation.*importjava.util.*importjavax.persistence.*
@Entity
@DbName("decision")
@Table(name ="game_prod")
classDGameProdEntity : Model("decision") {
@Id
lateinitvar id:UUID// The database stores this set using bitwise operations.// bits: 00000000 ~ 00011111
@Column(name ="prop_feature")
@Convert(converter =FeatureConverter::class)
var feature:Set<Feature> = emptySet()
classFeatureConverter : AttributeConverter<Set<Feature>, Int> {
overridefunconvertToDatabaseColumn(attribute:Set<Feature>?): Int {
if (attribute ==null) return0returnFeature.entries.foldIndexed(0) { o, i, it ->if (it in attribute) o or (1 shl i) else o
}
}
overridefunconvertToEntityAttribute(dbData:Int?): Set<Feature> {
if (dbData ==null) returnmutableSetOf()
val rs = mutableSetOf<Feature>()
Feature.entries.forEachIndexed { i, it ->if (((dbData ushr i) and1) ==1) rs.add(it)
}
return rs
}
}
}
enumclassFeature{ A,B,C,D,E }
Task :compileKotlin FAILEDe: QDGameProdEntity.kt:3:8 Expecting qualified namee: QDGameProdEntity.kt:58:55 Type expectede: QDGameProdEntity.kt:58:56 Expecting a '>'e: QDGameProdEntity.kt:58:57 Property getter or setter expectede: QDGameProdEntity.kt:7:8 Unresolved reference: extends
The text was updated successfully, but these errors were encountered:
Where are you at with this issue? Did you workaround it? Can you manually produce a QueryBean with the code that you would expect to be generated for us?
Are you able to give an update on this? Did you remove the attribute converter?
This is an interesting one, ultimately we'd want to be able to know that query predicates for this are translating into bit wise database functions etc so I think handling this via a AttributeConverter is actually problematic in the end (because it isn't smart enough to translate the query predicts). I think we need a different approach here.
I used the kotlin extension property instead of the @Convert.
However, this means that the original database fields appear in the class, and the extended properties don't appear in the serialized object (e.g., json), which obviously doesn't seem very elegant, but for now, that's the best we can do.
Of course, each read or write to this extension property incurs an additional performance penalty, which annoy me. Maybe the performance loss is not big, and it's my mind fell into a hole.
Environment
Java 17, Kotlin 1.9.20, Gradle: 8.2.1 and this configuration.
Tried to update to "13.25.1", but the issue is still unresolved
Expected behavior
Generate an
lateinit var feature: PScalar<QDGameProdEntity, Set<Feature>>
Actual behavior
Path: build/kaptKotlin/main/foo/bar/query/QDGameProdEntity.kt
Why does the Java code
<? extends Feature>
appear here ?Steps to reproduce
The text was updated successfully, but these errors were encountered: