com.beeproduced.bee.persistent.fieldconverter.StringSetConverter.kt Maven / Gradle / Ivy
package com.beeproduced.bee.persistent.fieldconverter
import jakarta.persistence.AttributeConverter
import jakarta.persistence.Converter
@Converter
class StringSetConverter : AttributeConverter, String> {
override fun convertToDatabaseColumn(attribute: Set?): String {
if (attribute == null) return ""
return attribute.joinToString(",")
}
override fun convertToEntityAttribute(dbData: String?): Set {
if (dbData.isNullOrEmpty()) return emptySet()
return dbData.split(",").toSet()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy