use of org.hibernate.boot.jaxb.mapping.spi.JaxbColumn in project hibernate-orm by hibernate.
the class JPAXMLOverriddenAnnotationReader method buildColumns.
private Columns buildColumns(JaxbColumn element, String nodeName) {
if (element == null) {
return null;
}
List<Column> columns = new ArrayList<>(1);
columns.add(getColumn(element, false, nodeName));
if (columns.size() > 0) {
AnnotationDescriptor columnsDescr = new AnnotationDescriptor(Columns.class);
columnsDescr.setValue("columns", columns.toArray(new Column[columns.size()]));
return AnnotationFactory.create(columnsDescr);
} else {
return null;
}
}
use of org.hibernate.boot.jaxb.mapping.spi.JaxbColumn in project hibernate-orm by hibernate.
the class JPAXMLOverriddenAnnotationReader method buildAttributeOverrides.
private List<AttributeOverride> buildAttributeOverrides(List<JaxbAttributeOverride> subelements, String nodeName) {
List<AttributeOverride> overrides = new ArrayList<>();
if (subelements != null && subelements.size() > 0) {
for (JaxbAttributeOverride current : subelements) {
AnnotationDescriptor override = new AnnotationDescriptor(AttributeOverride.class);
copyAttribute(override, "name", current.getName(), true);
JaxbColumn column = current.getColumn();
override.setValue("column", getColumn(column, true, nodeName));
overrides.add(AnnotationFactory.create(override));
}
}
return overrides;
}
use of org.hibernate.boot.jaxb.mapping.spi.JaxbColumn in project hibernate-orm by hibernate.
the class JPAXMLOverriddenAnnotationReader method buildColumns.
private Columns buildColumns(List<JaxbColumn> elements, String nodeName) {
List<Column> columns = new ArrayList<>(elements.size());
for (JaxbColumn element : elements) {
columns.add(getColumn(element, false, nodeName));
}
if (columns.size() > 0) {
AnnotationDescriptor columnsDescr = new AnnotationDescriptor(Columns.class);
columnsDescr.setValue("columns", columns.toArray(new Column[columns.size()]));
return AnnotationFactory.create(columnsDescr);
} else {
return null;
}
}
use of org.hibernate.boot.jaxb.mapping.spi.JaxbColumn in project hibernate-orm by hibernate.
the class JPAXMLOverriddenAnnotationReader method getColumn.
private Column getColumn(JaxbColumn element, boolean isMandatory, String nodeName) {
if (element != null) {
AnnotationDescriptor column = new AnnotationDescriptor(Column.class);
copyAttribute(column, "name", element.getName(), false);
copyAttribute(column, "unique", element.isUnique(), false);
copyAttribute(column, "nullable", element.isNullable(), false);
copyAttribute(column, "insertable", element.isInsertable(), false);
copyAttribute(column, "updatable", element.isUpdatable(), false);
copyAttribute(column, "column-definition", element.getColumnDefinition(), false);
copyAttribute(column, "table", element.getTable(), false);
copyAttribute(column, "length", element.getLength(), false);
copyAttribute(column, "precision", element.getPrecision(), false);
copyAttribute(column, "scale", element.getScale(), false);
return (Column) AnnotationFactory.create(column);
} else {
if (isMandatory) {
throw new AnnotationException(nodeName + ".column is mandatory. " + SCHEMA_VALIDATION);
}
return null;
}
}
Aggregations