Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtaal2006-11-13 14:55:08 -0500
committermtaal2006-11-13 14:55:08 -0500
commita0bff57fcc23be1acaf31cce828544e23d041474 (patch)
tree8025fbaeb9100c04fdef58f5fb6e4a61f64baaec
parentac07cab0fc78e3c3592fd67061492bafd1a2b738 (diff)
downloadorg.eclipse.emf.teneo-a0bff57fcc23be1acaf31cce828544e23d041474.tar.gz
org.eclipse.emf.teneo-a0bff57fcc23be1acaf31cce828544e23d041474.tar.xz
org.eclipse.emf.teneo-a0bff57fcc23be1acaf31cce828544e23d041474.zip
[164374]
[164270] [164242]
-rw-r--r--plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractMapper.java165
-rw-r--r--plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractPropertyMapper.java9
-rw-r--r--plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/BasicMapper.java40
-rw-r--r--plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/IdMapper.java26
-rw-r--r--plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/ManyAttributeMapper.java11
5 files changed, 118 insertions, 133 deletions
diff --git a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractMapper.java b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractMapper.java
index 412ed2278..90eae0287 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractMapper.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractMapper.java
@@ -12,7 +12,7 @@
* Davide Marchignoli
* </copyright>
*
- * $Id: AbstractMapper.java,v 1.3 2006/11/13 14:53:00 mtaal Exp $
+ * $Id: AbstractMapper.java,v 1.4 2006/11/13 19:55:09 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapper;
@@ -21,16 +21,11 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEAttribute;
-import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEDataType;
-import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEModelElement;
import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEReference;
import org.eclipse.emf.teneo.annotations.pannotation.Column;
-import org.eclipse.emf.teneo.annotations.pannotation.PAnnotation;
import org.eclipse.emf.teneo.annotations.pannotation.PannotationFactory;
import org.eclipse.emf.teneo.hibernate.hbannotation.Cache;
import org.eclipse.emf.teneo.hibernate.hbmodel.HbAnnotatedEAttribute;
@@ -47,8 +42,7 @@ import org.eclipse.emf.teneo.util.EcoreDataTypes;
abstract class AbstractMapper {
/** logs it all */
- private static final Log log = LogFactory.getLog(AbstractMapper.class);
-
+ // private static final Log log = LogFactory.getLog(AbstractMapper.class);
/** return the opposite of an association */
protected PAnnotatedEReference getOtherSide(PAnnotatedEReference paReference) {
// TODO assuming that mappedBy coincide with opposite, check in validation
@@ -77,7 +71,8 @@ abstract class AbstractMapper {
*/
protected String hbType(PAnnotatedEAttribute paAttribute) {
final EAttribute eAttribute = paAttribute.getAnnotatedEAttribute();
- final HbAnnotatedEDataType hed = (HbAnnotatedEDataType)paAttribute.getPaModel().getPAnnotated(eAttribute.getEAttributeType());
+ final HbAnnotatedEDataType hed = (HbAnnotatedEDataType) paAttribute.getPaModel().getPAnnotated(
+ eAttribute.getEAttributeType());
final EDataType eDataType = paAttribute.getAnnotatedEAttribute().getEAttributeType();
if (hed != null && hed.getHbTypeDef() != null) {
return hed.getHbTypeDef().getName();
@@ -97,50 +92,56 @@ abstract class AbstractMapper {
}
}
- /** Sets property attributes on the basis of the column */
- protected void addColumn(Element propertyElement, String defaultName, Column column, boolean forceNullable,
- boolean isId) {
- if (column != null) {
- if (!isId) {
- propertyElement.addAttribute("insert", column.isInsertable() ? "true" : "false");
- propertyElement.addAttribute("update", column.isUpdatable() ? "true" : "false");
+ /**
+ * Returns the (possibly overridden) JoinColumns annotations for the given reference or an empty list if no
+ * JoinColumns were defined.
+ */
+ protected List getJoinColumns(PAnnotatedEReference paReference) {
+ List joinColumns = getHbmContext().getOverride(paReference);
+ if (joinColumns == null) {
+ return paReference.getJoinColumns();
+ }
+ return joinColumns;
+ }
- // MT: I think that the column nullability should not be used for setting not-null
- // on the property, this is already specified by the optional attribute on the
- // basic annotation. Maybe a check can be used instead to detect inconsistenties
- // in the column attributes and the basic ann.
- // Note that the ejb3 spec says that optional should be disregarded for primitive types which I
- // do not understand.
- // I disabled it for now to ignore for the test cases.
- // MT05032006: After some more thought the column nullability can be used in case of
- // single table inheritance mapping
- propertyElement.addAttribute("not-null", column.isNullable() ? "false" : "true");
- propertyElement.addAttribute("unique", column.isUnique() ? "true" : "false");
- }
- addColumnElement(propertyElement, defaultName, column, forceNullable);
-
- } else if (getHbmContext().getEmbeddingFeature() != null) { // embedded
- // TODO: check illegal, embedded component can not really have an id
- final PAnnotatedEReference pae = getHbmContext().getEmbeddingFeature();
- final String name = pae.getAnnotatedEReference().getName() + "_" + defaultName;
- final Column newColumn = PannotationFactory.eINSTANCE.createColumn();
- newColumn.setName(name);
- addColumnElement(propertyElement, defaultName, newColumn, forceNullable);
- //propertyElement.addAttribute("column", getHbmContext().trunc(name));
- } else {
- final Column newColumn = PannotationFactory.eINSTANCE.createColumn();
- newColumn.setName(getHbmContext().trunc(defaultName));
- addColumnElement(propertyElement, defaultName, newColumn, forceNullable);
- //propertyElement.addAttribute("column", getHbmContext().trunc(defaultName));
+ /** Adds a cache element */
+ protected void addCacheElement(Element parent, Cache cache) {
+ // translate to hibernate specific notation
+ final String usage = cache.getUsage().getName().toLowerCase().replaceAll("_", "-");
+
+ // note a trick because the name of the
+ Element cacheElement = parent.addElement("cache").addAttribute("usage", usage);
+ if (cache.getRegion() != null) {
+ cacheElement.addAttribute("region", cache.getRegion());
+ }
+ if (cache.getInclude() != null) {
+ cacheElement.addAttribute("include", cache.getInclude());
}
+ parent.remove(cacheElement);
+ parent.add(0, cacheElement);
}
-
+
/** Same as above only handles multiple columns */
- protected void addColumns(Element propertyElement, String defaultName, List columns, boolean forceNullable,
- boolean isId) {
+ protected void addColumns(Element propertyElement, String defaultName, List columns, boolean isNullable,
+ boolean setColumnAttributesInProperty) {
+ // if no columns set then use some default
+ if (columns.isEmpty()) {
+ final String name;
+ if (getHbmContext().getEmbeddingFeature() != null) { // embedded
+ // TODO: check illegal, embedded component can not really have an id
+ final PAnnotatedEReference pae = getHbmContext().getEmbeddingFeature();
+ name = getHbmContext().trunc(pae.getAnnotatedEReference().getName() + "_" + defaultName);
+ } else {
+ name = getHbmContext().trunc(defaultName);
+ }
+ final Column col = PannotationFactory.eINSTANCE.createColumn();
+ col.setName(name);
+ col.setNullable(isNullable);
+ columns.add(col);
+ }
for (Iterator it = columns.iterator(); it.hasNext();) {
final Column column = (Column) it.next();
- addColumn(propertyElement, defaultName, column, forceNullable, isId);
+ addColumn(propertyElement, defaultName, column, isNullable, setColumnAttributesInProperty);
}
}
@@ -150,45 +151,56 @@ abstract class AbstractMapper {
protected List getColumns(PAnnotatedEAttribute paAttribute) {
final Column defaultColumn = paAttribute.getColumn();
final Column oc = getHbmContext().getOverride(paAttribute);
-
+
if (oc != null) {
final ArrayList result = new ArrayList();
result.add(oc);
return result;
}
- // try multiple columns
- final HbAnnotatedEAttribute hae = (HbAnnotatedEAttribute)paAttribute;
+ // try multiple columns
+ final HbAnnotatedEAttribute hae = (HbAnnotatedEAttribute) paAttribute;
if (hae.getHbColumns().size() > 0) {
return hae.getHbColumns();
}
final ArrayList result = new ArrayList();
- result.add(defaultColumn);
+ if (defaultColumn != null) {
+ result.add(defaultColumn);
+ }
return result;
}
- /**
- * Returns the (possibly overridden) JoinColumns annotations for the given reference or an empty list if no
- * JoinColumns were defined.
- */
- protected List getJoinColumns(PAnnotatedEReference paReference) {
- List joinColumns = getHbmContext().getOverride(paReference);
- if (joinColumns == null) {
- return paReference.getJoinColumns();
+ /** Sets property attributes on the basis of the column */
+ private void addColumn(Element propertyElement, String defaultName, Column column, boolean isNullable,
+ boolean setColumnAttributesInProperty) {
+ if (column != null) {
+ if (setColumnAttributesInProperty) {
+ // this is not the nicest place to do this
+ if (propertyElement.getName().compareTo("property") == 0
+ || propertyElement.getName().compareTo("many-to-one") == 0) {
+ propertyElement.addAttribute("insert", column.isInsertable() ? "true" : "false");
+ propertyElement.addAttribute("update", column.isUpdatable() ? "true" : "false");
+ }
+ // MT: I think that the column nullability should not be used for setting not-null
+ // on the property, this is already specified by the optional attribute on the
+ // basic annotation. Maybe a check can be used instead to detect inconsistenties
+ // in the column attributes and the basic ann.
+ // Note that the ejb3 spec says that optional should be disregarded for primitive types which I
+ // do not understand.
+ // I disabled it for now to ignore for the test cases.
+ // MT05032006: After some more thought the column nullability can be used in case of
+ // single table inheritance mapping
+ propertyElement.addAttribute("not-null", isNullable || column.isNullable() ? "false" : "true");
+ propertyElement.addAttribute("unique", column.isUnique() ? "true" : "false");
+ }
+ addColumnElement(propertyElement, defaultName, column, isNullable);
}
- return joinColumns;
- }
-
- /** Generic method to log and throw error situation */
- public void processIllFormed(PAnnotatedEModelElement paElement, String cause, PAnnotation offendingAnnotation) {
- log.error(cause + " on " + paElement);
- throw new MappingException(cause, offendingAnnotation);
}
/**
* Add a columnelement to the property, takes into account length, precision etc. forceNullable is set when the
* feature belongs to a featuremap
*/
- protected void addColumnElement(Element propertyElement, String defaultName, Column column, boolean forceNullable) {
+ private void addColumnElement(Element propertyElement, String defaultName, Column column, boolean forceNullable) {
if (column != null) {
Element columnElement = propertyElement.addElement("column").addAttribute("not-null",
column.isNullable() || forceNullable ? "false" : "true").addAttribute("unique",
@@ -215,21 +227,4 @@ abstract class AbstractMapper {
}
}
}
-
- /** Adds a cache element */
- protected void addCacheElement(Element parent, Cache cache) {
- // translate to hibernate specific notation
- final String usage = cache.getUsage().getName().toLowerCase().replaceAll("_", "-");
-
- // note a trick because the name of the
- Element cacheElement = parent.addElement("cache").addAttribute("usage", usage);
- if (cache.getRegion() != null) {
- cacheElement.addAttribute("region", cache.getRegion());
- }
- if (cache.getInclude() != null) {
- cacheElement.addAttribute("include", cache.getInclude());
- }
- parent.remove(cacheElement);
- parent.add(0, cacheElement);
- }
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractPropertyMapper.java b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractPropertyMapper.java
index bd5566714..0320d8640 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractPropertyMapper.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractPropertyMapper.java
@@ -12,20 +12,13 @@
* Davide Marchignoli
* </copyright>
*
- * $Id: AbstractPropertyMapper.java,v 1.3 2006/11/13 14:53:00 mtaal Exp $
+ * $Id: AbstractPropertyMapper.java,v 1.4 2006/11/13 19:55:09 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapper;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEReference;
-import org.eclipse.emf.teneo.annotations.pannotation.Column;
import org.eclipse.emf.teneo.annotations.pannotation.EnumType;
import org.eclipse.emf.teneo.annotations.pannotation.Enumerated;
-import org.eclipse.emf.teneo.annotations.pannotation.PannotationFactory;
-import org.eclipse.emf.teneo.simpledom.Element;
/**
* Base class for basic, enum, id etc. mappers. Mainly provides convenience methods.
diff --git a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/BasicMapper.java b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/BasicMapper.java
index a04d89248..41f446071 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/BasicMapper.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/BasicMapper.java
@@ -12,7 +12,7 @@
* Davide Marchignoli
* </copyright>
*
- * $Id: BasicMapper.java,v 1.4 2006/11/13 14:53:00 mtaal Exp $
+ * $Id: BasicMapper.java,v 1.5 2006/11/13 19:55:09 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapper;
@@ -28,12 +28,10 @@ import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEAttribute;
import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEStructuralFeature;
import org.eclipse.emf.teneo.annotations.pannotation.Basic;
-import org.eclipse.emf.teneo.annotations.pannotation.Column;
import org.eclipse.emf.teneo.annotations.pannotation.Enumerated;
import org.eclipse.emf.teneo.annotations.pannotation.FetchType;
import org.eclipse.emf.teneo.annotations.pannotation.PannotationFactory;
import org.eclipse.emf.teneo.annotations.pannotation.TemporalType;
-import org.eclipse.emf.teneo.hibernate.HbMapperException;
import org.eclipse.emf.teneo.hibernate.hbannotation.Parameter;
import org.eclipse.emf.teneo.hibernate.hbmodel.HbAnnotatedEAttribute;
import org.eclipse.emf.teneo.hibernate.hbmodel.HbAnnotatedEDataType;
@@ -85,7 +83,8 @@ class BasicMapper extends AbstractPropertyMapper {
// Buildtime enhancement not supported
propElement.addAttribute("lazy", FetchType.LAZY_LITERAL.equals(basic.getFetch()) ? "true" : "false");
addColumns(propElement, eAttribute.getName(), getColumns(paAttribute), getHbmContext()
- .isCurrentElementFeatureMap(), false);
+ .isCurrentElementFeatureMap()
+ || isNullable(basic, eAttribute), true);
propElement.addAttribute("not-null", isNullable(basic, eAttribute) ? "false" : "true");
handleTypeDef(paAttribute, propElement);
@@ -109,7 +108,8 @@ class BasicMapper extends AbstractPropertyMapper {
propElement.addAttribute("lazy", FetchType.LAZY_LITERAL.equals(basic.getFetch()) ? "true" : "false");
addColumns(propElement, eAttribute.getName(), getColumns(paAttribute), getHbmContext()
- .isCurrentElementFeatureMap(), false);
+ .isCurrentElementFeatureMap()
+ || isNullable(basic, eAttribute), true);
propElement.addAttribute("not-null", isNullable(basic, eAttribute) ? "false" : "true");
handleTypeDef(paAttribute, propElement);
}
@@ -143,8 +143,8 @@ class BasicMapper extends AbstractPropertyMapper {
}
propElement.addAttribute("lazy", FetchType.LAZY_LITERAL.equals(basic.getFetch()) ? "true" : "false");
- addColumns(propElement, paAttribute.getAnnotatedEAttribute().getName(), getColumns(paAttribute), getHbmContext()
- .isCurrentElementFeatureMap(), false);
+ addColumns(propElement, paAttribute.getAnnotatedEAttribute().getName(), getColumns(paAttribute),
+ getHbmContext().isCurrentElementFeatureMap() || isNullable(basic, eAttribute), true);
propElement.addAttribute("not-null", isNullable(basic, eAttribute) ? "false" : "true");
handleTypeDef(paAttribute, propElement);
}
@@ -155,21 +155,22 @@ class BasicMapper extends AbstractPropertyMapper {
public void processEnum(PAnnotatedEAttribute paAttribute) {
log.debug("processEnum " + paAttribute.getAnnotatedEAttribute());
- final List columns = getColumns(paAttribute);
- final Element propElement = getHbmContext().getCurrent().addElement("property").addAttribute("name",
- getHbmContext().getPropertyName(paAttribute.getAnnotatedEAttribute()));
-
final EAttribute eattr = paAttribute.getAnnotatedEAttribute();
Basic basic = paAttribute.getBasic();
if (basic == null) {
basic = PannotationFactory.eINSTANCE.createBasic();
}
+ final List columns = getColumns(paAttribute);
+ final Element propElement = getHbmContext().getCurrent().addElement("property").addAttribute("name",
+ getHbmContext().getPropertyName(paAttribute.getAnnotatedEAttribute()));
+
Enumerated enumerated = paAttribute.getEnumerated();
propElement.addAttribute("lazy", FetchType.LAZY_LITERAL.equals(basic.getFetch()) ? "true" : "false");
propElement.addAttribute("not-null", isNullable(basic, eattr) ? "false" : "true");
- addColumns(propElement, eattr.getName(), columns, getHbmContext().isCurrentElementFeatureMap(), false);
+ addColumns(propElement, eattr.getName(), columns, isNullable(basic, eattr)
+ || getHbmContext().isCurrentElementFeatureMap(), true);
// if an entity then add the special things
final EClassifier eclassifier = paAttribute.getAnnotatedEAttribute().getEType();
@@ -214,7 +215,7 @@ class BasicMapper extends AbstractPropertyMapper {
if (hed == null) { // edatatype not defined in this epackage (probably emf native)
return;
}
-
+
final String name;
final List params;
if (hea.getHbType() != null) {
@@ -250,16 +251,13 @@ class BasicMapper extends AbstractPropertyMapper {
}
final EAttribute eAttribute = paAttribute.getAnnotatedEAttribute();
final Element propElement = getHbmContext().getCurrent().addElement("version").addAttribute("name",
- eAttribute.getName()).addAttribute("type",
- hbType(paAttribute));
+ eAttribute.getName()).addAttribute("type", hbType(paAttribute));
List columns = getColumns(paAttribute);
- if (columns.size() == 0) {
- throw new HbMapperException("Version attribute has no columns defined, eclass " + paAttribute.getAnnotatedEAttribute().getEContainingClass().getName());
- } if (columns.size() > 1) {
- log.warn("Version has more than one attribute, only using the first one, eclass: " + paAttribute.getAnnotatedEAttribute().getEContainingClass().getName());
+ if (columns.size() > 1) {
+ log.warn("Version has more than one attribute, only using the first one, eclass: "
+ + paAttribute.getAnnotatedEAttribute().getEContainingClass().getName());
}
- addColumnElement(propElement, eAttribute.getName(), (Column)columns.get(0), getHbmContext()
- .isCurrentElementFeatureMap());
+ addColumns(propElement, eAttribute.getName(), columns, getHbmContext().isCurrentElementFeatureMap(), false);
handleTypeDef(paAttribute, propElement);
}
diff --git a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/IdMapper.java b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/IdMapper.java
index 4b3e680f2..5fe33e913 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/IdMapper.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/IdMapper.java
@@ -12,7 +12,7 @@
* Davide Marchignoli
* </copyright>
*
- * $Id: IdMapper.java,v 1.4 2006/11/13 14:53:00 mtaal Exp $
+ * $Id: IdMapper.java,v 1.5 2006/11/13 19:55:08 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapper;
@@ -144,7 +144,7 @@ class IdMapper extends AbstractPropertyMapper {
final Element keyPropertyElement = compositeIdElement.addElement("key-property");
keyPropertyElement.addAttribute("name", aFeature.getAnnotatedEStructuralFeature().getName());
addColumns(keyPropertyElement, aAttribute.getAnnotatedEAttribute().getName(), getColumns(aAttribute),
- getHbmContext().isCurrentElementFeatureMap(), true);
+ getHbmContext().isCurrentElementFeatureMap(), false);
keyPropertyElement.addAttribute("type", hbType(aAttribute));
}
getHbmContext().setCurrent(compositeIdElement.getParent());
@@ -178,16 +178,16 @@ class IdMapper extends AbstractPropertyMapper {
final List columns = getColumns(id);
final GeneratedValue generatedValue = id.getGeneratedValue();
-// if (column != null && column.getColumnDefinition() != null) {
-// // TODO support
-// log.error("Unsupported, ColumnDefinition in " + column);
-// throw new MappingException("Unsupported, ColumnDefinition", column);
-// }
-// if (column != null && column.getTable() != null) {
-// // TODO support
-// log.error("Unsupported, SecondaryTable in " + column);
-// throw new MappingException("Unsupported, SecondaryTable", column);
-// }
+ // if (column != null && column.getColumnDefinition() != null) {
+ // // TODO support
+ // log.error("Unsupported, ColumnDefinition in " + column);
+ // throw new MappingException("Unsupported, ColumnDefinition", column);
+ // }
+ // if (column != null && column.getTable() != null) {
+ // // TODO support
+ // log.error("Unsupported, SecondaryTable in " + column);
+ // throw new MappingException("Unsupported, SecondaryTable", column);
+ // }
final Element idElement = getCreateIdElement(getHbmContext().getCurrent(), aClass);
final boolean isCompositeId = aClass.getIdClass() != null;
@@ -199,7 +199,7 @@ class IdMapper extends AbstractPropertyMapper {
usedIdElement = idElement;
}
- addColumns(usedIdElement, eAttribute.getName(), columns, false, true);
+ addColumns(usedIdElement, eAttribute.getName(), columns, false, false);
usedIdElement.addAttribute("name", eAttribute.getName());
if (id.getEnumerated() == null) {
diff --git a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/ManyAttributeMapper.java b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/ManyAttributeMapper.java
index 745716642..01df9506d 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/ManyAttributeMapper.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/ManyAttributeMapper.java
@@ -12,7 +12,7 @@
* Davide Marchignoli
* </copyright>
*
- * $Id: ManyAttributeMapper.java,v 1.2 2006/11/13 14:53:00 mtaal Exp $
+ * $Id: ManyAttributeMapper.java,v 1.3 2006/11/13 19:55:09 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapper;
@@ -106,16 +106,15 @@ class ManyAttributeMapper extends AbstractAssociationMapper {
getHbmContext().addFeatureMapMapper(fmm);
collElement.addElement("one-to-many").addAttribute("entity-name", fmm.getEntityName());
} else {
- addElementElement(collElement, eattr.getName(), paAttribute, getColumns(paAttribute), otm
- .getTargetEntity());
+ addElementElement(collElement, eattr.getName(), paAttribute, getColumns(paAttribute), otm.getTargetEntity());
}
}
/**
* Add Element element in given collection element.
*/
- private Element addElementElement(Element collElement, String defaultName, PAnnotatedEAttribute paAttribute, List columns,
- String targetEntity) {
+ private Element addElementElement(Element collElement, String defaultName, PAnnotatedEAttribute paAttribute,
+ List columns, String targetEntity) {
final Element elElement;
if (targetEntity == null) {
elElement = collElement.addElement("element").addAttribute("type", hbType(paAttribute));
@@ -123,7 +122,7 @@ class ManyAttributeMapper extends AbstractAssociationMapper {
elElement = collElement.addElement("element").addAttribute("type", targetEntity);
}
if (columns != null && columns.size() > 0) {
- addColumns(elElement, defaultName, columns, getHbmContext().isCurrentElementFeatureMap(), false);
+ addColumns(elElement, defaultName, columns, getHbmContext().isCurrentElementFeatureMap(), true);
}
return elElement;
}

Back to the top