db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbeams <cbe...@gmail.com>
Subject Implicitly setting @Column's defaultValue parameter
Date Thu, 09 Aug 2007 20:35:45 GMT
In the case of a PC class with a field declared as

	@Column(name = "foo_bar", allowsNull = "false")
	int fooBar = 0;

It would be nice if the implementation would implicitly set the  
default value for the column, as if the user had typed

	@Column(name = "foo_bar", allowsNull = "false", defaultValue = "0")
	int fooBar = 0;

This is especially helpful in schema generation scenarios where  
incremental changes (ALTER TABLE ADD COLUMN) are being applied to a  
schema.  Without the defaultValue set, schema generation fails with  
an error stating that it can't alter the table because it doesn't  
know what to populate into the new column for already existing rows.

This change would also reduce the risk of error-prone duplication  
between the programmatically assigned value and the annotation- 
declared value (I can't imagine when they wouldn't be the same).

Thanks,

- Chris Beams

Mime
View raw message