Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtaal2009-07-05 00:11:10 +0000
committermtaal2009-07-05 00:11:10 +0000
commit1d47377842237d43a740cb3901232ad41c812dd5 (patch)
tree9c2d2eed708f19497d43ed82e9cfb5e37a77fda6
parent2fdeef38754a01d14c2d7b2e1b860485ac86195d (diff)
downloadorg.eclipse.emf.teneo-1d47377842237d43a740cb3901232ad41c812dd5.tar.gz
org.eclipse.emf.teneo-1d47377842237d43a740cb3901232ad41c812dd5.tar.xz
org.eclipse.emf.teneo-1d47377842237d43a740cb3901232ad41c812dd5.zip
[282442]
-rw-r--r--plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java
index b5c07881d..9e0e1369c 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java
@@ -216,6 +216,30 @@ public abstract class AbstractAssociationMapper extends AbstractMapper {
addCommentElement(per.getModelEReference(), columnElement);
// --- JJH
+ if (joinColumn.getReferencedColumnName() != null) {
+ String propName = null;
+ final String colName = joinColumn.getReferencedColumnName();
+ for (PAnnotatedEStructuralFeature pef : per.getPaEClass().getPaEStructuralFeatures()) {
+ if (pef instanceof PAnnotatedEReference) {
+ final PAnnotatedEReference paEreference = (PAnnotatedEReference) pef;
+ // set a default, by looking for the efeature name
+ if (pef.getModelElement().getName().equals(colName) && propName == null) {
+ propName = getHbmContext().getPropertyName(paEreference.getModelEReference());
+ }
+ // use the columnname, that's according to the standard
+ if (paEreference.getColumn() != null && paEreference.getColumn().getName().equals(colName)) {
+ propName = getHbmContext().getPropertyName(paEreference.getModelEReference());
+ }
+ }
+ }
+ if (propName != null) {
+ associationElement.addAttribute("property-ref", propName);
+ } else {
+ log.warn("No property found for the referencedColumnName " + colName + " and EReference "
+ + per.getModelElement().getName());
+ }
+ }
+
}
// ugly but effective
if (associationElement.getName().compareTo("map-key-many-to-many") != 0
@@ -668,6 +692,27 @@ public abstract class AbstractAssociationMapper extends AbstractMapper {
}
}
+ if (joinColumn.getReferencedColumnName() != null) {
+ String propName = null;
+ final String colName = joinColumn.getReferencedColumnName();
+ for (PAnnotatedEStructuralFeature pef : per.getPaEClass().getPaEStructuralFeatures()) {
+ // set a default, by looking for the efeature name
+ if (pef.getModelElement().getName().equals(colName) && propName == null) {
+ propName = getHbmContext().getPropertyName(pef.getModelEStructuralFeature());
+ }
+ // use the columnname, that's according to the standard
+ if (pef.getColumn() != null && pef.getColumn().getName().equals(colName)) {
+ propName = getHbmContext().getPropertyName(pef.getModelEStructuralFeature());
+ }
+ }
+ if (propName != null) {
+ keyElement.addAttribute("property-ref", propName);
+ } else {
+ log.warn("No property found for the referencedColumnName " + colName + " and EReference "
+ + per.getModelElement().getName());
+ }
+ }
+
// bz247939, after disabling these lines it all seemed to work fine
// if (joinColumn.getTable() != null) {
// log.error("Unsupported secondary table in " + joinColumn);

Back to the top