• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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>
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!