下面的查询返回一个VARCHAR值,我想将此值作为字符串返回。我该怎么办?
// src/main/kotlin/domain/Plan.kt
@Entity
@Table(name = "provider")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
data class Provider(
// [...]
@OneToMany(mappedBy = "provider")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
var plans: MutableSet<Plan> = mutableSetOf(),
@OneToMany(mappedBy = "provider")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
var perDayPricings: MutableSet<PerDayPricing> = mutableSetOf(),
@OneToMany(mappedBy = "provider")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
var fixedDurationPricings: MutableSet<FixedDurationPricing> = mutableSetOf()
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
) : Serializable
答案 0 :(得分:1)
您可以创建一个列表并将值添加到列表中。返回列表后。
答案 1 :(得分:0)
如何以字符串形式返回VARCHAR查询结果:
while (reader.Read())
{
results= reader.GetString(0); // Added this
}
return results;