Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Texo] How to add the @DiscriminatorColumn(length = xxx) on a generated Entity with Texo
[Texo] How to add the @DiscriminatorColumn(length = xxx) on a generated Entity with Texo [message #1205345] Sat, 23 November 2013 15:14 Go to next message
Bertrand Quenin is currently offline Bertrand QueninFriend
Messages: 70
Registered: July 2009
Member
Hi guys,

I'm using Texo for a POC in my company and I think it's a very interesting technology. I've starting with a really simple example model, following the recommendations I could read in the documentation.

So I just used the provided "Identifable" class provided and created a random class extending it.

It works fine until I use long Java packages name (i.e. decorated with my company name in the eCore model). Let me explain, using long package names causes the generated entity name to be long as well and since we're using the default Inheritance strategy (@Inheritance: SINGLE), EclipseLink uses a discriminant column (DTYPE) while generating tables automatically.

The problem is that this column is defined by default as a VARCHAR(31) and long package names won't fit.

I found a way to extend the default size of this VARCHAR using @DiscriminatorColumn configuration
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Entities/Inheritance#.40DiscriminatorColumn

However, I can't get this annotation to be generated by Texo. The only annotation available is "@Inheriance" and it doesn't give more options.

How am I supposed to circumvent this issue ? Maybe resizing the column is not the best idea but I couldn't find anything else since I don't really want to change inheritance strategy.

Thanks,
BQ.

[Updated on: Sat, 23 November 2013 15:24]

Report message to a moderator

Re: [Texo] How to add the @DiscriminatorColumn(length = xxx) on a generated Entity with Texo [message #1205475 is a reply to message #1205345] Sat, 23 November 2013 16:42 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Bertrand,
It is a bit of a search but the DiscriminatorColumn is hidden as a child of the Entity in the annotations model. I
attached an example annotations model and ecore model.

One side remark, imho I think it is often best to make the Identifiable type a MappedSuperclass, this to prevent all
records/objects to be stored in one large table. But it all depends ofcourse, Mappedsuperclass makes it not possible to
do querying or references on that level.

gr. Martin

On 11/23/2013 04:14 PM, Bertrand Quenin wrote:
> Hi guys,
>
> I'm using Texo for a POC in my company and I think it's a very interesting technology. I've starting with a really
> simple example model, following the recommendations I could read the documentation.
>
> So I just used the provided "Identifable" class provided and created a random object extending it.
>
> It works fine until I use long Java packages name (i.e. decorated with my company name). Let me explain, using long
> package names causes the generated entity name to be long as well and since we're using the default Inheritance strategy
> (@Inheritance: SINGLE), EclipseLink uses a discriminant column (DTYPE) while generating tables automatically.
>
> The problem is that this column is using defaults: VARCHAR(31), and long package names don't fit.
>
> I found a way to extend the defaults using @DiscriminatorColumn configuration
> http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Entities/Inheritance#.40DiscriminatorColumn
>
> However, I can't get this annotation to be generated by Texo. The only annotation available is "@Inheriance" and it
> doesn't give more options.
>
> How am I supposed to circumvent this issue ? Maybe resizing the column is not the best idea but I couldn't find anything
> else since I don't really want to change inheritance strategy.
>
> Thanks,
> BQ.


--

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: [Texo] How to add the @DiscriminatorColumn(length = xxx) on a generated Entity with Texo [message #1209141 is a reply to message #1205475] Mon, 25 November 2013 11:03 Go to previous message
Bertrand Quenin is currently offline Bertrand QueninFriend
Messages: 70
Registered: July 2009
Member
Hi Martin,

Thanks for your prompt answer. I found the @DiscriminatorColumn in the Entity children and it worked like a charm.
Regarding MappedSuperClass, I think it makes sense as well.

Regards,
BQ.
Previous Topic:[Texo] How to prevent the generator from generating entity name annotation
Next Topic:Generating sub-models from main model
Goto Forum:
  


Current Time: Wed Apr 24 16:32:31 GMT 2024

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

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

Back to the top