Friday, December 11, 2009

adding 1 or more blank rows to your af:table for data entry

Boy am I embarressed. I read the whole 1160 ADF 10g developers guide for 4GL developers from Oracle, have professional experience with building ADF, and claim to be becoming an expert in all this stuff.

But I had failed in getting this simple thing done before successfully: have more than one rows availble in an af:table to allow data entry. I kept running into trouble with validation on the second row. I knew how to do what I wanted in Oracle*forms, just not ADF/BC/ADF Faces!

To my credit though I am sure I must have inquired of the JDev Forum at least once before on this subject. Literally I had come up with an "alternative" solution on a prior contract, but it was WRONG!

The correct solution is very simple: like it says in the manual: whenever you do a VO.create(); follow that by taking the resulting row and saying resultingRow.setNewRowState(Row.STATUS_INITIALIZED);

Then you can VO.insertRow(resultingRow), or do whatever you want.

The odd part of this is, I guess, if you have overridden your initDefaults in the VO's entity, using the entity's setters may changed the status of this VO row from STATUS_INITIALIZED to STATUS_NEW. I kinda figured that if you have setter method calls (e.g., this.set...(blah))in that method that you would not "dirty" your row or entity. I guess that is not right.

At any rate: that's how it is supposed to be done.

So embarressed.

2 comments:

Unknown said...

Hi Michael,

Thanks for your work on this blog.
Although I don't understand all your writing (I'm trying to catch up on ADF but it's hard to find a good path to follow).
I find your blog very interesting.
And if you don't mind I've put a link on http://wiki.oracle.com/page/ADF+Blogs. Here are many more blogs on ADF and stuff and it seems your valuable blog wasn't in the list.
regards,
Marcel.

Michael A. Fons said...

Hi, Marcel! I am gratified that you like my blog! Thank you very much.

I really appreciate you adding the link to the Oracle wiki ADF link sites.

I try to publicize my blog when I can, and I appreciate your help in that way also! If you have any questions about a specific blog post please post them; my blog is set to inform me when somebody posts comments. I usually respond as soon as I find out there was a comment...which is pretty quickly. Today I was in a 4-hour meeting (yikes!), so it took me a few hours.

If your question is about adf in general or some other question, you can reach me at michael_fons at yahoo dot com.

Happy ADF'ing!