Book a Demo

Author Topic: convert table to class  (Read 5512 times)

univero

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
convert table to class
« on: June 13, 2007, 03:15:27 am »
Hi everyone,

how can i transform a table (imported via schema and odbc) into a class?

Bye
univero

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: convert table to class
« Reply #1 on: June 13, 2007, 03:31:56 am »
You probably need to look at Transformations. Start in the EA help file, then check the Resources page on the Sparx site.

AFAIK there is not a built-in transformation from data models to classes, although the reverse is available. So...

Once you've got the general idea check the EA Wiki and User Group. You can find the addresses by reading the first post of the top thread in the Automation section of this forum. There may be some template samples you can use to start you off.

David
No, you can't have it!

thomaskilian

  • Guest
Re: convert table to class
« Reply #2 on: June 13, 2007, 05:58:13 am »
David is right: there is no transformation. The simple reason is that from a shadow (the table) you hardly can build the 3D projection frame (the class). You could write a transformation which creates a 1 to 1 class representation and then you have to do some manual afterwork. This is quite simple: use the Cxx transformation to create a "duplication" transformation. This will take you approx. 1 day when starting from scratch (at least I needed that time once).

univero

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: convert table to class with annotions
« Reply #3 on: June 13, 2007, 10:13:00 pm »
Hi,

thanks for your answers. Transformation was the information I was looking for.. :)

And now there comes another question. Is it possible to do the transformation and get in the class the correct javax.persistence or hibernate annotations?

Greetings
Christian

thomaskilian

  • Guest
Re: convert table to class
« Reply #4 on: June 13, 2007, 10:52:49 pm »
Perhaps you should read my post.

univero

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: convert table to class
« Reply #5 on: June 13, 2007, 11:07:31 pm »
Hi Thomas,
i did read your mail.

But in our ea installation there is the possiblity to do a transformation between a table and a java class without writing my "own" transformation template.

So I thought that there was somewhere a similar transformation for hibernate/persistance. Perhaps an already defined template or something like that, which can be imported easily.

If there isn't something like that, I will write my own template.


Quote
David is right: there is no transformation. The simple reason is that from a shadow (the table) you hardly can build the 3D projection frame (the class). You could write a transformation which creates a 1 to 1 class representation and then you have to do some manual afterwork. This is quite simple: use the Cxx transformation to create a "duplication" transformation. This will take you approx. 1 day when starting from scratch (at least I needed that time once).


thomaskilian

  • Guest
Re: convert table to class
« Reply #6 on: June 14, 2007, 02:20:26 am »
I guess you mean the EJB Session and Entity transformation plus the DDL transformation. These go all from more abstract to more concrete things, not vice versa. You probably need to take the steps I described.