Nearly 3 years ago Gavin King wrote an article with the same title as above.
There is some code example there, but some key points are missing. At least, that's how I see it.
There is nothing there about mapping the table Label, and nothing about how could a LabelUserType know the user's preferred language instead it is stored with hibernate (in the db) too.
And it seems that in the example that he get all the labels with the actual primary key for all the languages. And cannot see how can he sort out the ones for the actual language.
The 'magic' should be somewhere this part:
Long code = (Long) Hibernate.LONG.nullSafeGet(rs, names, owner);
return Label.getDescrption(code, User.current().getLanguage());
Are theese points as simple as he wrote it in that article? If yes, could somebody "enlighten" me, how can I solve them?
Thanks
PS: I usually generate POJOs with hibernatetool and I haven't seen a generated getter with two arguments as "Label.getDescrption( code, User.current().getLanguage() );" in that article. Could I generate it somehow?
|