It's sad that I have to ask for this, but how can I store a char in my Postgres DB, but show String for the selection of the value. I'm creating a web application with JSF.
So my .xhtml:
<p:outputLabel for="gender" value="Geschlecht:" />
<p:selectOneMenu id="gender" value="#{telefonbuchController.telefonbuch.gender}" style="width:125px">
<f:selectItem itemLabel="Auswählen" itemValue="" />
<f:selectItems value="#{telefonbuchController.genderList}" var="c" itemLabel="#{gender}" itemValue="#{gender}"/>
</p:selectOneMenu>
Model:
@Column
private char gender;
In the controller for the form I create a list of Strings for male and female and init them with PostConstruct.
private List<String> geschaeftsstellen;
Here you see how it should look. I implemented it with a String, but I want to just store 'm' and 'f' in my database instead of the whole string.