If I use "@Column(length=25)" on a String field, it creates the field in the database at a length of 25 as expected. If I move the annotation to the getter for the field, it appears to have no effect. The generated SQL confirms that it uses the length limit in one case but not the other. I have a program that re-creates the database from scratch when it runs; it runs fine in both cases with no error, but makes no use of the length in the second case that I can tell.
I feel certain that there's something that I'm missing, that this can't possibly have gone unnoticed, but I cannot find anything to indicate that it's a known problem, or that there is something else that is supposed to be in the program that I don't have there.
The program is run with a Derby running in server mode; the word "create" is passed on the command line (not case sensitive)`
java application, Windows 7, running from eclipse (Kepler). Hibernate 4.1.10.Final - Derby 10.8.1.2
I think I now understand what I didn't know. Based on what I've read since, I think it is working as intended. I do wish that annotations put in the 'wrong' place were flagged as warnings or something, not just ignored - it would help programmers determine what was wrong.
I would delete this issue if I saw a way to do that on this dashboard.