Tuesday, May 13, 2008

Legacy DB equals frustration

Been spending a lot of time trying to solve problems with Grails when you are using a legacy database. It could be a combination of factors but I am trying to do "simple" one to one mapping of a code table to a column value and I can not get any dynamic finders working!!!

So I tried a simple:
def results = MyMainDomain.findAll()
and I get:
No row with the given identifier exists: [MyLookupClass#someValueInLookupClass ]

When I change the variables back to Strings that message goes away.

Then I get results back with all rows (rowcount = to db row count) containing empty values!

Turns out: DO NOT define any columns in your composite primary key from other Domain Classes!!! I changed them to Strings and it worked.

No comments: