bataras wrote:
Actually, now that I've looked at the BasicPropertyAccessor implementation of PropertyAccessor, it doesn't appear to help with my problem. The problem is this: I want to be able to specify "default="n"" within a <column> or <property> object configuration (just like saying "not-null="true"") so that a) the generated schema from SchemaExport will create the table's column with "default n" just like it creates it with "NOT NULL" and b) the "alter table" script generated by SchemaUpdate will be able to add new columns as "NOT NULL" because they're set to have a "default n".
thanks
First off, I agree that it would be nice if there was a default="n" attribute available. But there isn't. You might want to search the JIRA to see if there is one opened for it. I find it hard to believe that nobody has requested it before but my guess is it was rejected.
That said... There are quite a few previous postings on this same topic in the past and looking back at some of them, one recommends setting the default values in your database DDL.
If this isn't an option, the PropertyAccessor will work. It's not as elegant as having a default="n" attribute, but it it doesn't require a hibernate schema and code change either.