This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to force kodo to generate the Foreign Keys while creating the SQL script?  RSS feed

 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to generate the SQL script using the schema.xml that Kodo generated. The Foreign Keys are still missing in the script. But they exist in the schema.xml.

I put this line inside the kodo.properties but nothing has changed
kodo.jdbc.ForeignKeyConstraints: true


How can I force kodo to generate the Foreign Keys while creating the SQL script?

Thanks


kodo.properties

kodo.LicenseKey=XXXX-XXXX-XXXX-XXXX-XXXX
kodo.ee.ManagedRuntimeProperties=TransactionManagerName=java:/TransactionManager
kodo.Log: DefaultLevel=ERROR

javax.jdo.PersistenceManagerFactoryClass=kodo.jdbc.runtime.JDBCPersistenceManagerFactory
javax.jdo.option.ConnectionDriverName=oracle.jdbc.driver.OracleDriver
javax.jdo.option.ConnectionUserName=USERNAME
javax.jdo.option.ConnectionPassword=PASSWORD
javax.jdo.option.ConnectionURL=jdbc racle:thin:@coyote:1521 EV
javax.jdo.option.Optimistic=true
javax.jdo.option.RetainValues=true
javax.jdo.option.NontransactionalRead=true



build.xml
......
<target name="jdo-copy">
<copy todir="${classes.dir}">
<fileset dir="${java.dir}">
<include name="**/*.jdo"/>
</fileset>
</copy>
</target>
<target name="jdo-enhance" depends="jdo-copy">
<jdoc>
<classpath refid="class.path"/>
<fileset dir="${classes.dir}">
<include name="**/*.jdo"/>
</fileset>
<config propertiesFile="kodo.properties"/>
</jdoc>
<mappingtool action="refresh" schemaFile="${target.dir}/schema.xml">
<classpath refid="tools.class.path"/>
<fileset dir="${classes.dir}">
<include name="**/*.jdo"/>
</fileset>
<config propertiesFile="kodo.properties"/>
</mappingtool>
</target>
<target name="refresh-datastore" depends="jdo-copy">
<schematool action="refresh">
<classpath refid="tools.class.path"/>
<fileset file="${target.dir}/schema.xml"/>
<config propertiesFile="kodo.properties"/>
</schematool>
</target>
<target name="generate-sql" depends="jdo-copy">
<schematool action="dropDB" file="${sql.dir}/oracle/scripts/Kodo-DropTables.sql">
<classpath refid="tools.class.path"/>
<fileset file="${target.dir}/schema.xml"/>
<config propertiesFile="kodo.properties"/>
</schematool>
<schematool action="refresh" file="${sql.dir}/oracle/scripts/Kodo-CreateTables.sql">
<classpath refid="tools.class.path"/>
<fileset file="${target.dir}/schema.xml"/>
<config propertiesFile="kodo.properties"/>
</schematool>
</target>
......


schema.xml

<schemas>
<schema>
......
<table name="SUBCA_JOBSET">
<column name="JOBSET_MSISDN" type="varchar" size="255"/>
<column name="KEY0" type="varchar" size="255"/>
<fk name="F_SBC_BST_JOBSET_REF" to-table="SUBCAMPAIGN" column="KEY0"/>
<fk name="F_SBC_BST_JOBSET_ELEMENT" to-table="JOB" column="JOBSET_MSISDN"/>
<index name="I_SBC_BST_JOBSET" column="KEY0"/>
<index name="I_SBC_BST_JOBSET1" column="JOBSET_MSISDN"/>
</table>
......
</schema>
</schemas>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!