Clearly I'm misunderstanding something in the way this works.

Having received the error:
 Error casting value for table 'glaccount' and column 'gltype_id'
no matter what I put in src/test/resources/sample-data.xml for the gltype_id
column (it's defined in postgres as "bigint" and the numbers it's trying to
use are -1 or -2), I finally decided to just remove that column altogether
from the sample-data.xml file.  That must be the right file, as removing it
results in a different error.

Then I got: 
Embedded error: org.postgresql.util.PSQLException: ERROR: insert or update
on table "glaccount" violates foreign key constraint "fk345b21a830ba0cef"
  Detail: Key (parent_id)=(1) is not present in table "glaccount".

Yet, there's no value (1) anywhere in the sample data!  This is a simple
self-referential table, where parent_id is a reference to the parent key.
Am I missing some required definition in the model for the top of the
hierarchy - the account with no parent?

The postgres definition is:
             Table "public.glaccount"
   Column    |          Type          | Modifiers
-------------+------------------------+-----------
 id          | bigint                 | not null
 name        | character varying(255) |
 description | character varying(255) |
 accountnum  | character varying(255) |
 parent_id   | bigint                 |
 gltype_id   | bigint                 |

and the sample data is:
    <!--Glaccount-START-->
    <table name="glaccount">
        <column>id</column>
        <column>parent_id</column>    
        <column>accountnum</column>
        <column>name</column>
        <column>description</column>
    <row>
        <value description="id">-1</value>
        <value description="accountnum">1</value>
        <value description="name">Assets</value>
        <value description="description">All Asset Accounts</value>
    </row>
    <row>
        <value description="id">-2</value>
        <value description="accountnum">5</value>
        <value description="name">Liabilities</value>
        <value description="description">All Liabilities and
Expenses</value>
    </row>
    <row>
        <value description="id">-3</value>
        <value description="parent_id">-1</value>
        <value description="accountnum">11</value>
        <value description="name">Sales</value>
        <value description="description">Sales to customers</value>
    </row>
    </table>
    <!--Glaccount-END-->

-- 
derek


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to