However, I got so stuck in one of the sections. It is section 2.5 - Using automatic key generation. I spent so much time on this section, but I still could not fetch the right key from the database. I spent a lot of time reading the code, but then I found out the code generated from wizards is no longer under my control. The code looks so delicate that I did not know what I could do to make stuff work. Eventually I had to read the help contents of automatic key generation from RSA.
Based on the tutorial, when one wants to use automatic key generation, they just need to double click the relational record in Page Data view, go to Key Generation and specify the appropriate parameters. What I find out is that this process only will change a XML file under WEB-INF/wdo (the metadata file that is related to the relational record); however, this process will not add a piece of decisive code into the PageCode of the JSP, which is:
autoGenerateKey(create_record,
getCreate_recordMediator(),
getRealPath(create_record_metadataFileName));
In order to generate this segment, either I can put it in manually, or if I use the relational record wizard, what I can do is to select "Auto generate key" in the "Advance tasks" when I am at the "Column Selection and Other Tasks".
I am not being negative, it's just that wizards and code generation somehow can become a nightmare to programmers. When we find that something do not work, we do not know whether it's our code, or it's the complicated code that was generated. Secondly, it's often a challenge to see things don't work after following closely to a tutorial. I hope that my sharing here can help other people. :)
No comments:
Post a Comment