Book a Demo

Author Topic: Classes / attributes. How should I specify them?  (Read 3559 times)

han

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Classes / attributes. How should I specify them?
« on: November 13, 2006, 05:13:41 am »
Hi all,

I use EA now for two months as a modelling tool. I like it a lot, however, I do not think the database modelling is very easy.
My question is about modelling attributes in classes. Actually i have several questions:
1) How should I specify an attribute to be of the domain String(10) (a string of max length 10)
2) How should I specify what attribute(s) and/or relations are identifying an object of a class?
3) How should I specify that an attribute is mandatory/optional?
4) In case of optional, can I specify conditions in which case the attribute is mandatory?

Any other hints/tips are appreciated on modelling classes/attributes.

Thanks in advance

Han Joosten

thomaskilian

  • Guest
Re: Classes / attributes. How should I specify the
« Reply #1 on: November 13, 2006, 06:48:39 am »
I think that OCL is the answer to your questions (Tags might also work in parts). EA kind of supports OCL but I'm still not sure about that. You might search this forum for OCL.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Classes / attributes. How should I specify the
« Reply #2 on: November 13, 2006, 04:22:05 pm »
1) This depends (a bit) on the data types for the DBMS you are using. Using Oracle, create something like an NVARCHAR2 field. The dialog will allow you to define a maximum length (in this case defaulting to 50).

2) In which sense? If you mean the component(s) of a (possibly) compound primary key, just check the Primary Key box for each appropriate field.

3) Check/Clear (respectively) Not Null

4) Listen to Thomas - I think he's got it.
No, you can't have it!

han

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Classes / attributes. How should I specify the
« Reply #3 on: November 14, 2006, 01:19:50 pm »
Hi all,

Thanks for the replies! I have been looking around some further, and reading about OCL I stumbled upon an example. It turns out I overlooked the stereotype 'Table'. When I use these, I get the option of setting 'NOT NULL' and PRIMARY KEY on the attributes. I did not have them for ordinary classes, which I found a bit odd.

So now I have a new problem: is there a way to convert classes tot tables, or do I have to delete the classes I have and create tables instead?

Thanks again!

Han.

nara_c

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Classes / attributes. How should I specify the
« Reply #4 on: November 14, 2006, 07:44:40 pm »
Quote
Hi all,

So now I have a new problem: is there a way to convert classes tot tables, or do I have to delete the classes I have and create tables instead?

Thanks again!

Han.


Han,

Open your existing classes and set the stereotype to table.  You should notice that the element appearance will change in the diagrams that use the "table" classes as you apply the stereotype.  

Now when you each table element's properties you will see that the 2nd tab is changed to "table detail".  The attributes  & columns display will have the checkboxes you are looking for.

Cheers

thomaskilian

  • Guest
Re: Classes / attributes. How should I specify the
« Reply #5 on: November 17, 2006, 07:17:47 am »
You should try the DDL Transformation for the package. Right click the package containig your classes and look for DDL.