Rob Hills wrote: > Hi Derek, > > On 2 Mar 2008 at 17:13, Derek Broughton wrote: > >> 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
It turns out the problem there is that I got the "setter" name wrong for the column... >> 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? > > I'm not sure, but I wonder if your "accountnum" column is being > interpreted as a parent_id as the order of your data is different from the > order of columns you've defined. Ah, you're probably right. At least, there _is_ a "1" in the accountnum field, and nowhere else. If that's the case, then (I think) it's a bug in maven appfuse:gen, which didn't create the sample data in the same order as the table, but I might have messed it up when I was trying to get some real, useful, data in the initial load. > I know there are column names in a "description" > attribute in the "value" but I'm not sure they're actually used to > actually align > the enclosed data with the columns. I'd try making sure your data values > are in the same column order as that in your <table> attribute Thanks. I'll give it a try. -- derek --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
