Author Topic: Error while generating DDL : Database not defined  (Read 2874 times)

Stephane B

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Error while generating DDL : Database not defined
« on: July 15, 2013, 06:35:44 pm »
Hi everyone,

I'm trying to generate DDL from a data model, but I get an error pop-up saying "myclass: Database not defined". What am I doing wrong?

I understood that it normally happens when there is no target database defined in Tools > Options > Code Editors > Default database. I tried with several (PostgreSQL, MySQL...) with no success.

In the same file, I have a data model that generates the DDL fine, and a data model with which the error occurs. I checked the same options in both. I noticed that in the data model that doesn't work, the checkbox "IF EXISTS" next to "Create Drop SQL" is missing. Any clue ?

I'm using EA 9.0

Thanks for your help.


Stephane B

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Error while generating DDL : Database not defi
« Reply #1 on: July 15, 2013, 07:06:47 pm »
OK, got it. There is a "Database" property that must be define on each «table»class.

Don't know why the default from Options doesn't apply when this field is left blank. *sigh*

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error while generating DDL : Database not defi
« Reply #2 on: July 15, 2013, 09:29:58 pm »
Quote
OK, got it. There is a "Database" property that must be define on each «table»class.

Don't know why the default from Options doesn't apply when this field is left blank. *sigh*
AFAIK it's inserted when the class is created.

q.

Stephane B

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Error while generating DDL : Database not defi
« Reply #3 on: July 18, 2013, 07:17:14 pm »
Yes indeed,

It's a two-step process : PIM class -> PSM Datamodel -> Generate DDL.

During first step, the data model template does picks the database property from general options and fills the field in the created class. If the general option was left blanked at that time, then the property is not set in the created class.

But during the second step, the DDL generator won't look at the general database option if your class' Database property is blank. I thought it could have...

I did set the option after step 1, hence the trouble.