I don't like general purpose code generation, but I am fan of special purpose ones. The main reason that I don't like the general purpose ones is in my experience they have invariably fell into the "Generate code that I don't like" or "Requires too much futzing to get to work the way I want it." Part of it is related to the fact that I consider generated code as a maintainability concern as well, and I am very nervous about trying to do that.
Nevertheless, I do like code generation, I tend to write simple code-generators for a lot of purposes. In my current project, we have a lot of churn in database schema wise (add field, rebuild, get a new DB), but we also have all kinds of ETL process to and from the DB, so that makes life more interesting. I wrote a code generator based on SMO that reads the DB schema after NHibernate generates it, and basically handles ~85% of the ETL process mess.
The nice thing about doing a one off tool is that I can make a lot of assumptions about the structure that I will be using (all tables has PK named Id, for instances) that a general purpose tool cannot make.