diff options
author | Martin Taal | 2013-01-15 10:21:07 +0000 |
---|---|---|
committer | Martin Taal | 2013-01-15 10:21:07 +0000 |
commit | 62b246765840c6b1cee4b168c63a38367c80a3e3 (patch) | |
tree | 34fd138b585306a5f4cd8ee393958e46de7f6a6a | |
parent | aeaee9b70b5d20c959376a20082ec0c909e42b82 (diff) | |
download | org.eclipse.emf.teneo-62b246765840c6b1cee4b168c63a38367c80a3e3.tar.gz org.eclipse.emf.teneo-62b246765840c6b1cee4b168c63a38367c80a3e3.tar.xz org.eclipse.emf.teneo-62b246765840c6b1cee4b168c63a38367c80a3e3.zip |
Fixes issue 398161
33 files changed, 2330 insertions, 28 deletions
diff --git a/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java b/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java index 381a8daf5..f83d4b58f 100755 --- a/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java +++ b/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/AbstractAssociationMapper.java @@ -271,6 +271,10 @@ public abstract class AbstractAssociationMapper extends AbstractMapper { } } + if (joinColumn.getColumnDefinition() != null) { + columnElement.addAttribute("sql-type", joinColumn.getColumnDefinition()); + } + } // ugly but effective if (associationElement.getName().compareTo("map-key-many-to-many") != 0 @@ -279,6 +283,7 @@ public abstract class AbstractAssociationMapper extends AbstractMapper { associationElement.addAttribute("insert", Boolean.toString(insertable)); associationElement.addAttribute("update", Boolean.toString(updatable)); } + } /** diff --git a/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java b/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java index 50795e291..9cf95e141 100755 --- a/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java +++ b/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java @@ -665,8 +665,7 @@ public class EntityMapper extends AbstractMapper implements ExtensionPoint { final Element columnElement = jcElement.addElement("column"); if (pkJC.getColumnDefinition() != null) { - log.error("Unsupported column definition in primary key join column " + pkJC); - throw new MappingException("Unsupported column definition in primary key join column", pkJC); + columnElement.addAttribute("sql-type", pkJC.getColumnDefinition()); } if (pkJC.getName() != null) { diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/META-INF/MANIFEST.MF b/tests/org.eclipse.emf.teneo.hibernate.test/META-INF/MANIFEST.MF index f51a4e678..8cc5dd9d2 100755 --- a/tests/org.eclipse.emf.teneo.hibernate.test/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.emf.teneo.hibernate.test/META-INF/MANIFEST.MF @@ -38,8 +38,10 @@ Import-Package: com.mysql.jdbc;version="[5.1.0,6.0.0)";resolution:=optional, org.hibernate.dialect;version="[4.0.0,5.0.0)";resolution:=optional, org.hibernate.ejb;version="[4.0.0,5.0.0)";resolution:=optional, org.hibernate.engine.spi;version="[4.0.0,5.0.0)", + org.hibernate.exception;version="[4.0.0,5.0.0)", org.hibernate.mapping;version="[4.0.0,5.0.0)";resolution:=optional, org.hibernate.proxy;version="[4.0.0,5.0.0)";resolution:=optional, + org.hibernate.tool.hbm2ddl;version="[4.0.0,5.0.0)", org.hibernate.type;version="[4.0.0,5.0.0)";resolution:=optional, org.hibernate.usertype;version="[4.0.0,5.0.0)";resolution:=optional, org.slf4j;version="[1.6.0,2.0.0)" diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_e_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_e_o_hibernate.hbm.xml index cb5b0cb2b..118fe9292 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_e_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_e_o_hibernate.hbm.xml @@ -17,7 +17,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <bag name="friends" lazy="true" cascade="merge,persist,save-update,lock,refresh" table="`PERSON_PERSON`"> - <key update="true"> + <key foreign-key="PERSON_FRIENDS_KEY" update="true"> <column name="`PERSON_FRIENDS_FIRSTNAME`" unique="false"/> <column name="`PERSON_FRIENDS_LASTNAME`" unique="false"/> </key> @@ -27,7 +27,7 @@ </many-to-many> </bag> <bag name="oppositeFriends" lazy="true" cascade="merge,persist,save-update,lock,refresh" inverse="true" table="`PERSON_PERSON`"> - <key update="true"> + <key foreign-key="PERSON_OPPOSITEFRIENDS_KEY" update="true"> <column name="`PERSON_OPPOSITEFRIENDS_FIRSTNAME`" unique="false"/> <column name="`PERSON_OPPOSITEFRIENDS_LASTNAME`" unique="false"/> </key> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_h_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_h_o_hibernate.hbm.xml index 326245f76..802a6e90f 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_h_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.emf.annotations/JoinColumnsTest$1_hsqldb_h_o_hibernate.hbm.xml @@ -20,7 +20,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <bag name="friends" lazy="true" cascade="merge,persist,save-update,lock,refresh" table="`PERSON_PERSON`"> - <key update="true"> + <key foreign-key="PERSON_FRIENDS_KEY" update="true"> <column name="`PERSON_FRIENDS_FIRSTNAME`" unique="false"/> <column name="`PERSON_FRIENDS_LASTNAME`" unique="false"/> </key> @@ -30,7 +30,7 @@ </many-to-many> </bag> <bag name="oppositeFriends" lazy="true" cascade="merge,persist,save-update,lock,refresh" inverse="true" table="`PERSON_PERSON`"> - <key update="true"> + <key foreign-key="PERSON_OPPOSITEFRIENDS_KEY" update="true"> <column name="`PERSON_OPPOSITEFRIENDS_FIRSTNAME`" unique="false"/> <column name="`PERSON_OPPOSITEFRIENDS_LASTNAME`" unique="false"/> </key> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.issues/Bz398161Action_hsqldb_e_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.issues/Bz398161Action_hsqldb_e_o_hibernate.hbm.xml new file mode 100644 index 000000000..63fe8c725 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.issues/Bz398161Action_hsqldb_e_o_hibernate.hbm.xml @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping auto-import="false"> + <class name="org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl" entity-name="RefOne" abstract="false" lazy="false" table="`REFONE`"> + <meta attribute="eclassName" inherit="false">RefOne</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161</meta> + <id name="id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`ID`"/> + <generator class="native"/> + </id> + <version name="e_version" column="e_version" access="org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler"> + <meta attribute="syntheticVersion" inherit="false">true</meta> + </version> + <many-to-one name="refTwo" entity-name="RefTwo" lazy="false" cascade="all" foreign-key="REFONE_REFTWO" insert="true" update="true" not-null="false"> + <column not-null="false" unique="false" name="`PRODR_NUM`" sql-type="CHARACTER(6) NOT NULL"/> + </many-to-one> + </class> + <class name="org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl" entity-name="RefTwo" abstract="false" lazy="false" table="`REFTWO`"> + <meta attribute="eclassName" inherit="false">RefTwo</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161</meta> + <id name="number" type="java.lang.String"> + <column not-null="true" unique="false" name="`PRODR_NUM`" length="6" sql-type="CHARACTER(6)"/> + </id> + <version name="e_version" column="e_version" access="org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler"> + <meta attribute="syntheticVersion" inherit="false">true</meta> + </version> + </class> + <class name="org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.impl.TeneoAuditCommitInfoImpl" entity-name="TeneoAuditCommitInfo" abstract="false" lazy="false" table="`TENEOAUDITCOMMITINFO`"> + <meta attribute="eclassName" inherit="false">TeneoAuditCommitInfo</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/hibernate/auditing</meta> + <id name="id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`ID`"/> + <generator class="native"/> + </id> + <version name="version" type="long"> + <column not-null="true" unique="false" name="`VERSION`"/> + </version> + <property name="user" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`USER`"/> + </property> + <property name="comment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`COMMENT`" length="2000"/> + </property> + <property name="commitTime" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`COMMITTIME`"/> + </property> + </class> + <class name="org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.impl.TeneoAuditEntryImpl" entity-name="RefOneAuditing" abstract="false" lazy="false" table="`REFONEAUDITING`"> + <meta attribute="eclassName" inherit="false">RefOneAuditing</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161Auditing</meta> + <id name="teneo_audit_id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_ID`"/> + <generator class="native"/> + </id> + <version name="teneo_version" type="long"> + <column not-null="true" unique="false" name="`TENEO_VERSION`"/> + </version> + <property name="teneo_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_ID`" unique-key="c0,c1,c2"/> + </property> + <property name="teneo_owner_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OWNER_OBJECT_ID`" index="teneo_derived_object"/> + </property> + <property name="teneo_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_START`" unique-key="c0"/> + </property> + <property name="teneo_end" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_END`" unique-key="c1"/> + </property> + <many-to-one name="teneo_commit_info" entity-name="TeneoAuditCommitInfo" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="REFONEAUDITING_TENEO_COMMIT_INFO" insert="true" update="true" not-null="true"> + <column not-null="true" unique="false" name="`TENEOAUDITCOMMITINFO_TENEO_COMMIT_INFO_ID`"/> + </many-to-one> + <property name="teneo_audit_kind" lazy="false" not-null="true" insert="true" update="true" unique="false"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_KIND`"/> + <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType"> + <param name="enumClass">org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.TeneoAuditKind</param> + <param name="eclassifier">TeneoAuditKind</param> + <param name="epackage">http://www.eclipse.org/emf/teneo/hibernate/auditing</param> + </type> + </property> + <property name="teneo_container_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_ID`"/> + </property> + <property name="teneo_container_feature_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_FEATURE_ID`"/> + </property> + <property name="teneo_previous_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_PREVIOUS_START`" unique-key="c2"/> + </property> + <property name="teneo_object_version" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_VERSION`"/> + </property> + <property name="teneo_resourceid" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_RESOURCEID`"/> + </property> + <property name="id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`ID`"/> + </property> + <property name="refTwo" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`REFTWO`"/> + </property> + </class> + <class name="org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.impl.TeneoAuditEntryImpl" entity-name="RefTwoAuditing" abstract="false" lazy="false" table="`REFTWOAUDITING`"> + <meta attribute="eclassName" inherit="false">RefTwoAuditing</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161Auditing</meta> + <id name="teneo_audit_id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_ID`"/> + <generator class="native"/> + </id> + <version name="teneo_version" type="long"> + <column not-null="true" unique="false" name="`TENEO_VERSION`"/> + </version> + <property name="teneo_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_ID`" unique-key="c0,c1,c2"/> + </property> + <property name="teneo_owner_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OWNER_OBJECT_ID`" index="teneo_derived_object"/> + </property> + <property name="teneo_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_START`" unique-key="c0"/> + </property> + <property name="teneo_end" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_END`" unique-key="c1"/> + </property> + <many-to-one name="teneo_commit_info" entity-name="TeneoAuditCommitInfo" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="REFTWOAUDITING_TENEO_COMMIT_INFO" insert="true" update="true" not-null="true"> + <column not-null="true" unique="false" name="`TENEOAUDITCOMMITINFO_TENEO_COMMIT_INFO_ID`"/> + </many-to-one> + <property name="teneo_audit_kind" lazy="false" not-null="true" insert="true" update="true" unique="false"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_KIND`"/> + <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType"> + <param name="enumClass">org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.TeneoAuditKind</param> + <param name="eclassifier">TeneoAuditKind</param> + <param name="epackage">http://www.eclipse.org/emf/teneo/hibernate/auditing</param> + </type> + </property> + <property name="teneo_container_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_ID`"/> + </property> + <property name="teneo_container_feature_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_FEATURE_ID`"/> + </property> + <property name="teneo_previous_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_PREVIOUS_START`" unique-key="c2"/> + </property> + <property name="teneo_object_version" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_VERSION`"/> + </property> + <property name="teneo_resourceid" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_RESOURCEID`"/> + </property> + <property name="number" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`NUMBER`"/> + </property> + </class> +</hibernate-mapping>
\ No newline at end of file diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.issues/Bz398161Action_hsqldb_h_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.issues/Bz398161Action_hsqldb_h_o_hibernate.hbm.xml new file mode 100644 index 000000000..66c494151 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.hibernate.test.issues/Bz398161Action_hsqldb_h_o_hibernate.hbm.xml @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping auto-import="false"> + <class name="org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl" entity-name="RefOne" abstract="false" lazy="false" discriminator-value="RefOne" table="`REFONE`"> + <meta attribute="eclassName" inherit="false">RefOne</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161</meta> + <id name="id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`ID`"/> + <generator class="native"/> + </id> + <discriminator type="string"> + <column name="`DTYPE`" index="REFONEDTYPE" length="255" not-null="true"/> + </discriminator> + <version name="e_version" column="e_version" access="org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler"> + <meta attribute="syntheticVersion" inherit="false">true</meta> + </version> + <many-to-one name="refTwo" entity-name="RefTwo" lazy="false" cascade="all" foreign-key="REFONE_REFTWO" insert="true" update="true" not-null="false"> + <column not-null="false" unique="false" name="`PRODR_NUM`" sql-type="CHARACTER(6) NOT NULL"/> + </many-to-one> + </class> + <class name="org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl" entity-name="RefTwo" abstract="false" lazy="false" discriminator-value="RefTwo" table="`REFTWO`"> + <meta attribute="eclassName" inherit="false">RefTwo</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161</meta> + <id name="number" type="java.lang.String"> + <column not-null="true" unique="false" name="`PRODR_NUM`" length="6" sql-type="CHARACTER(6)"/> + </id> + <discriminator type="string"> + <column name="`DTYPE`" index="REFTWODTYPE" length="255" not-null="true"/> + </discriminator> + <version name="e_version" column="e_version" access="org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler"> + <meta attribute="syntheticVersion" inherit="false">true</meta> + </version> + </class> + <class name="org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.impl.TeneoAuditCommitInfoImpl" entity-name="TeneoAuditCommitInfo" abstract="false" lazy="false" discriminator-value="TeneoAuditCommitInfo" table="`TENEOAUDITCOMMITINFO`"> + <meta attribute="eclassName" inherit="false">TeneoAuditCommitInfo</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/hibernate/auditing</meta> + <id name="id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`ID`"/> + <generator class="native"/> + </id> + <discriminator type="string"> + <column name="`DTYPE`" index="TENEOAUDITCOMMITINFODTYPE" length="255" not-null="true"/> + </discriminator> + <version name="version" type="long"> + <column not-null="true" unique="false" name="`VERSION`"/> + </version> + <property name="user" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`USER`"/> + </property> + <property name="comment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`COMMENT`" length="2000"/> + </property> + <property name="commitTime" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`COMMITTIME`"/> + </property> + </class> + <class name="org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.impl.TeneoAuditEntryImpl" entity-name="RefOneAuditing" abstract="false" lazy="false" discriminator-value="RefOneAuditing" table="`REFONEAUDITING`"> + <meta attribute="eclassName" inherit="false">RefOneAuditing</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161Auditing</meta> + <id name="teneo_audit_id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_ID`"/> + <generator class="native"/> + </id> + <discriminator type="string"> + <column name="`DTYPE`" index="REFONEAUDITINGDTYPE" length="255" not-null="true"/> + </discriminator> + <version name="teneo_version" type="long"> + <column not-null="true" unique="false" name="`TENEO_VERSION`"/> + </version> + <property name="teneo_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_ID`" unique-key="c0,c1,c2"/> + </property> + <property name="teneo_owner_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OWNER_OBJECT_ID`" index="teneo_derived_object"/> + </property> + <property name="teneo_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_START`" unique-key="c0"/> + </property> + <property name="teneo_end" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_END`" unique-key="c1"/> + </property> + <many-to-one name="teneo_commit_info" entity-name="TeneoAuditCommitInfo" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="REFONEAUDITING_TENEO_COMMIT_INFO" insert="true" update="true" not-null="true"> + <column not-null="true" unique="false" name="`TENEOAUDITCOMMITINFO_TENEO_COMMIT_INFO_ID`"/> + </many-to-one> + <property name="teneo_audit_kind" lazy="false" not-null="true" insert="true" update="true" unique="false"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_KIND`"/> + <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType"> + <param name="enumClass">org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.TeneoAuditKind</param> + <param name="eclassifier">TeneoAuditKind</param> + <param name="epackage">http://www.eclipse.org/emf/teneo/hibernate/auditing</param> + </type> + </property> + <property name="teneo_container_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_ID`"/> + </property> + <property name="teneo_container_feature_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_FEATURE_ID`"/> + </property> + <property name="teneo_previous_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_PREVIOUS_START`" unique-key="c2"/> + </property> + <property name="teneo_object_version" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_VERSION`"/> + </property> + <property name="teneo_resourceid" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_RESOURCEID`"/> + </property> + <property name="id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`ID`"/> + </property> + <property name="refTwo" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`REFTWO`"/> + </property> + </class> + <class name="org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.impl.TeneoAuditEntryImpl" entity-name="RefTwoAuditing" abstract="false" lazy="false" discriminator-value="RefTwoAuditing" table="`REFTWOAUDITING`"> + <meta attribute="eclassName" inherit="false">RefTwoAuditing</meta> + <meta attribute="epackage" inherit="false">http://www.eclipse.org/emf/teneo/samples/issues/bz398161Auditing</meta> + <id name="teneo_audit_id" type="long" unsaved-value="0"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_ID`"/> + <generator class="native"/> + </id> + <discriminator type="string"> + <column name="`DTYPE`" index="REFTWOAUDITINGDTYPE" length="255" not-null="true"/> + </discriminator> + <version name="teneo_version" type="long"> + <column not-null="true" unique="false" name="`TENEO_VERSION`"/> + </version> + <property name="teneo_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_ID`" unique-key="c0,c1,c2"/> + </property> + <property name="teneo_owner_object_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_OWNER_OBJECT_ID`" index="teneo_derived_object"/> + </property> + <property name="teneo_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_START`" unique-key="c0"/> + </property> + <property name="teneo_end" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_END`" unique-key="c1"/> + </property> + <many-to-one name="teneo_commit_info" entity-name="TeneoAuditCommitInfo" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="REFTWOAUDITING_TENEO_COMMIT_INFO" insert="true" update="true" not-null="true"> + <column not-null="true" unique="false" name="`TENEOAUDITCOMMITINFO_TENEO_COMMIT_INFO_ID`"/> + </many-to-one> + <property name="teneo_audit_kind" lazy="false" not-null="true" insert="true" update="true" unique="false"> + <column not-null="true" unique="false" name="`TENEO_AUDIT_KIND`"/> + <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType"> + <param name="enumClass">org.eclipse.emf.teneo.hibernate.auditing.model.teneoauditing.TeneoAuditKind</param> + <param name="eclassifier">TeneoAuditKind</param> + <param name="epackage">http://www.eclipse.org/emf/teneo/hibernate/auditing</param> + </type> + </property> + <property name="teneo_container_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_ID`"/> + </property> + <property name="teneo_container_feature_id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int"> + <column not-null="false" unique="false" name="`TENEO_CONTAINER_FEATURE_ID`"/> + </property> + <property name="teneo_previous_start" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_PREVIOUS_START`" unique-key="c2"/> + </property> + <property name="teneo_object_version" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long"> + <column not-null="false" unique="false" name="`TENEO_OBJECT_VERSION`"/> + </property> + <property name="teneo_resourceid" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`TENEO_RESOURCEID`"/> + </property> + <property name="number" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String"> + <column not-null="false" unique="false" name="`NUMBER`"/> + </property> + </class> +</hibernate-mapping>
\ No newline at end of file diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_e_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_e_o_hibernate.hbm.xml index 23ad9a36d..b2ca5d276 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_e_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_e_o_hibernate.hbm.xml @@ -19,7 +19,7 @@ <collection-id column="idbag_id" type="long"> <generator class="increment"/> </collection-id> - <key update="true"> + <key foreign-key="ROLE_USERS_KEY" update="true"> <column name="`ROLE_E_ID`" unique="false"/> </key> <many-to-many entity-name="User" unique="false" foreign-key="ROLE_USERS"> @@ -44,7 +44,7 @@ <collection-id column="idbag_id" type="long"> <generator class="increment"/> </collection-id> - <key update="true"> + <key foreign-key="USER_ROLES_KEY" update="true"> <column name="`USER_E_ID`" unique="false"/> </key> <many-to-many entity-name="Role" unique="false" foreign-key="USER_ROLES"> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_h_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_h_o_hibernate.hbm.xml index fcee72890..a1625ab88 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_h_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ForcedIdBagAction_hsqldb_h_o_hibernate.hbm.xml @@ -22,7 +22,7 @@ <collection-id column="idbag_id" type="long"> <generator class="increment"/> </collection-id> - <key update="true"> + <key foreign-key="ROLE_USERS_KEY" update="true"> <column name="`ROLE_E_ID`" unique="false"/> </key> <many-to-many entity-name="User" unique="false" foreign-key="ROLE_USERS"> @@ -50,7 +50,7 @@ <collection-id column="idbag_id" type="long"> <generator class="increment"/> </collection-id> - <key update="true"> + <key foreign-key="USER_ROLES_KEY" update="true"> <column name="`USER_E_ID`" unique="false"/> </key> <many-to-many entity-name="Role" unique="false" foreign-key="USER_ROLES"> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_e_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_e_o_hibernate.hbm.xml index 5d3bf8b0f..b1ef1cb2d 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_e_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_e_o_hibernate.hbm.xml @@ -13,7 +13,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <bag name="rght" lazy="false" cascade="merge,persist,save-update,lock" table="`RIGHTCENTER`"> - <key update="true"> + <key foreign-key="CNTR_RGHT_KEY" update="true"> <column name="`CNTR_E_ID`" unique="false"/> </key> <many-to-many entity-name="Rght" unique="false" foreign-key="CNTR_RGHT"> @@ -21,7 +21,7 @@ </many-to-many> </bag> <list name="lft" lazy="false" cascade="merge,persist,save-update,lock" table="`CNTR_LFT`"> - <key update="true"> + <key foreign-key="CNTR_LFT_KEY" update="true"> <column name="`CNTR_E_ID`" unique="false"/> </key> <list-index column="`CNTR_LFT_IDX`"/> @@ -41,7 +41,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <list name="cntr" lazy="true" cascade="merge,persist,save-update,lock" table="`LFT_CNTR`"> - <key update="true"> + <key foreign-key="LFT_CNTR_KEY" update="true"> <column name="`LFT_E_ID`" unique="false"/> </key> <list-index column="`LFT_CNTR_IDX`"/> @@ -61,7 +61,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <bag name="cntr" lazy="true" cascade="merge,persist,save-update,lock" inverse="true" table="`RIGHTCENTER`"> - <key update="true"> + <key foreign-key="RGHT_CNTR_KEY" update="true"> <column name="`RGHT_E_ID`" unique="false"/> </key> <many-to-many entity-name="Cntr" unique="false" foreign-key="RGHT_CNTR"> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_h_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_h_o_hibernate.hbm.xml index 60dbb6db4..2cee25e24 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_h_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/ManyToManyAction_hsqldb_h_o_hibernate.hbm.xml @@ -16,7 +16,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <bag name="rght" lazy="false" cascade="merge,persist,save-update,lock" table="`RIGHTCENTER`"> - <key update="true"> + <key foreign-key="CNTR_RGHT_KEY" update="true"> <column name="`CNTR_E_ID`" unique="false"/> </key> <many-to-many entity-name="Rght" unique="false" foreign-key="CNTR_RGHT"> @@ -24,7 +24,7 @@ </many-to-many> </bag> <list name="lft" lazy="false" cascade="merge,persist,save-update,lock" table="`CNTR_LFT`"> - <key update="true"> + <key foreign-key="CNTR_LFT_KEY" update="true"> <column name="`CNTR_E_ID`" unique="false"/> </key> <list-index column="`CNTR_LFT_IDX`"/> @@ -47,7 +47,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <list name="cntr" lazy="true" cascade="merge,persist,save-update,lock" table="`LFT_CNTR`"> - <key update="true"> + <key foreign-key="LFT_CNTR_KEY" update="true"> <column name="`LFT_E_ID`" unique="false"/> </key> <list-index column="`LFT_CNTR_IDX`"/> @@ -70,7 +70,7 @@ <meta attribute="syntheticVersion" inherit="false">true</meta> </version> <bag name="cntr" lazy="true" cascade="merge,persist,save-update,lock" inverse="true" table="`RIGHTCENTER`"> - <key update="true"> + <key foreign-key="RGHT_CNTR_KEY" update="true"> <column name="`RGHT_E_ID`" unique="false"/> </key> <many-to-many entity-name="Cntr" unique="false" foreign-key="RGHT_CNTR"> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_e_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_e_o_hibernate.hbm.xml index 4fc99a156..e8e5c7f83 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_e_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_e_o_hibernate.hbm.xml @@ -16,7 +16,7 @@ <column not-null="true" unique="false" name="`NAME`"/> </property> <bag name="yourItem" lazy="true" cascade="merge,persist,save-update,lock,refresh" inverse="true" table="`MYITEM_YOURITEM`"> - <key update="true"> + <key foreign-key="MYITEM_YOURITEM_KEY" update="true"> <column name="`MYITEM_E_ID`" unique="false"/> </key> <many-to-many entity-name="YourItem" unique="false" foreign-key="MYITEM_YOURITEM"> @@ -38,7 +38,7 @@ <column not-null="true" unique="false" name="`NAME`"/> </property> <bag name="myItem" lazy="true" cascade="merge,persist,save-update,lock,refresh" table="`MYITEM_YOURITEM`"> - <key update="true"> + <key foreign-key="YOURITEM_MYITEM_KEY" update="true"> <column name="`YOURITEM_E_ID`" unique="false"/> </key> <many-to-many entity-name="MyItem" unique="false" foreign-key="YOURITEM_MYITEM"> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_h_o_hibernate.hbm.xml b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_h_o_hibernate.hbm.xml index 68d9e5c5f..ebe933a2b 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_h_o_hibernate.hbm.xml +++ b/tests/org.eclipse.emf.teneo.hibernate.test/hbm/org.eclipse.emf.teneo.test.emf.annotations/SetNMAction_hsqldb_h_o_hibernate.hbm.xml @@ -19,7 +19,7 @@ <column not-null="true" unique="false" name="`NAME`"/> </property> <bag name="yourItem" lazy="true" cascade="merge,persist,save-update,lock,refresh" inverse="true" table="`MYITEM_YOURITEM`"> - <key update="true"> + <key foreign-key="MYITEM_YOURITEM_KEY" update="true"> <column name="`MYITEM_E_ID`" unique="false"/> </key> <many-to-many entity-name="YourItem" unique="false" foreign-key="MYITEM_YOURITEM"> @@ -44,7 +44,7 @@ <column not-null="true" unique="false" name="`NAME`"/> </property> <bag name="myItem" lazy="true" cascade="merge,persist,save-update,lock,refresh" table="`MYITEM_YOURITEM`"> - <key update="true"> + <key foreign-key="YOURITEM_MYITEM_KEY" update="true"> <column name="`YOURITEM_E_ID`" unique="false"/> </key> <many-to-many entity-name="MyItem" unique="false" foreign-key="YOURITEM_MYITEM"> diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/emf/annotations/AllTests.java b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/emf/annotations/AllTests.java index 130a0efe6..d2b1abbaf 100755 --- a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/emf/annotations/AllTests.java +++ b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/emf/annotations/AllTests.java @@ -61,11 +61,6 @@ public class AllTests { TestSuite suite = new MultiCfgTestSuite( "Test for org.eclipse.emf.teneo.hibernate.test.emf.annotations", HibernateTestbed .instance().getConfigurations()); - suite.addTestSuite(SecondarytableHibernateAction.class); - if (true) { - return suite; - } - suite.addTestSuite(IdAction.class); suite.addTestSuite(UserTypeAction.class); suite.addTestSuite(ExternalAction.class); diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java index 91b59b89c..04b07f0fa 100755 --- a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java +++ b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java @@ -54,7 +54,6 @@ public class AllTests { public static Test suite() { TestSuite suite = new MultiCfgTestSuite("Test for org.eclipse.emf.teneo.hibernate.test.issues", HibernateTestbed.instance().getConfigurations()); - // suite.addTestSuite(PersistUMLAction.class); suite.addTestSuite(Bz387421Action.class); suite.addTestSuite(NonMandatoryJoinColumnAction.class); @@ -125,6 +124,7 @@ public class AllTests { suite.addTestSuite(BZ237994Action.class); suite.addTestSuite(BZ237790Action.class); suite.addTestSuite(BZ237498Action.class); + suite.addTestSuite(Bz398161Action.class); // disabled some more tests as the build server seems to fail after so // many tests diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/Bz398161Action.java b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/Bz398161Action.java new file mode 100644 index 000000000..d2185abd6 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/Bz398161Action.java @@ -0,0 +1,68 @@ +/** + * <copyright> Copyright (c) 2005, 2006, 2007, 2008 Springsite BV (The Netherlands) and others All rights + * reserved. This program and the accompanying materials are made available under the terms of the + * Eclipse Public License v1.0 which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html Contributors: Martin Taal </copyright> $Id: + * AgilAction.java,v 1.1 2007/03/28 13:58:33 mtaal Exp $ + */ + +package org.eclipse.emf.teneo.hibernate.test.issues; + +import javax.persistence.PersistenceException; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.teneo.hibernate.test.stores.HibernateTestStore; +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Factory; +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefOne; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo; +import org.eclipse.emf.teneo.test.AbstractTestAction; +import org.eclipse.emf.teneo.test.stores.TestStore; +import org.hibernate.exception.ConstraintViolationException; +import org.hibernate.tool.hbm2ddl.SchemaValidator; + +/** + * @author <a href="mailto:mtaal@elver.org">Martin Taal</a> + * @version $Revision: 1.1 $ + */ +public class Bz398161Action extends AbstractTestAction { + + private Bz398161Factory factory = Bz398161Factory.eINSTANCE; + + public Bz398161Action() { + super(new EPackage[] { Bz398161Package.eINSTANCE }); + } + + @Override + public void doAction(TestStore store) { + { + store.beginTransaction(); + RefOne refOne = factory.createRefOne(); + RefTwo refTwo = factory.createRefTwo(); + refOne.setRefTwo(refTwo); + refTwo.setNumber("abc"); + store.store(refTwo); + store.store(refOne); + store.commitTransaction(); + } + { + // the not-null in the columndefinition is applied correctly + try { + store.beginTransaction(); + RefOne refOne = factory.createRefOne(); + store.store(refOne); + store.commitTransaction(); + fail(); + } catch (PersistenceException e) { + assertTrue(e.getCause() instanceof ConstraintViolationException); + } catch (ConstraintViolationException e) { + } + } + + // validate the schema + final HibernateTestStore hbStore = (HibernateTestStore) store; + SchemaValidator validator = new SchemaValidator(hbStore.getEmfDataStore() + .getHibernateConfiguration()); + validator.validate(); + } +} diff --git a/tests/org.eclipse.emf.teneo.samples/META-INF/MANIFEST.MF b/tests/org.eclipse.emf.teneo.samples/META-INF/MANIFEST.MF index 3bc4a96f8..bba7cd336 100755 --- a/tests/org.eclipse.emf.teneo.samples/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.emf.teneo.samples/META-INF/MANIFEST.MF @@ -1627,6 +1627,9 @@ Export-Package: com.example.car;uses:="org.eclipse.emf.common.util,org.eclipse.e org.eclipse.emf.teneo.samples.issues.bz391134, org.eclipse.emf.teneo.samples.issues.bz391134.impl, org.eclipse.emf.teneo.samples.issues.bz391134.util, + org.eclipse.emf.teneo.samples.issues.bz398161, + org.eclipse.emf.teneo.samples.issues.bz398161.impl, + org.eclipse.emf.teneo.samples.issues.bz398161.util, org.eclipse.emf.teneo.samples.issues.enumtest;uses:="org.eclipse.emf.common.util,org.eclipse.emf.ecore", org.eclipse.emf.teneo.samples.issues.enumtest.impl;uses:="org.eclipse.emf.teneo.samples.issues.enumtest,org.eclipse.emf.ecore.impl,org.eclipse.emf.ecore", org.eclipse.emf.teneo.samples.issues.enumtest.model, diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/Bz398161Factory.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/Bz398161Factory.java new file mode 100644 index 000000000..5f8758321 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/Bz398161Factory.java @@ -0,0 +1,51 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package + * @generated + */ +public interface Bz398161Factory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + Bz398161Factory eINSTANCE = org.eclipse.emf.teneo.samples.issues.bz398161.impl.Bz398161FactoryImpl.init(); + + /** + * Returns a new object of class '<em>Ref One</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Ref One</em>'. + * @generated + */ + RefOne createRefOne(); + + /** + * Returns a new object of class '<em>Ref Two</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Ref Two</em>'. + * @generated + */ + RefTwo createRefTwo(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + Bz398161Package getBz398161Package(); + +} //Bz398161Factory diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/Bz398161Package.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/Bz398161Package.java new file mode 100644 index 000000000..9626d7ba0 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/Bz398161Package.java @@ -0,0 +1,245 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Factory + * @model kind="package" + * @generated + */ +public interface Bz398161Package extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "bz398161"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/teneo/samples/issues/bz398161"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "bz398161"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + Bz398161Package eINSTANCE = org.eclipse.emf.teneo.samples.issues.bz398161.impl.Bz398161PackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl <em>Ref One</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.Bz398161PackageImpl#getRefOne() + * @generated + */ + int REF_ONE = 0; + + /** + * The feature id for the '<em><b>Id</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int REF_ONE__ID = 0; + + /** + * The feature id for the '<em><b>Ref Two</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int REF_ONE__REF_TWO = 1; + + /** + * The number of structural features of the '<em>Ref One</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int REF_ONE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl <em>Ref Two</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.Bz398161PackageImpl#getRefTwo() + * @generated + */ + int REF_TWO = 1; + + /** + * The feature id for the '<em><b>Number</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int REF_TWO__NUMBER = 0; + + /** + * The number of structural features of the '<em>Ref Two</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int REF_TWO_FEATURE_COUNT = 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne <em>Ref One</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Ref One</em>'. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefOne + * @generated + */ + EClass getRefOne(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getId <em>Id</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Id</em>'. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getId() + * @see #getRefOne() + * @generated + */ + EAttribute getRefOne_Id(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getRefTwo <em>Ref Two</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Ref Two</em>'. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getRefTwo() + * @see #getRefOne() + * @generated + */ + EReference getRefOne_RefTwo(); + + /** + * Returns the meta object for class '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo <em>Ref Two</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Ref Two</em>'. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo + * @generated + */ + EClass getRefTwo(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo#getNumber <em>Number</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Number</em>'. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo#getNumber() + * @see #getRefTwo() + * @generated + */ + EAttribute getRefTwo_Number(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + Bz398161Factory getBz398161Factory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl <em>Ref One</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.Bz398161PackageImpl#getRefOne() + * @generated + */ + EClass REF_ONE = eINSTANCE.getRefOne(); + + /** + * The meta object literal for the '<em><b>Id</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute REF_ONE__ID = eINSTANCE.getRefOne_Id(); + + /** + * The meta object literal for the '<em><b>Ref Two</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference REF_ONE__REF_TWO = eINSTANCE.getRefOne_RefTwo(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl <em>Ref Two</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl + * @see org.eclipse.emf.teneo.samples.issues.bz398161.impl.Bz398161PackageImpl#getRefTwo() + * @generated + */ + EClass REF_TWO = eINSTANCE.getRefTwo(); + + /** + * The meta object literal for the '<em><b>Number</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute REF_TWO__NUMBER = eINSTANCE.getRefTwo_Number(); + + } + +} //Bz398161Package diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/RefOne.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/RefOne.java new file mode 100644 index 000000000..9466d8013 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/RefOne.java @@ -0,0 +1,135 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Ref One</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getId <em>Id</em>}</li> + * <li>{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getRefTwo <em>Ref Two</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package#getRefOne() + * @model extendedMetaData="name='RefOne' kind='elementOnly'" + * @generated + */ +public interface RefOne extends EObject { + /** + * Returns the value of the '<em><b>Id</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Id</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Id</em>' attribute. + * @see #isSetId() + * @see #unsetId() + * @see #setId(long) + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package#getRefOne_Id() + * @model unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Long" required="true" + * annotation="teneo.jpa appinfo='\n\t\t\t\t\t\t@Id\n\t\t\t\t\t\t@GeneratedValue\n\t\t\t\t\t'" + * extendedMetaData="kind='element' name='id'" + * @generated + */ + long getId(); + + /** + * Sets the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getId <em>Id</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Id</em>' attribute. + * @see #isSetId() + * @see #unsetId() + * @see #getId() + * @generated + */ + void setId(long value); + + /** + * Unsets the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getId <em>Id</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetId() + * @see #getId() + * @see #setId(long) + * @generated + */ + void unsetId(); + + /** + * Returns whether the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getId <em>Id</em>}' attribute is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Id</em>' attribute is set. + * @see #unsetId() + * @see #getId() + * @see #setId(long) + * @generated + */ + boolean isSetId(); + + /** + * Returns the value of the '<em><b>Ref Two</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Ref Two</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Ref Two</em>' containment reference. + * @see #isSetRefTwo() + * @see #unsetRefTwo() + * @see #setRefTwo(RefTwo) + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package#getRefOne_RefTwo() + * @model containment="true" unsettable="true" required="true" + * annotation="teneo.jpa appinfo='\n\t\t\t\t\t\t@JoinColumn(name=\"prodr_num\",columnDefinition = \"CHARACTER(6) NOT NULL\")\n\t\t\t\t\t'" + * extendedMetaData="kind='element' name='refTwo'" + * @generated + */ + RefTwo getRefTwo(); + + /** + * Sets the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getRefTwo <em>Ref Two</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Ref Two</em>' containment reference. + * @see #isSetRefTwo() + * @see #unsetRefTwo() + * @see #getRefTwo() + * @generated + */ + void setRefTwo(RefTwo value); + + /** + * Unsets the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getRefTwo <em>Ref Two</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetRefTwo() + * @see #getRefTwo() + * @see #setRefTwo(RefTwo) + * @generated + */ + void unsetRefTwo(); + + /** + * Returns whether the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne#getRefTwo <em>Ref Two</em>}' containment reference is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>Ref Two</em>' containment reference is set. + * @see #unsetRefTwo() + * @see #getRefTwo() + * @see #setRefTwo(RefTwo) + * @generated + */ + boolean isSetRefTwo(); + +} // RefOne diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/RefTwo.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/RefTwo.java new file mode 100644 index 000000000..52f8a1b12 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/RefTwo.java @@ -0,0 +1,52 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Ref Two</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo#getNumber <em>Number</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package#getRefTwo() + * @model extendedMetaData="name='RefTwo' kind='elementOnly'" + * @generated + */ +public interface RefTwo extends EObject { + /** + * Returns the value of the '<em><b>Number</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Number</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Number</em>' attribute. + * @see #setNumber(String) + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package#getRefTwo_Number() + * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true" + * annotation="teneo.jpa appinfo='\n\t\t\t\t\t\t@Id\n\t\t\t\t\t\t@Column(name=\"prodr_num\",\n\t\t\t\t\t\tcolumnDefinition = \"CHARACTER(6)\", length=6)\n\t\t\t\t\t'" + * extendedMetaData="kind='element' name='number'" + * @generated + */ + String getNumber(); + + /** + * Sets the value of the '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo#getNumber <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Number</em>' attribute. + * @see #getNumber() + * @generated + */ + void setNumber(String value); + +} // RefTwo diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/Bz398161FactoryImpl.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/Bz398161FactoryImpl.java new file mode 100644 index 000000000..bc681ee5d --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/Bz398161FactoryImpl.java @@ -0,0 +1,106 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.emf.teneo.samples.issues.bz398161.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class Bz398161FactoryImpl extends EFactoryImpl implements Bz398161Factory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Bz398161Factory init() { + try { + Bz398161Factory theBz398161Factory = (Bz398161Factory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/teneo/samples/issues/bz398161"); + if (theBz398161Factory != null) { + return theBz398161Factory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new Bz398161FactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161FactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case Bz398161Package.REF_ONE: return createRefOne(); + case Bz398161Package.REF_TWO: return createRefTwo(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RefOne createRefOne() { + RefOneImpl refOne = new RefOneImpl(); + return refOne; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RefTwo createRefTwo() { + RefTwoImpl refTwo = new RefTwoImpl(); + return refTwo; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161Package getBz398161Package() { + return (Bz398161Package)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static Bz398161Package getPackage() { + return Bz398161Package.eINSTANCE; + } + +} //Bz398161FactoryImpl diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/Bz398161PackageImpl.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/Bz398161PackageImpl.java new file mode 100644 index 000000000..c4fcf8dd2 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/Bz398161PackageImpl.java @@ -0,0 +1,308 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Factory; +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefOne; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class Bz398161PackageImpl extends EPackageImpl implements Bz398161Package { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass refOneEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass refTwoEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package#eNS_URI + * @see #init() + * @generated + */ + private Bz398161PackageImpl() { + super(eNS_URI, Bz398161Factory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link Bz398161Package#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static Bz398161Package init() { + if (isInited) return (Bz398161Package)EPackage.Registry.INSTANCE.getEPackage(Bz398161Package.eNS_URI); + + // Obtain or create and register package + Bz398161PackageImpl theBz398161Package = (Bz398161PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Bz398161PackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new Bz398161PackageImpl()); + + isInited = true; + + // Initialize simple dependencies + XMLTypePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theBz398161Package.createPackageContents(); + + // Initialize created meta-data + theBz398161Package.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theBz398161Package.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(Bz398161Package.eNS_URI, theBz398161Package); + return theBz398161Package; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getRefOne() { + return refOneEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getRefOne_Id() { + return (EAttribute)refOneEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getRefOne_RefTwo() { + return (EReference)refOneEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getRefTwo() { + return refTwoEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getRefTwo_Number() { + return (EAttribute)refTwoEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161Factory getBz398161Factory() { + return (Bz398161Factory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + refOneEClass = createEClass(REF_ONE); + createEAttribute(refOneEClass, REF_ONE__ID); + createEReference(refOneEClass, REF_ONE__REF_TWO); + + refTwoEClass = createEClass(REF_TWO); + createEAttribute(refTwoEClass, REF_TWO__NUMBER); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(refOneEClass, RefOne.class, "RefOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getRefOne_Id(), theXMLTypePackage.getLong(), "id", null, 1, 1, RefOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getRefOne_RefTwo(), this.getRefTwo(), null, "refTwo", null, 1, 1, RefOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(refTwoEClass, RefTwo.class, "RefTwo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getRefTwo_Number(), theXMLTypePackage.getString(), "number", null, 1, 1, RefTwo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + // teneo.jpa + createTeneoAnnotations(); + } + + /** + * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createExtendedMetaDataAnnotations() { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (refOneEClass, + source, + new String[] { + "name", "RefOne", + "kind", "elementOnly" + }); + addAnnotation + (getRefOne_Id(), + source, + new String[] { + "kind", "element", + "name", "id" + }); + addAnnotation + (getRefOne_RefTwo(), + source, + new String[] { + "kind", "element", + "name", "refTwo" + }); + addAnnotation + (refTwoEClass, + source, + new String[] { + "name", "RefTwo", + "kind", "elementOnly" + }); + addAnnotation + (getRefTwo_Number(), + source, + new String[] { + "kind", "element", + "name", "number" + }); + } + + /** + * Initializes the annotations for <b>teneo.jpa</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createTeneoAnnotations() { + String source = "teneo.jpa"; + addAnnotation + (getRefOne_Id(), + source, + new String[] { + "appinfo", "\n\t\t\t\t\t\t@Id\n\t\t\t\t\t\t@GeneratedValue\n\t\t\t\t\t" + }); + addAnnotation + (getRefOne_RefTwo(), + source, + new String[] { + "appinfo", "\n\t\t\t\t\t\t@JoinColumn(name=\"prodr_num\",columnDefinition = \"CHARACTER(6) NOT NULL\")\n\t\t\t\t\t" + }); + addAnnotation + (getRefTwo_Number(), + source, + new String[] { + "appinfo", "\n\t\t\t\t\t\t@Id\n\t\t\t\t\t\t@Column(name=\"prodr_num\",\n\t\t\t\t\t\tcolumnDefinition = \"CHARACTER(6)\", length=6)\n\t\t\t\t\t" + }); + } + +} //Bz398161PackageImpl diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/RefOneImpl.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/RefOneImpl.java new file mode 100644 index 000000000..6f315f44b --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/RefOneImpl.java @@ -0,0 +1,339 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefOne; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Ref One</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl#getId <em>Id</em>}</li> + * <li>{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefOneImpl#getRefTwo <em>Ref Two</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class RefOneImpl extends EObjectImpl implements RefOne { + /** + * The default value of the '{@link #getId() <em>Id</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getId() + * @generated + * @ordered + */ + protected static final long ID_EDEFAULT = 0L; + + /** + * The cached value of the '{@link #getId() <em>Id</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getId() + * @generated + * @ordered + */ + protected long id = ID_EDEFAULT; + + /** + * This is true if the Id attribute has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean idESet; + + /** + * The cached value of the '{@link #getRefTwo() <em>Ref Two</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getRefTwo() + * @generated + * @ordered + */ + protected RefTwo refTwo; + + /** + * This is true if the Ref Two containment reference has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean refTwoESet; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected RefOneImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return Bz398161Package.Literals.REF_ONE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public long getId() { + return id; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setId(long newId) { + long oldId = id; + id = newId; + boolean oldIdESet = idESet; + idESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Bz398161Package.REF_ONE__ID, oldId, id, !oldIdESet)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetId() { + long oldId = id; + boolean oldIdESet = idESet; + id = ID_EDEFAULT; + idESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, Bz398161Package.REF_ONE__ID, oldId, ID_EDEFAULT, oldIdESet)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetId() { + return idESet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RefTwo getRefTwo() { + return refTwo; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetRefTwo(RefTwo newRefTwo, NotificationChain msgs) { + RefTwo oldRefTwo = refTwo; + refTwo = newRefTwo; + boolean oldRefTwoESet = refTwoESet; + refTwoESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Bz398161Package.REF_ONE__REF_TWO, oldRefTwo, newRefTwo, !oldRefTwoESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setRefTwo(RefTwo newRefTwo) { + if (newRefTwo != refTwo) { + NotificationChain msgs = null; + if (refTwo != null) + msgs = ((InternalEObject)refTwo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Bz398161Package.REF_ONE__REF_TWO, null, msgs); + if (newRefTwo != null) + msgs = ((InternalEObject)newRefTwo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Bz398161Package.REF_ONE__REF_TWO, null, msgs); + msgs = basicSetRefTwo(newRefTwo, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRefTwoESet = refTwoESet; + refTwoESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Bz398161Package.REF_ONE__REF_TWO, newRefTwo, newRefTwo, !oldRefTwoESet)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicUnsetRefTwo(NotificationChain msgs) { + RefTwo oldRefTwo = refTwo; + refTwo = null; + boolean oldRefTwoESet = refTwoESet; + refTwoESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, Bz398161Package.REF_ONE__REF_TWO, oldRefTwo, null, oldRefTwoESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetRefTwo() { + if (refTwo != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)refTwo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Bz398161Package.REF_ONE__REF_TWO, null, msgs); + msgs = basicUnsetRefTwo(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRefTwoESet = refTwoESet; + refTwoESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, Bz398161Package.REF_ONE__REF_TWO, null, null, oldRefTwoESet)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetRefTwo() { + return refTwoESet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Bz398161Package.REF_ONE__REF_TWO: + return basicUnsetRefTwo(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Bz398161Package.REF_ONE__ID: + return getId(); + case Bz398161Package.REF_ONE__REF_TWO: + return getRefTwo(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Bz398161Package.REF_ONE__ID: + setId((Long)newValue); + return; + case Bz398161Package.REF_ONE__REF_TWO: + setRefTwo((RefTwo)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Bz398161Package.REF_ONE__ID: + unsetId(); + return; + case Bz398161Package.REF_ONE__REF_TWO: + unsetRefTwo(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Bz398161Package.REF_ONE__ID: + return isSetId(); + case Bz398161Package.REF_ONE__REF_TWO: + return isSetRefTwo(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (id: "); + if (idESet) result.append(id); else result.append("<unset>"); + result.append(')'); + return result.toString(); + } + +} //RefOneImpl diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/RefTwoImpl.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/RefTwoImpl.java new file mode 100644 index 000000000..50c1d8597 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/impl/RefTwoImpl.java @@ -0,0 +1,163 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package; +import org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Ref Two</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.teneo.samples.issues.bz398161.impl.RefTwoImpl#getNumber <em>Number</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class RefTwoImpl extends EObjectImpl implements RefTwo { + /** + * The default value of the '{@link #getNumber() <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getNumber() + * @generated + * @ordered + */ + protected static final String NUMBER_EDEFAULT = null; + + /** + * The cached value of the '{@link #getNumber() <em>Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getNumber() + * @generated + * @ordered + */ + protected String number = NUMBER_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected RefTwoImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return Bz398161Package.Literals.REF_TWO; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getNumber() { + return number; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setNumber(String newNumber) { + String oldNumber = number; + number = newNumber; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Bz398161Package.REF_TWO__NUMBER, oldNumber, number)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Bz398161Package.REF_TWO__NUMBER: + return getNumber(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Bz398161Package.REF_TWO__NUMBER: + setNumber((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Bz398161Package.REF_TWO__NUMBER: + setNumber(NUMBER_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Bz398161Package.REF_TWO__NUMBER: + return NUMBER_EDEFAULT == null ? number != null : !NUMBER_EDEFAULT.equals(number); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (number: "); + result.append(number); + result.append(')'); + return result.toString(); + } + +} //RefTwoImpl diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.ecore b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.ecore new file mode 100644 index 000000000..064ef2724 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.ecore @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz398161" nsURI="http://www.eclipse.org/emf/teneo/samples/issues/bz398161" + nsPrefix="bz398161"> + <eClassifiers xsi:type="ecore:EClass" name="RefOne"> + <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> + <details key="name" value="RefOne"/> + <details key="kind" value="elementOnly"/> + </eAnnotations> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long" + unsettable="true"> + <eAnnotations source="teneo.jpa"> + <details key="appinfo" value="
						@Id
						@GeneratedValue
					"/> + </eAnnotations> + <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> + <details key="kind" value="element"/> + <details key="name" value="id"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="refTwo" lowerBound="1" + eType="#//RefTwo" unsettable="true" containment="true" resolveProxies="false"> + <eAnnotations source="teneo.jpa"> + <details key="appinfo" value="
						@JoinColumn(name="prodr_num",columnDefinition = "CHARACTER(6) NOT NULL")
					"/> + </eAnnotations> + <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> + <details key="kind" value="element"/> + <details key="name" value="refTwo"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RefTwo"> + <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> + <details key="name" value="RefTwo"/> + <details key="kind" value="elementOnly"/> + </eAnnotations> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="number" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"> + <eAnnotations source="teneo.jpa"> + <details key="appinfo" value="
						@Id
						@Column(name="prodr_num",
						columnDefinition = "CHARACTER(6)", length=6)
					"/> + </eAnnotations> + <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> + <details key="kind" value="element"/> + <details key="name" value="number"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> +</ecore:EPackage> diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.genmodel b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.genmodel new file mode 100644 index 000000000..32435dda3 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.genmodel @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.emf.teneo.samples/src" modelPluginID="org.eclipse.emf.teneo.samples" + modelName="Bz398161" importerID="org.eclipse.xsd.ecore.importer" complianceLevel="5.0" + copyrightFields="false"> + <foreignModel>bz398161.xsd</foreignModel> + <genPackages prefix="Bz398161" basePackage="org.eclipse.emf.teneo.samples.issues" + resource="XML" disposableProviderFactory="true" ecorePackage="bz398161.ecore#/"> + <genClasses ecoreClass="bz398161.ecore#//RefOne"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute bz398161.ecore#//RefOne/id"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference bz398161.ecore#//RefOne/refTwo"/> + </genClasses> + <genClasses ecoreClass="bz398161.ecore#//RefTwo"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute bz398161.ecore#//RefTwo/number"/> + </genClasses> + </genPackages> +</genmodel:GenModel> diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.xsd b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.xsd new file mode 100755 index 000000000..3cd4a1fee --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/model/bz398161.xsd @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:lib="http://www.eclipse.org/emf/teneo/samples/issues/bz398161" + xmlns:this="http://www.eclipse.org/emf/teneo/samples/issues/bz398161" + targetNamespace="http://www.eclipse.org/emf/teneo/samples/issues/bz398161"> + + <xsd:complexType name="RefOne"> + <xsd:sequence> + <xsd:element name="id" type="xsd:long"> + <xsd:annotation> + <xsd:appinfo source="teneo.jpa"> + @Id + @GeneratedValue + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element form="unqualified" name="refTwo" nillable="true" + type="this:RefTwo" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <xsd:annotation> + <xsd:appinfo source="teneo.jpa"> + @JoinColumn(name="prodr_num",columnDefinition = "CHARACTER(6) NOT NULL") + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="RefTwo"> + <xsd:sequence> + <xsd:element name="number" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="teneo.jpa"> + @Id + @Column(name="prodr_num", + columnDefinition = "CHARACTER(6)", length=6) + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> +</schema>
\ No newline at end of file diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161AdapterFactory.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161AdapterFactory.java new file mode 100644 index 000000000..eb8b73e0c --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161AdapterFactory.java @@ -0,0 +1,138 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.teneo.samples.issues.bz398161.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package + * @generated + */ +public class Bz398161AdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static Bz398161Package modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161AdapterFactory() { + if (modelPackage == null) { + modelPackage = Bz398161Package.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected Bz398161Switch<Adapter> modelSwitch = + new Bz398161Switch<Adapter>() { + @Override + public Adapter caseRefOne(RefOne object) { + return createRefOneAdapter(); + } + @Override + public Adapter caseRefTwo(RefTwo object) { + return createRefTwoAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefOne <em>Ref One</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefOne + * @generated + */ + public Adapter createRefOneAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo <em>Ref Two</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.teneo.samples.issues.bz398161.RefTwo + * @generated + */ + public Adapter createRefTwoAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //Bz398161AdapterFactory diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161ResourceFactoryImpl.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161ResourceFactoryImpl.java new file mode 100644 index 000000000..bf9cce373 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161ResourceFactoryImpl.java @@ -0,0 +1,52 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.util; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.resource.Resource; + +import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; + +import org.eclipse.emf.ecore.xmi.XMLResource; + +/** + * <!-- begin-user-doc --> + * The <b>Resource Factory</b> associated with the package. + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.util.Bz398161ResourceImpl + * @generated + */ +public class Bz398161ResourceFactoryImpl extends ResourceFactoryImpl { + /** + * Creates an instance of the resource factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161ResourceFactoryImpl() { + super(); + } + + /** + * Creates an instance of the resource. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Resource createResource(URI uri) { + XMLResource result = new Bz398161ResourceImpl(uri); + result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); + result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); + + result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); + result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); + return result; + } + +} //Bz398161ResourceFactoryImpl diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161ResourceImpl.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161ResourceImpl.java new file mode 100644 index 000000000..70a191773 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161ResourceImpl.java @@ -0,0 +1,28 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.util; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; + +/** + * <!-- begin-user-doc --> + * The <b>Resource </b> associated with the package. + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.util.Bz398161ResourceFactoryImpl + * @generated + */ +public class Bz398161ResourceImpl extends XMLResourceImpl { + /** + * Creates an instance of the resource. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param uri the URI of the new resource. + * @generated + */ + public Bz398161ResourceImpl(URI uri) { + super(uri); + } + +} //Bz398161ResourceImpl diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161Switch.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161Switch.java new file mode 100644 index 000000000..e36abba9a --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161Switch.java @@ -0,0 +1,131 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.eclipse.emf.teneo.samples.issues.bz398161.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package + * @generated + */ +public class Bz398161Switch<T> extends Switch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static Bz398161Package modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161Switch() { + if (modelPackage == null) { + modelPackage = Bz398161Package.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case Bz398161Package.REF_ONE: { + RefOne refOne = (RefOne)theEObject; + T result = caseRefOne(refOne); + if (result == null) result = defaultCase(theEObject); + return result; + } + case Bz398161Package.REF_TWO: { + RefTwo refTwo = (RefTwo)theEObject; + T result = caseRefTwo(refTwo); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Ref One</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Ref One</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseRefOne(RefOne object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Ref Two</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Ref Two</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseRefTwo(RefTwo object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //Bz398161Switch diff --git a/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161XMLProcessor.java b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161XMLProcessor.java new file mode 100644 index 000000000..fc5fd907c --- /dev/null +++ b/tests/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/issues/bz398161/util/Bz398161XMLProcessor.java @@ -0,0 +1,50 @@ +/** + */ +package org.eclipse.emf.teneo.samples.issues.bz398161.util; + +import java.util.Map; + +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.resource.Resource; + +import org.eclipse.emf.ecore.xmi.util.XMLProcessor; + +import org.eclipse.emf.teneo.samples.issues.bz398161.Bz398161Package; + +/** + * This class contains helper methods to serialize and deserialize XML documents + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class Bz398161XMLProcessor extends XMLProcessor { + + /** + * Public constructor to instantiate the helper. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Bz398161XMLProcessor() { + super((EPackage.Registry.INSTANCE)); + Bz398161Package.eINSTANCE.eClass(); + } + + /** + * Register for "*" and "xml" file extensions the Bz398161ResourceFactoryImpl factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected Map<String, Resource.Factory> getRegistrations() { + if (registrations == null) { + super.getRegistrations(); + registrations.put(XML_EXTENSION, new Bz398161ResourceFactoryImpl()); + registrations.put(STAR_EXTENSION, new Bz398161ResourceFactoryImpl()); + } + return registrations; + } + +} //Bz398161XMLProcessor |