SQLContainer getContainerProperty case-sensitive?

Is the property id in SQLContainer getContainerProperty case-sensitive?

When I try to set the city name using NAME as the property id, I get a NullPointerException. The database table columns are lower-case (same as tutorial). This is the line (same as tutorial):

cityContainer.getContainerProperty(id, “NAME”).setValue(cities[i]
);

If I change “NAME” to “name”, I get a Property. So how does the tutorial work, since it uses uppercase property ids?

After further investigation, I believe my problem with case is related to the fact that I’m using MySQL instead of HSQLDB. MySQL queries return column names exactly as they are in the database while HSQLDB always returns uppercase regardless of the case used when generating the tables. I changed the table creation code to create uppercase column names.

Also, I had a problem with the cityid random values: in the tutorial they are generated from random numbers 0-13, but MySQL’s auto-generated ids are 1-14, so I adjusted that as well.

I would still like confirmation that Property IDs are case-sensitive. I can’t find anything in the documentation stating that, though it would seem to be the case (pardon my poor pun).

Hi,

As you noticed, the property IDs are not case-sensitive in SQLContainer. The case-sensitivity is decided by the underlying DB and its settings, you may want to check them. However, there is an unfortunate ‘bug’ in the SQLContainer demo: the table creation code uses lowercase column names, whereas upper case is used elsewhere. You may want to create a ticket about this issue to the Vaadin trac.

In case you encounter any case-sensitive behavior due to SQLContainer itself, it is not intentional and should be reported as a bug.


Tepi