Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: dbre mysql 'Foreign key table for foreign key' 'must not be null'

  1. #11

    Default

    Hello Alan,

    thx for attention !

    Two things :
    1. I cannot print here my schema because it is professional ...
    2. I solved the problem by closing STS and re starting it ... I don't know why it didn't work before and why it works now ...

    Thanks again for attention.

    Best regards.


    Cédric.

  2. #12
    Join Date
    Aug 2008
    Posts
    10

    Default Solved: dbre mysql 'Foreign key table for foreign key' 'must not be null'

    As it turns out the problem was related to OS X and its lack of a case sensitive file system. OS X (I have 10.5.8) only appears to have a case sensitive file system but in fact it does not.
    Try this:
    Code:
    $ touch test
    $ ls
    $ touch Test
    $ ls
    Disappointingly, OS X will change the file from 'test' to 'Test' but only one file will exist.
    This can be changed by modifying the file system _prior_ to operating system installation. I was not about to do this so I looked to MySQL for options.
    Code:
    mysql> show variables;
    Where the important lines are:
    Code:
    lower_case_file_system                  ON                                                                                        
    lower_case_table_names                2
    In this state, tables could be queried in lower or upper case.
    I added the following line to /etc/my.cnf
    Code:
    lower_case_table_names=0
    restarted mysql server. Tables could only be queried in lower case. I dropped the database and recreated it. Tables can only be queried in the case they were created in (with some leeway).

    Running the above roo scripts produces expected output and no errors.

    Note:
    I experienced a name conflict in one of the MySQL auto generated names for foreign keys. I had to specify the name of the foreign key using the 'constraint' key word.

    It is interesting in the database introspect output (from a previous post) that some of the table names identified in foreign keys were lower case and others matched the case of the table names.

  3. #13
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    20

    Default

    I have the same problem and I didn't finder the solution

    Code :

    Foreign key table for foreign key 'XXXXXX' in table 'XXXXXX' must not be null in determining a one-to-one relationship

    and also :

    Type 'com.XXXXXX.XXXXXX.XXXXXX' for table 'CXXXX' is not database managed (not annotated with @RooDbManaged)


    dbre.xml:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!--WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.-->
    <database name="XXXX">
    <option key="testAutomatically" value="false"/>
    <option key="includeNonPortableAttributes" value="false"/>
    <table name="XXXXXX">
    <column name="XXXXX" primaryKey="false" required="true" scale="0" size="2" type="3,NUMBER"/>
    <column name="XXXXXXX" primaryKey="false" required="true" scale="-127" size="0" type="3,NUMBER"/>
    <column name="XXXXXX" primaryKey="false" required="false" scale="0" size="7" type="93,DATE"/>
    <column name="XXXXX" primaryKey="true" required="true" scale="0" size="6" type="3,NUMBER"/>
    <column name="XX" primaryKey="true" required="true" scale="0" size="3" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="40" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="40" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="20" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="2" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="2" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="5" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="40" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="20" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="2" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="2" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="5" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="15" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="15" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="15" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="15" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="5" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="3" type="12,VARCHAR2"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="7" type="93,DATE"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="11" type="3,NUMBER"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="2" size="14" type="3,NUMBER"/>
    <column name="XXXXXXX" primaryKey="false" required="false" scale="0" size="35" type="12,VARCHAR2"/>
    <foreign-key foreignTable="XXXXXXX" name="XXXXXXX" onDelete="restrict" onUpdate="cascade">
    <option key="exported" value="true"/>
    <reference foreign="XXXXXXX" local="XXXXXXX"/>
    <reference foreign="XXXXXXX" local="XXXXXXX"/>
    </foreign-key>
    <foreign-key foreignTable="XXXXXXX" name="XXXXXXX" onDelete="restrict" onUpdate="cascade">
    <option key="exported" value="true"/>
    <reference foreign="XXXXXXX" local="XXXXXXX"/>
    <reference foreign="XXXXXXX" local="XXXXXXX"/>
    </foreign-key>
    <unique name="XXXXXXX">
    <unique-column name="XXXXXXX"/>
    <unique-column name="XXXXXXX"/>
    </unique>
    <unique name="XXXXXXX">
    <unique-column name="XXXXXXX"/>
    <unique-column name="XXXXXXX"/>
    </unique>
    <index name="XXXXXXX">
    <index-column name="XXXXXXX"/>
    </index>
    <index name="XXXXXXX">
    <index-column name="XXXXXXX"/>
    <index-column name="XXXXXXX"/>
    </index>
    <index name="XXXXXXX">
    <index-column name="XXXXXXX"/>
    <index-column name="XXXXXXX"/>
    </index>
    <index name="XXXXXXX">
    <index-column name="XXXXXXX"/>
    <index-column name="XXXXXXX"/>
    </index>
    <index name="XXXXXXX">
    <index-column name="XXXXXXX"/>
    </index>
    </table>
    </database>



    I'm using Roo 1.1.5 and database Oracle
    Last edited by Karina; Sep 2nd, 2011 at 12:13 PM. Reason: privacity

  4. #14
    Join Date
    Dec 2005
    Posts
    935

    Default

    It appears your Clientes type does not have the @RooDbManaged annotation on it. This would prevent the fields from being created hence your FK issue.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #15
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    20

    Red face

    Thanks for you Reply,

    And How I can fix this?
    I need help

    What I have to do for that not delete the class . java and the others?

    for example:
    Code:
    Created SRC_MAIN_JAVA\com\...
    Created SRC_MAIN_JAVA\com\...
    Created SRC_MAIN_JAVA\com\...
    Deleted SRC_MAIN_JAVA\com\...
    Deleted SRC_MAIN_JAVA\com\...
    Deleted SRC_MAIN_JAVA\com\...
    Last edited by Karina; Aug 30th, 2011 at 06:58 AM. Reason: m

  6. #16
    Join Date
    Dec 2005
    Posts
    935

    Default

    With the @RooDbManaged applied the type will be managed when the database reverse engineer command is run . If the table has been dropped from your db, the type will be deleted after the command is executed. If you want to keep the java class and all the fields and methods that get generated after the table has been dropped, just push-in all the fields and methods you want and remove the @RooDbManaged annotation. But it seems you have already done this before, because DBRE doesn't remove the annotation, and never would
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  7. #17
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    20

    Default

    I think the best option is to create the project in the traditional way.

    creating the entity, the fields ...



    Thanks for your help


  8. #18
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    20

    Default

    I didn't and I can't because the class is deleted immediately..
    what you mean with
    just push-in all the fields and methods you want and remove the @RooDbManaged annotation
    ?
    please Can you explain?

  9. #19
    Join Date
    Dec 2005
    Posts
    935

    Default

    Dbre will only delete a @RooDbManaged class if the table has been dropped. Put the table back and it will be recreated
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  10. #20
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    20

    Wink

    I did and it worked

    Thanks!




    Anita Karina Acosta Aguirre
    Estudiante Ingeniería en Informática

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •