Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo/Hibernate] Can I specify a different name for database table name?
[Texo/Hibernate] Can I specify a different name for database table name? [message #698630] Tue, 19 July 2011 17:00 Go to next message
Mike Cooper is currently offline Mike Cooper
Messages: 45
Registered: February 2011
Member
I'm using Texo/Hibernate 3.6.5 and some of my ECLass and EAttribute names are reserved mysql database names. I really don't want to have to rename all of my code references.

Is there some way of setting an explicit override for the database table name? How about for a database column (EAttribute)? Perhaps via annotation?
Re: [Texo/Hibernate] Can I specify a different name for database table name? [message #698638 is a reply to message #698630] Tue, 19 July 2011 17:20 Go to previous messageGo to next message
Mike Cooper is currently offline Mike Cooper
Messages: 45
Registered: February 2011
Member
Forgot to add... I believe in straight Hibernate I can use an annotation like

@Table(name="cats")

in the Java source to override the database table name. I'm looking for how to do the equivalent with Texo.

mike
(no subject) [message #698646 is a reply to message #698630] Tue, 19 July 2011 17:06 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5326
Registered: July 2009
Senior Member
You can add an orm annotation on the eclass which has a table name property.

I hope to look at your issue about escaping names later this week...

gr. Martin

On 07/19/2011 11:00 PM, Mike Cooper wrote:
> I'm using Texo/Hibernate 3.6.5 and some of my ECLass and EAttribute names are reserved mysql database names. I really
> don't want to have to rename all of my code references.
>
> Is there some way of setting an explicit override for the database table name? How about for a database column
> (EAttribute)? Perhaps via annotation?
>


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
(no subject) [message #698652 is a reply to message #698638] Tue, 19 July 2011 17:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5326
Registered: July 2009
Senior Member
In the annotations model add an eclass entry for the eclass, and then an ORM annotation node and within that a table
annotation with the name set.

Another way is to add an annotation to the generated code. Afaik Hibernate will also pick up that annotation (I am not
100% sure though):
http://wiki.eclipse.org/Texo/Direct_Java_Annotations

gr. Martin

On 07/19/2011 11:20 PM, Mike Cooper wrote:
> Forgot to add... I believe in straight Hibernate I can use an annotation like
>
> @Table(name="cats")
>
> in the Java source to override the database table name. I'm looking for how to do the equivalent with Texo.
>
> mike
>


--

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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: (no subject) [message #698658 is a reply to message #698652] Tue, 19 July 2011 18:33 Go to previous message
Mike Cooper is currently offline Mike Cooper
Messages: 45
Registered: February 2011
Member
Hi Martin,

Thank you! Thanks to your help I finally figured out I needed to create "Entity" node under ORM Annotation and then I could set Table.

mike
Previous Topic:[EEF] No EEF component & view element created Single Valued Containment References
Next Topic:[Texo/Hibernate] createQuery() returns 0 results but raw SQL works
Goto Forum:
  


Current Time: Wed Jul 30 09:13:07 EDT 2014

Powered by FUDForum. Page generated in 0.04616 seconds