Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Illegal attribute names when using Mysql database backend
[CDO] Illegal attribute names when using Mysql database backend [message #1764671] Thu, 01 June 2017 10:27 Go to next message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
Please consider the following example :
class A
- x [integer]
- generated [string]

This works all fine with an H2 database backend. When using Mysql though, it is not possible to commit an instance of type A.

The reason is the attribute named "generated". This is a reserved key word in Mysql and cannot be used as a column name.

Can you think of any way how to use attributes named "generated"?
Thanks for any help.

[Updated on: Thu, 01 June 2017 10:31]

Report message to a moderator

Re: [CDO] Illegal attribute names when using Mysql database backend [message #1764744 is a reply to message #1764671] Fri, 02 June 2017 05:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
According to https://dev.mysql.com/doc/refman/5.7/en/keywords.html#ftn.idm140070402557504 the word "generated" became a reserved word. You can work around this restriction with a DBStore model annotation, e.g.:

    <eStructuralFeatures xsi:type="ecore:EAttribute" name="generated" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
      <eAnnotations source="http://www.eclipse.org/CDO/DBStore">
        <details key="columnName" value="generated_x"/>
      </eAnnotations>
    </eStructuralFeatures>


Re: [CDO] Illegal attribute names when using Mysql database backend [message #1765283 is a reply to message #1764744] Thu, 08 June 2017 07:14 Go to previous messageGo to next message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
Thanks, this works for us!
Re: [CDO] Illegal attribute names when using Mysql database backend [message #1765367 is a reply to message #1765283] Thu, 08 June 2017 19:29 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Perfect, I'm glad to hear this ;-)

Previous Topic:force adding platform:/resource during saving resource
Next Topic:[CDO] XML repository import for Mysql
Goto Forum:
  


Current Time: Wed Apr 24 17:15:36 GMT 2024

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

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

Back to the top