Christian, Could you please file a Jira entry for this? I am hoping there someone in the Derby development community that has time to take up this issue and propose and implement a solution. It seems to me that this is a serious hindrance to migration to Derby that would be good to resolve sooner rather than later.
You can file it as an "Improvement" in Jira at: http://issues.apache.org/jira/secure/CreateIssue!default.jspa Thanks Kathey Trevor Squires wrote: > Hi, > > I asked this very question last week (or so) for pretty much the same > reason. > > It doesn't appear that you can alter the table to make it an identity > column after creation (which was my first idea). I was also unable to > find any way to switch off the identity feature temporarily either. > > One person suggested that derby ought to support something like > "generated by default as identity" which makes sense - although I'd > rather be able to just switch on and off the current behavior for > loading of dumps and pre-population. > > In order to get my project out the door I ended up converting the > logic to update/select rows in an "identities" table that I manage > myself. > > HTH, > Trevor > > Christian Rodriguez wrote: > >> Hi everyone, >> >> I am trying to import data from a mysql dump file. Basically, I need >> to insert values in tables. Some of the tables in mysql include >> auto_increment columns, that I have translated to "generate always as >> identity" in derby. Now... the mysql dump file has values in those >> columns, and I get an error when trying to insert a value into an >> IDENTITY column in derby. How can I do this? >> >> I have a couple of ideas, but none work: >> >> 1. I could define the column as a regular column (not identity) and >> after the values have been populated I could try to ALTER the column >> in the table to make it an identity column, but this last part doesnt >> seem posible. >> 2. Is there another way to implement "autoincrement" in derby? >> 3. Is it posible to disable the "identity" feature until all values >> have been populated? >> >> Any other ideas? >> >> Of course, I could let derby generate values for that identity column >> and then map the original values with those, and touch all the >> references in the other tables and convert them to the new identity >> values, but that doesnt seem like a lot of work... and Im getting the >> feeling there should be a more reasonable way to import "dumps" from >> other databases... >> >> Thanks for any help you can give me, >> Xtian > > >
