Book a Demo

Author Topic: How to specify an arbitrary type for a column  (Read 6079 times)

Wojciech Dec

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
How to specify an arbitrary type for a column
« on: September 08, 2009, 08:05:39 pm »
Hi

I am using Data model and <<table>> and <<column>> stereotypes to define some entity.  I am not specifing data base since I want to present general view of a model (platform independent).

EA does not allow me to enter any type for columns (it does when I provide data base for a table)!

How can I enter an arbitrary type for a column?


Regards
Wojciech

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: How to specify an arbitrary type for a column
« Reply #1 on: September 08, 2009, 09:20:48 pm »
You are mixing two concepts here- the platform independent model (PIM) and the platform specific model (PSM).
So you should take a look at the MDA topic in the online help.

Basically you create your model by using platform independent elements and datatypes which are then transformed into real (database) entities by using transformations.
The whole topic is described in the online help.

You can not choose arbitrary types for database table elements unless you create a specific new database with your own types. However I do not recommend this as the MDA concept is propably all that you want and the database dialog is not built for this- you won't get far enough I assume.

HTH
Oliver

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to specify an arbitrary type for a column
« Reply #2 on: September 08, 2009, 09:30:10 pm »
The 'internal' stereotypes that EA provides can be very brittle, in the sense that you often have to use them just as Sparx intended.

The data modeling stereotypes are very sensitive to the DBMS selected for the entity you are modeling. They are not forgiving if you do not assign a DBMS. Instead they seem to limit themselves to a list of 'plain vanilla' data types. This may have been by intent--the idea being to model very generic database entities without going into any detail--or it may be the default behavior in the absence of a database (which would provide a list).

There are two things I have found in past attempts that might help. Note that there could be many other ways you can go about this; these are just the ones I've stumbled over by chance.

First, these two stereotypes seem to be more 'forgiving' about some things if you use them on Data Modeling diagrams (under the Extended list). You can check or change the type of an existing diagram if need be. Ensure that the diagram in question is open and current, then from the EA main menu choose Diagram | Change Type. Note that this is not available from the diagram context menu.

Second, you can create your own DBMS data type list. Even if you are not modeling data this can be a reasonable solution. One caveat: this approach quickly becomes unworkable if you have a large number of possible datatypes, or if the datatypes have many custom attributes. EA will present you with property sheets for tables and columns, so your custom datatypes have to cooperate with those dialogs. To do this open the Database Datatypes dialog from the EA main menu via Settings | Database Datatypes and click the Add Product button. Check the EA help (and play around with the dialog a bit) to get the hang of this.

You can export and import your custom database definitions as reference data.

HTH, David
No, you can't have it!

Wojciech Dec

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How to specify an arbitrary type for a column
« Reply #3 on: September 08, 2009, 09:54:03 pm »
How to customize MDA transformations to use different notation conventions during transformation?

For example I would like to have "Customer Order" PIM class and transform it to "CustomerOrder" for Java and "CUSTOMER_ORDER" for Oracle.  Can it be achived in a simple way?

Regards
Wojciech

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: How to specify an arbitrary type for a column
« Reply #4 on: September 08, 2009, 10:21:37 pm »
Quote
How to customize MDA transformations to use different notation conventions during transformation?

For example I would like to have "Customer Order" PIM class and transform it to "CustomerOrder" for Java and "CUSTOMER_ORDER" for Oracle.  Can it be achived in a simple way?

This is done by using the different templates for Java and databases (DDL).
EA deploys templates for several platforms (database, java, c#, etc.) which you might have to adapt a bit to fit your needs. In your case the DDL template would have to additionally call a simple toUpperCase() macro for the class name and you are set.

The datatypes mapping in the database mapping dialog then defines how eg. an Integer value maps to an oracle one (or any other database you want to use).

HTH

Oliver
« Last Edit: September 08, 2009, 10:23:03 pm by ofels »

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: How to specify an arbitrary type for a column
« Reply #5 on: September 08, 2009, 10:26:36 pm »
Quote
Second, you can create your own DBMS data type list. Even if you are not modeling data this can be a reasonable solution. One caveat: this approach quickly becomes unworkable if you have a large number of possible datatypes, or if the datatypes have many custom attributes.

I have tried this for a while and gave up as I was unable to create a reliable mapping between my own product datatypes and the oracle ones. The setting was neither stored nor visible in reference exports. This bug is still pending at Sparx and the last news I heard about this was the statement "we plan to redesign this dialog". Obviously other things are in queue with a higher importance :)

Oliver

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to specify an arbitrary type for a column
« Reply #6 on: September 09, 2009, 01:58:42 am »
Sigh...   :'(
No, you can't have it!

Wojciech Dec

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How to specify an arbitrary type for a column
« Reply #7 on: September 10, 2009, 07:12:44 pm »
Quote
... ... ...
EA deploys templates for several platforms (database, java, c#, etc.) which you might have to adapt a bit to fit your needs. In your case the DDL template would have to additionally call a simple toUpperCase() macro for the class name and you are set.
... ... ...
Oliver

Where can I find a list of such macros?  Is there a macro to remove all spaces or replace them with underline?

WD
« Last Edit: September 10, 2009, 07:14:00 pm by wojdec »

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: How to specify an arbitrary type for a column
« Reply #8 on: September 10, 2009, 07:25:42 pm »
Quote
Quote
... ... ...
EA deploys templates for several platforms (database, java, c#, etc.) which you might have to adapt a bit to fit your needs. In your case the DDL template would have to additionally call a simple toUpperCase() macro for the class name and you are set.
... ... ...
Oliver

Where can I find a list of such macros?  Is there a macro to remove all spaces or replace them with underline?

WD

Funny, I just used it myself two minutes ago ;D

In the online help go to the search tab and search for "Function Macros".
The TRIM macros trim spaces away. There is also a CONVERT_NAME  macro (new search) converting names into upper case, lower case, underlines, etc.

HTH

Oliver

lagear

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: How to specify an arbitrary type for a column
« Reply #9 on: September 25, 2009, 07:35:25 am »
Hi Oliver,

Did you say that there is DDL templates, where I found them?

Best,


Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: How to specify an arbitrary type for a column
« Reply #10 on: September 25, 2009, 06:00:33 pm »
Quote
Hi Oliver,

Did you say that there is DDL templates, where I found them?


Settings -> Transformation Templates
Then choose DDL as language.

There are no templates for SQL script creation if you mean those. Terminology is quite mixed as "create DDL" in fact means "create SQL" while at other places EA refers to the DDL as (PSM) data model.

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: How to specify an arbitrary type for a column
« Reply #11 on: September 28, 2009, 10:11:26 am »
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.