Wednesday, March 14, 2007
Database column names and Java bean variable names don't match
What I suspected several days was right. When we call a stored procedure, all column names that are returned are all upper case. Then when we convert these returned records into Java bean Object, the names don't match. For example, in the Bean class I have a variable called "courseName" and 2 methods called "getCourseName" and "setCourseName". When I run the file, I will get the error saying that method "isCOURSENAME" not found. Actually, we don't need the method isCourseName in the Bean class. But because the column name in the database is COURSENAME and when a try to convert a record in the database to a Bean object, the program tries to find the getCOURSENAME and setCOURSENAME. The error "isCOURSENAME" not found misleads. I didn't add the isCOURSENAME to the Bean class and I changed only the CourseName to COURSENAME. I worked after that.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment