I'm new to JBoss and Java. My company has an existing system and we are doing R&D to transfer this system to J2EE using back the same Oracle database.
Many of the database columns were set to Char datatype. As you know, there are trailing blanks if less characters were entered.
I've got a problem when doing selection in my entity bean. The PreparedStatement will not ignore the blanks in the database.
Is there a way in JBoss or Java to instruct it to ignore the blanks?
I'm answering my own question.
It's simple, instead of using "..... WHERE col = ? " and PreparedStatement.setString(1, value), we can straight away build the WHERE clause like:
.... WHERE col = '" + value + "'"