hibernate - JPA - MapKeyColumn is null even if data are in the database -
im trying localize jpa application. i'm using @mapkeycolumn attribute in class. defined class in way:
@entity @inheritance(strategy = inheritancetype.joined) @table(name = "bientoo_sport") public class sport implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) @column(name = "sportid") private long id; @column(name = "code") private string code; @onetomany(fetch = fetchtype.lazy, orphanremoval = true, mappedby = "sport") @mapkeycolumn(name = "sport_language_key") private map<string,sportlocalizedstring> sportlocalizedstring; public long getid() { homecoming id; } public void setid(long id) { this.id = id; } public string getcode() { homecoming code; } public void setcode(string code) { this.code = code; } public map<string, sportlocalizedstring> getsportlocalizedstring() { homecoming sportlocalizedstring; } public void setsportlocalizedstring(map<string, sportlocalizedstring> sportlocalizedstring) { this.sportlocalizedstring = sportlocalizedstring; } public sportlocalizedstring newsportlocalizedstring(){ homecoming new sportlocalizedstring(); } @entity @table(name = "bientoo_sport_localized_string") public class sportlocalizedstring implements serializable { @id @generatedvalue(generator = "bientoosportlocalizedstring", strategy = generationtype.table) @tablegenerator(name = "bientoosportlocalizedstring", table = "sequence_generator", pkcolumnname = "id_name", valuecolumnname = "id_val", pkcolumnvalue = "sportlocalizedstring", allocationsize = 50) @column(name = "sport_localized_id") private long id; @column(name = "sport_language_key") private string language; @column(name = "sport_language_name") private string name; @manytoone private sport sport; public string getname() { homecoming name; } public void setname(string name) { this.name = name; } public string getlanguage() { homecoming language; } public void setlanguage(string language) { this.language = language; } public sport getsport() { homecoming sport; } public void setsport(sport sport) { this.sport = sport; } } }
as can see in sport have onetomany relationship inner class. when launch application works fine. when retrieve sport object map sportlocalizedstring null. i'm doing wrong?
try replace @mapkeycolumn(name = "sport_language_key")
@mapkey(name = "language")
hibernate jpa
No comments:
Post a Comment