Issues

Select view

Select search mode

 

@Column(length=N) works on field, not on property

Rejected

Description

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)`

Environment

java application, Windows 7, running from eclipse (Kepler). Hibernate 4.1.10.Final - Derby 10.8.1.2

Attachments

3

Details

Assignee

Reporter

Labels

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

ralph cook

Affects versions

Priority

Created August 9, 2014 at 9:07 PM
Updated August 11, 2014 at 5:34 PM
Resolved August 11, 2014 at 5:34 PM

Activity

Show:

ralph cookAugust 10, 2014 at 1:43 PM

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.