Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » EclipseLink, DDL and INTERACT_WITH_DB
EclipseLink, DDL and INTERACT_WITH_DB [message #618869] Thu, 11 March 2010 21:45 Go to next message
Andrew Hume is currently offline Andrew HumeFriend
Messages: 18
Registered: December 2009
Junior Member
Hi

I am having problems generating DDL using DALI and EclipseLink 1.2.

I have been setting the required XML properties
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
<property name="eclipselink.application-location" value="C:\Dev\Workspaces\..."/>

But when I run Generate Tables from Entities, Dali generates a login.properties file with eclipselink.ddl-generation.output-mode set to database (not sql-script for some reason). No idea why it does this - I would have assumed it would just copy the value in the persistence.xml.

Searching the web suggests that EclipseLink requires a Java system property called INTERACT_WITH_DB to be set to false in order to generate the DDL scripts as opposed to actually connecting to the target database. Question is - how should I set this property?

I have tried starting Eclipse with -DINTERACT_WITH_DB=false but when I click 'Generate Tables from Entities" it still tries to connect to the database.

How should I be setting this property?

Many thanks
Andrew
Re: EclipseLink, DDL and INTERACT_WITH_DB [message #618870 is a reply to message #618869] Sun, 14 March 2010 12:16 Go to previous messageGo to next message
Andrew Hume is currently offline Andrew HumeFriend
Messages: 18
Registered: December 2009
Junior Member
If I run my application and set -DINTERACT_WITH_DB=false within Eclipse then DDL generation works.

I guess the JPA Tools menu not working is not that big a deal. Perhaps just remove it?
Re: EclipseLink, DDL and INTERACT_WITH_DB [message #618873 is a reply to message #618869] Wed, 17 March 2010 21:49 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
When using Dali to generate DDL, we actually ignore the settings in the persistence.xml so that the user doesn't have to concern themselves with these properties at design-time. Generally a user wouldn't have any DDL Gen properties in their persistence.xml and the tool would simply tell EclipseLink what to do. The downside is that we currently don't offer a way for the user to only generate the script. For this we should offer two paths for DDL generation, database and script, giving you a choice in a wizard. The other option would be to have generation properties override our passed in setting if they are present. I think the wizard offers a better user experience all around though.

I'll enter an enhancement request for this. In the meantime, the workaround is to generate the script outside of Dali, where simply setting the output mode to sql-script should be sufficient.

Sorry for the limitation here.

Neil
Re: EclipseLink, DDL and INTERACT_WITH_DB [message #618874 is a reply to message #618873] Wed, 17 March 2010 22:55 Go to previous message
Andrew Hume is currently offline Andrew HumeFriend
Messages: 18
Registered: December 2009
Junior Member
Neil

Thanks for the reply.

I think DDL generation is useful in terms of being able to (a) verify what the JPA provider "thinks" the schema will "look like" (helps with learning JPA), (b) and being given the basic DDL scripts to enhance with db specific clauses.

I do not "buy" the notion of directly creating the database (outside of JUnit tests with some in-memory db, or initial dev prototyping) as in reality people will want to customise the DDL with database specific features (eg, Oracle STORAGE clauses).

There seems to be a bug where if you reverse generate a table EclipseLink will mark the primary key column as "Unique", but when you forward generate it puts "UNIQUE" into the column definition ("UNIQUE NOT NULL") which Oracle errors on. If the id is assumed to be unique - then perhaps it is the reverse generation that is at fault.

Thanks again
Andrew
Previous Topic:using synonyms resolving to tables in another schema
Next Topic:Question about default JPA platform
Goto Forum:
  


Current Time: Sat Jun 23 08:45:18 GMT 2018

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

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

Back to the top