/**
* Parse @DiscriminatorColumn.
*/
private void parseDiscriminatorColumn(ClassMapping cm,
DiscriminatorColumn dcol) {
Column col = new Column();
if (!StringUtils.isEmpty(dcol.name()))
col.setName(dcol.name());
if (!StringUtils.isEmpty(dcol.columnDefinition()))
col.setTypeName(dcol.columnDefinition());
Discriminator discrim = cm.getDiscriminator();
switch (dcol.discriminatorType()) {
case CHAR:
col.setJavaType(JavaTypes.CHAR);
discrim.setJavaType(JavaTypes.CHAR);
break;
case INTEGER:
col.setJavaType(JavaTypes.INT);
if (dcol.length() != 31)
col.setSize(dcol.length());
discrim.setJavaType(JavaTypes.INT);
break;
default:
col.setJavaType(JavaTypes.STRING);
col.setSize(dcol.length());
discrim.setJavaType(JavaTypes.STRING);
}
cm.getDiscriminator().getMappingInfo().setColumns
(Arrays.asList(new Column[]{ col }));
}