5 Replies Latest reply on Mar 13, 2008 3:47 PM by Vassiliy Dubkin

    SelectItems, Hibernate and i18n

    Vassiliy Dubkin Newbie

      Hello everybody! I have the following problem and hope that someone could give me some help and/or advices.


      For example I have the following entity and the enum:


      public class Person {
      
        @Enumerated(EnumType.ORDINAL)
        @Column(name="sex")
        Sex sex = Sex.MALE;
        
        //getter and setter
      }
      
      public enum Sex {
        MALE, FEMALE;
      }
      



      My problem is, if the user creates or updates an instance of type Person he can select Male or Female from a selectOneList. In a dataTable I will just show Male or Female in one column. Till now everything works fine. But I will show the translations for Male and Female regarding to the user locale.


      Simple MessageResource couldn't help me, since the content is dynamic. There is just one approach in my mind: Using converters. But that seems not very smart to me, since I need at least two converters for this little example. One for the selectOneList and one for h:outputText in the datatable.


      I'am a sure that this is a first class problem and there must be a clean solution. How do you deal with that kind of problem?


      Thanks in advance!