if (pstate.field != null) {
switch (pstate.field.getTypeCode()) {
case JavaTypes.MAP:
case JavaTypes.ARRAY:
case JavaTypes.COLLECTION:
ValueMapping elem = pstate.field.getElementMapping();
if (pstate.field.isElementCollection() && pstate.field.getElement().isEmbedded()) {
Strategy strategy = pstate.field.getStrategy();
if (strategy instanceof HandlerCollectionTableFieldStrategy) {
return ((HandlerCollectionTableFieldStrategy) strategy).
getElementColumns(elem.getTypeMapping());
} else if (strategy instanceof HandlerHandlerMapTableFieldStrategy) {
return ((HandlerHandlerMapTableFieldStrategy) strategy).
getValueColumns(elem.getTypeMapping());
}
}
if (pstate.joinedRel && elem.getTypeCode() == JavaTypes.PC)
return elem.getTypeMapping().getPrimaryKeyColumns();
if (elem.getColumns().length > 0)
return elem.getColumns();
return pstate.field.getColumns();
case JavaTypes.PC:
if (pstate.joinedRel)
return pstate.field.getTypeMapping().
getPrimaryKeyColumns();