use of org.eclipse.jpt.jpa.core.context.PersistentAttribute in project jbosstools-hibernate by jbosstools.
the class HibernateJavaJoinColumnImpl method getReferencedPersistentAttribute.
@Override
public PersistentAttribute getReferencedPersistentAttribute() {
if (this.parentAdapter.getJoinColumnsSize() != 1) {
return null;
}
Entity targetEntity = this.parentAdapter.getRelationshipTarget();
if (targetEntity == null) {
return null;
}
PersistentAttribute pAttr = null;
Iterator<PersistentAttribute> attributes = targetEntity.getPersistentType().getAllAttributes().iterator();
for (Iterator<PersistentAttribute> stream = attributes; stream.hasNext(); ) {
PersistentAttribute attribute = stream.next();
String name = attribute.getPrimaryKeyColumnName();
if (name != null) {
if (pAttr == null) {
pAttr = attribute;
} else {
return null;
}
}
}
return pAttr;
}
use of org.eclipse.jpt.jpa.core.context.PersistentAttribute in project jbosstools-hibernate by jbosstools.
the class HibernateOrmJoinColumnImpl method getReferencedPersistentAttribute.
public PersistentAttribute getReferencedPersistentAttribute() {
if (this.parentAdapter.getJoinColumnsSize() != 1) {
return null;
}
Entity targetEntity = this.parentAdapter.getRelationshipTarget();
if (targetEntity == null) {
return null;
}
PersistentAttribute pAttr = null;
for (PersistentAttribute attribute : targetEntity.getPersistentType().getAllAttributes()) {
String name = attribute.getPrimaryKeyColumnName();
if (name != null) {
if (pAttr == null) {
pAttr = attribute;
} else {
return null;
}
}
}
return pAttr;
}
Aggregations