Quantcast
Channel: off-topic
Viewing all articles
Browse latest Browse all 10

Fill test data into existing database with JDO

0
0

I wanted to fill test data into an existing database with many foreign keys. These foreign keys were somewhat unusual because the tables were not linked via their primary keys but via a combination of other fields. Since I did not want to rebuild all foreign keys in my classes with JDO annotations I searched for a way to disable the checking of the keys and constraints. The usual

SET foreign_key_checks = 0;

did not work. Also disabling the keys for every table did not work and I still got the foreign key constraint violation error messages. After searching for some time I found a very simple solution. One can append the directive foreign_key_checks = 0 to the connection URL in the jdoconfig.xml config file:

<property name="javax.jdo.option.ConnectionURL"
          value="jdbc:mysql://localhost:3306/db_name?sessionVariables=FOREIGN_KEY_CHECKS=0" />

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images