Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] How to specify a Foreign Key name with a one to many relationship
[Teneo] How to specify a Foreign Key name with a one to many relationship [message #991470] Wed, 19 December 2012 11:22 Go to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

Thank you for the help with my other Foreign Key issue I was seeing - unfortunately, I have hit another problem where I can't work out how to set the Foreign key. I would again be very grateful for your view on this.

If I have an eCore:

  <eClassifiers xsi:type="ecore:EClass" name="Case1">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Case1"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eAnnotations source="bds">
      <details key="isCase" value="true"/>
    </eAnnotations>
    <eAnnotations source="teneo.jpa">
      <details key="value" value="@Table(name=&quot;TESTGEN_CASE1&quot;)&#xA;@DiscriminatorValue(&quot;com.example.testgen.Case1&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="case2a" lowerBound="1"
        eType="#//Case2" eOpposite="#//Case2/case1a">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case2a"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;CASE2A&quot;)&#xA;@ForeignKey(name=&quot;CASE1_CASE2A&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Id&#xA;@Column(name=&quot;BDS_ID&quot;, nullable=&quot;false&quot;)&#xA;@GeneratedValue(generator=&quot;bdsIdGenerator&quot;)"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isId" value="true"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;BDS_VERSION&quot;)&#xA;@Version"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isVersion" value="true"/>
      </eAnnotations>
    </eStructuralFeatures>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="Case2">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Case2"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eAnnotations source="bds">
      <details key="isCase" value="true"/>
    </eAnnotations>
    <eAnnotations source="teneo.jpa">
      <details key="value" value="@Table(name=&quot;TESTGEN_CASE2&quot;)&#xA;@DiscriminatorValue(&quot;com.example.testgen.Case2&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="case1a" upperBound="-1"
        eType="#//Case1" eOpposite="#//Case1/case2a">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case1a"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@JoinTable(name=&quot;TESTGEN_CASE2_CASE1A&quot;)&#xA;@Column(name=&quot;CASE1A&quot;)&#xA;@ForeignKey(name=&quot;CASE2_CASE1A&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="case2Attr" eType="#//case2Attr_Case2Type">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case2Attr"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;CASE2ATTR&quot;, length=&quot;400&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Id&#xA;@Column(name=&quot;BDS_ID&quot;, nullable=&quot;false&quot;)&#xA;@GeneratedValue(generator=&quot;bdsIdGenerator&quot;)"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isId" value="true"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;BDS_VERSION&quot;)&#xA;@Version"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isVersion" value="true"/>
      </eAnnotations>
    </eStructuralFeatures>
  </eClassifiers>


And generate the hibernate mapping, it looks as follows:

<hibernate-mapping auto-import="false">
	<class entity-name="testgen.Case1" abstract="false" lazy="false" discriminator-value="com.example.testgen.Case1" table="`BDS_1_TESTGEN_CASE1`">
		<meta attribute="eclassName">Case1</meta>
		<meta attribute="epackage">http://example.com/testgen</meta>
		<id name="bdsId" type="java.lang.Long">
			<column not-null="true" unique="false" name="`BDS_ID`"/>
			<generator class="com.tibco.bds.core.naming.CaseDataStoreIdGenerator"/>
		</id>
		<discriminator column="`DTYPE`" type="string"/>
		<version name="bdsVersion" type="java.lang.Long">
			<column not-null="false" unique="false" name="`BDS_VERSION`"/>
		</version>
		<many-to-one name="case2a" entity-name="testgen.Case2" lazy="false" foreign-key="FK_CASE1_CASE2A" insert="true" update="true" not-null="false">
			<column not-null="false" unique="false" name="`CASE1_CASE2A_BDSID`"/>
		</many-to-one>
	</class>
	<class entity-name="testgen.Case2" abstract="false" lazy="false" discriminator-value="com.example.testgen.Case2" table="`BDS_1_TESTGEN_CASE2`">
		<meta attribute="eclassName">Case2</meta>
		<meta attribute="epackage">http://example.com/testgen</meta>
		<id name="bdsId" type="java.lang.Long">
			<column not-null="true" unique="false" name="`BDS_ID`"/>
			<generator class="com.tibco.bds.core.naming.CaseDataStoreIdGenerator"/>
		</id>
		<discriminator column="`DTYPE`" type="string"/>
		<version name="bdsVersion" type="java.lang.Long">
			<column not-null="false" unique="false" name="`BDS_VERSION`"/>
		</version>
		<list name="case1a" table="`BDS_1_TESTGEN_CASE2CASE1A`" lazy="true">
			<key update="true">
				<column name="`CASE2_BDSID`" not-null="true" unique="false"/>
			</key>
			<list-index column="`CASE2_CASE1A_IDX`"/>
			<many-to-many entity-name="testgen.Case1" unique="true" foreign-key="FK_CASE2_CASE1A">
				<column name="`CASE1_BDSID`" not-null="true" unique="false"/>
			</many-to-many>
		</list>
		<property name="case2Attr" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`CASE2ATTR`" length="400"/>
		</property>
	</class>
</hibernate-mapping>


Which in turn will generage the following SQL:

create table [BDS_1_TESTGEN_CASE1] ([BDS_ID] numeric(19,0) not null, [DTYPE] nvarchar(255) not null, [BDS_VERSION] numeric(19,0) null, [CASE1_CASE2A_BDSID] numeric(19,0) null, primary key ([BDS_ID]))
create table [BDS_1_TESTGEN_CASE2CASE1A] ([CASE2_BDSID] numeric(19,0) not null, [CASE1_BDSID] numeric(19,0) not null, [CASE2_CASE1A_IDX] int not null, primary key ([CASE2_BDSID], [CASE2_CASE1A_IDX]))
create table [BDS_1_TESTGEN_CASE2] ([BDS_ID] numeric(19,0) not null, [DTYPE] nvarchar(255) not null, [BDS_VERSION] numeric(19,0) null, [CASE2ATTR] nvarchar(400) null, primary key ([BDS_ID]))
alter table [BDS_1_TESTGEN_CASE1] add constraint FK_CASE1_CASE2A foreign key ([CASE1_CASE2A_BDSID]) references [BDS_1_TESTGEN_CASE2]
alter table [BDS_1_TESTGEN_CASE2CASE1A] add constraint FK_CASE2_CASE1A foreign key ([CASE1_BDSID]) references [BDS_1_TESTGEN_CASE1]
alter table [BDS_1_TESTGEN_CASE2CASE1A] add constraint FK2DF4D7056C5A4021 foreign key ([CASE2_BDSID]) references [BDS_1_TESTGEN_CASE2]


As you can see I have managed to set the Foreign Keys for two values - but not the FK2DF4D7056C5A4021 value.

If I edit the hibernate mapping to have:

		<list name="case1a" table="`BDS_1_TESTGEN_CASE2CASE1A`" lazy="true">
			<key update="true"  foreign-key="FK_MAN_EDIT">
				<column name="`CASE2_BDSID`" not-null="true" unique="false"/>
			</key>
			<list-index column="`CASE2_CASE1A_IDX`"/>
			<many-to-many entity-name="testgen.Case1" unique="true" foreign-key="FK_CASE2_CASE1A">
				<column name="`CASE1_BDSID`" not-null="true" unique="false"/>
			</many-to-many>
		</list>


Then I will get the Foreign Key set. However I can't work out what I would need to annotate in the eCore in order to get it passed to hibernate.

Any guidance you are able to offer would be brilliant.

Thanks

Rob



Re: [Teneo] How to specify a Foreign Key name with a one to many relationship [message #991474 is a reply to message #991470] Wed, 19 December 2012 11:56 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
I have done a little bit more testing and other options to work around this. I tried implementing my own version of "TeneoSQLNameStrategy" and overriding the method "getForeignKeyName" - unfortunately this method does not get called for this Foreign Key name (It does appear to be called for the other names if there is no @ForeignKey annotation - but not called on any of the Join table foreign key names!)

So if there was a way of us using this approach - it would also get us around this problem.

Thanks

Rob

[Updated on: Wed, 19 December 2012 12:05]

Report message to a moderator

Re: [Teneo] How to specify a Foreign Key name with a one to many relationship [message #991886 is a reply to message #991474] Thu, 20 December 2012 12:13 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Rob,
I made the required change in the 2.0.0 stream (and published a new build), see the top few changes here:
http://git.eclipse.org/c/teneo/org.eclipse.emf.teneo.git/commit/?id=a36b30f14322d74069823336d1a6e01dbfe68ae0

gr. Martin


On 12/19/2012 12:56 PM, Rob Mising name wrote:
> I have done a little bit more testing and other options to work around this. I tried implementing my own version of
> "TeneoSQLNameStrategy" and overriding the method "getForeignKeyName" - unfortunately this method does not get called for
> this Foreign Key name (It does appear to be called for the other names if there is no @ForeignKey annotation)
>
> So if there was a way of us using this approach - it would also get us around this problem.
>
> Thanks
>
> Rob
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] How to specify a Foreign Key name with a one to many relationship [message #992315 is a reply to message #991886] Fri, 21 December 2012 10:33 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

Thank you again for sorting that out for me. I have now tried to create a patch against our version of Teneo and it does solve the problem that I was seeing. However these is one more issue that I have found that seems very very similar, I believe it may be related to ManyToMany mappings.

If I have an eCore as follows:

  <eClassifiers xsi:type="ecore:EClass" name="Case1">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Case1"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eAnnotations source="bds">
      <details key="isCase" value="true"/>
    </eAnnotations>
    <eAnnotations source="teneo.jpa">
      <details key="value" value="@Table(name=&quot;TESTGEN_CASE1&quot;)&#xA;@DiscriminatorValue(&quot;com.example.testgen.Case1&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="attribute1" eType="//attribute1_Case1Type">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="attribute1"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;ATTRIBUTE1&quot;, length=&quot;400&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EReference" name="case2b" upperBound="-1" eType="//Case2" eOpposite="//Case2/case1a">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case2b"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@JoinTable(name=&quot;TESTGEN_CASE1_CASE2B&quot;)&#xA;@Column(name=&quot;CASE2B&quot;)&#xA;@ForeignKey(name=&quot;CASE1_CASE2B&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Id&#xA;@Column(name=&quot;BDS_ID&quot;, nullable=&quot;false&quot;)&#xA;@GeneratedValue(generator=&quot;bdsIdGenerator&quot;)"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isId" value="true"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;BDS_VERSION&quot;)&#xA;@Version"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isVersion" value="true"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="Case2">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Case2"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eAnnotations source="bds">
      <details key="isCase" value="true"/>
    </eAnnotations>
    <eAnnotations source="teneo.jpa">
      <details key="value" value="@Table(name=&quot;TESTGEN_CASE2&quot;)&#xA;@DiscriminatorValue(&quot;com.example.testgen.Case2&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="case1a" upperBound="-1" eType="//Case1" eOpposite="//Case1/case2b">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case1a"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@JoinTable(name=&quot;TESTGEN_CASE2_CASE1A&quot;)&#xA;@Column(name=&quot;CASE1A&quot;)&#xA;@ForeignKey(name=&quot;CASE2_CASE1A&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="attribute1" eType="//attribute1_Case2Type">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="attribute1"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;ATTRIBUTE1&quot;, length=&quot;400&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Id&#xA;@Column(name=&quot;BDS_ID&quot;, nullable=&quot;false&quot;)&#xA;@GeneratedValue(generator=&quot;bdsIdGenerator&quot;)"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isId" value="true"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;BDS_VERSION&quot;)&#xA;@Version"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isVersion" value="true"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
  </eClassifiers>


It generates the following hibernate mapping:

<hibernate-mapping auto-import="false">
	<class entity-name="testgen.Case1" abstract="false" lazy="false" discriminator-value="com.example.testgen.Case1" table="`BDS_2_TESTGEN_CASE1`">
		<meta attribute="eclassName">Case1</meta>
		<meta attribute="epackage">http://example.com/testgen</meta>
		<id name="bdsId" type="java.lang.Long">
			<column not-null="true" unique="false" name="`BDS_ID`"/>
			<generator class="com.tibco.bds.core.naming.CaseDataStoreIdGenerator"/>
		</id>
		<discriminator column="`DTYPE`" type="string"/>
		<version name="bdsVersion" type="java.lang.Long">
			<column not-null="false" unique="false" name="`BDS_VERSION`"/>
		</version>
		<property name="attribute1" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`ATTRIBUTE1`" length="400"/>
		</property>
		<list name="case2b" lazy="true" table="`BDS_2_TESTGEN_CASE1CASE2B`">
			<key update="true">
				<column name="`CASE1_BDSID`" not-null="true" unique="false"/>
			</key>
			<list-index column="`CASE1_CASE2B_IDX`"/>
			<many-to-many entity-name="testgen.Case2" unique="false" foreign-key="FK_2_TESTGEN_CASE2B">
				<column name="`CASE2_BDSID`" not-null="true" unique="false"/>
			</many-to-many>
		</list>
	</class>
	<class entity-name="testgen.Case2" abstract="false" lazy="false" discriminator-value="com.example.testgen.Case2" table="`BDS_2_TESTGEN_CASE2`">
		<meta attribute="eclassName">Case2</meta>
		<meta attribute="epackage">http://example.com/testgen</meta>
		<id name="bdsId" type="java.lang.Long">
			<column not-null="true" unique="false" name="`BDS_ID`"/>
			<generator class="com.tibco.bds.core.naming.CaseDataStoreIdGenerator"/>
		</id>
		<discriminator column="`DTYPE`" type="string"/>
		<version name="bdsVersion" type="java.lang.Long">
			<column not-null="false" unique="false" name="`BDS_VERSION`"/>
		</version>
		<list name="case1a" lazy="true" table="`BDS_2_TESTGEN_CASE2CASE1A`">
			<key update="true">
				<column name="`CASE2_BDSID`" not-null="true" unique="false"/>
			</key>
			<list-index column="`CASE2_CASE1A_IDX`"/>
			<many-to-many entity-name="testgen.Case1" unique="false" foreign-key="FK_2_TESTGEN_CASE1A">
				<column name="`CASE1_BDSID`" not-null="true" unique="false"/>
			</many-to-many>
		</list>
		<property name="attribute1" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`ATTRIBUTE1`" length="400"/>
		</property>
	</class>
</hibernate-mapping>


Which then generates the following SQL:

create table [BDS_2_TESTGEN_CASE1CASE2B] ([CASE1_BDSID] numeric(19,0) not null, [CASE2_BDSID] numeric(19,0) not null, [CASE1_CASE2B_IDX] int not null, primary key ([CASE1_BDSID], [CASE1_CASE2B_IDX]))
create table [BDS_2_TESTGEN_CASE1] ([BDS_ID] numeric(19,0) not null, [DTYPE] nvarchar(255) not null, [BDS_VERSION] numeric(19,0) null, [ATTRIBUTE1] nvarchar(400) null, primary key ([BDS_ID]))
create table [BDS_2_TESTGEN_CASE2CASE1A] ([CASE2_BDSID] numeric(19,0) not null, [CASE1_BDSID] numeric(19,0) not null, [CASE2_CASE1A_IDX] int not null, primary key ([CASE2_BDSID], [CASE2_CASE1A_IDX]))
create table [BDS_2_TESTGEN_CASE2] ([BDS_ID] numeric(19,0) not null, [DTYPE] nvarchar(255) not null, [BDS_VERSION] numeric(19,0) null, [ATTRIBUTE1] nvarchar(400) null, primary key ([BDS_ID]))
alter table [BDS_2_TESTGEN_CASE1CASE2B] add constraint FK5A79165377404DF foreign key ([CASE1_BDSID]) references [BDS_2_TESTGEN_CASE1]
alter table [BDS_2_TESTGEN_CASE1CASE2B] add constraint FK_2_TESTGEN_CASE2B foreign key ([CASE2_BDSID]) references [BDS_2_TESTGEN_CASE2]
alter table [BDS_2_TESTGEN_CASE2CASE1A] add constraint FK_2_TESTGEN_CASE1A foreign key ([CASE1_BDSID]) references [BDS_2_TESTGEN_CASE1]
alter table [BDS_2_TESTGEN_CASE2CASE1A] add constraint FK3A8DCC866C5A4021 foreign key ([CASE2_BDSID]) references [BDS_2_TESTGEN_CASE2]


So, I'm wondering if I have made a mess of the patch, or if there is soming else I need to do for Many-to-many support.

Thank you again for all your assistance - and have a great Christmas!

Rob

Re: [Teneo] How to specify a Foreign Key name with a one to many relationship [message #992328 is a reply to message #992315] Fri, 21 December 2012 11:11 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

I hope you don't mind - but I have had a look at the source to see if there was anything obvious I could tweak for this Many-To-Many issue. I think there may be a small change that might resolve the problem - so thought that I'd mention it.

If on the file:

ManyToManyMapper.java

On line 62 (just after):

handleOndelete(keyElement, hbReference.getHbOnDelete());


You add the line:

addForeignKeyAttribute(keyElement, paReference);


Then on my system it seems to resolve the issue for the unset Foreign key.

Does this sound along the correct sort of lines?

Thanks

Rob
Re: [Teneo] How to specify a Foreign Key name with a one to many relationship [message #992438 is a reply to message #992328] Fri, 21 December 2012 16:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
yeah you are right, I made the same change and published a new build.

gr. Martin

On 12/21/2012 12:11 PM, Rob Mising name wrote:
> Hi Martin,
>
> I hope you don't mind - but I have had a look at the source to see if there was anything obvious I could tweak for this
> Many-To-Many issue. I think there may be a small change that might resolve the problem - so thought that I'd mention it.
>
> If on the file:
>
> ManyToManyMapper.java
>
> On line 62 (just after):
>
> handleOndelete(keyElement, hbReference.getHbOnDelete());
>
> You add the line:
>
> addForeignKeyAttribute(keyElement, paReference);
>
> Then on my system it seems to resolve the issue for the unset Foreign key.
>
> Does this sound along the correct sort of lines?
>
> Thanks
>
> Rob
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] How to specify a Foreign Key name with a one to many relationship [message #992662 is a reply to message #992438] Sat, 22 December 2012 08:05 Go to previous message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

Thanks for the confirmation and all your assistance.

Regards,

Rob
Previous Topic:[CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry
Next Topic:EMF and Java Templates
Goto Forum:
  


Current Time: Thu Apr 25 22:09:02 GMT 2024

Powered by FUDForum. Page generated in 0.03798 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top