use of org.hibernate.boot.jaxb.mapping.spi.JaxbJoinTable in project hibernate-orm by hibernate.
the class JPAXMLOverriddenAnnotationReader method buildJoinTable.
/*
* no partial overriding possible
*/
private JoinTable buildJoinTable(JaxbJoinTable subelement, XMLContext.Default defaults) {
final Class<JoinTable> annotationType = JoinTable.class;
if (subelement == null) {
return null;
}
// ignore java annotation, an element is defined
AnnotationDescriptor annotation = new AnnotationDescriptor(annotationType);
copyAttribute(annotation, "name", subelement.getName(), false);
copyAttribute(annotation, "catalog", subelement.getCatalog(), false);
if (StringHelper.isNotEmpty(defaults.getCatalog()) && StringHelper.isEmpty((String) annotation.valueOf("catalog"))) {
annotation.setValue("catalog", defaults.getCatalog());
}
copyAttribute(annotation, "schema", subelement.getSchema(), false);
if (StringHelper.isNotEmpty(defaults.getSchema()) && StringHelper.isEmpty((String) annotation.valueOf("schema"))) {
annotation.setValue("schema", defaults.getSchema());
}
buildUniqueConstraints(annotation, subelement.getUniqueConstraint());
buildIndex(annotation, subelement.getIndex());
annotation.setValue("joinColumns", getJoinColumns(subelement.getJoinColumn(), false));
annotation.setValue("inverseJoinColumns", getJoinColumns(subelement.getInverseJoinColumn(), true));
return AnnotationFactory.create(annotation);
}
Aggregations