xyzDataProvider.commitChanges() is not updating db record

I have searched high and low for answers on this forum and other help content, but unfortunately I have hit a wall. Would appreciate it if someone could help.

I am doing a simple retrieve using a dataprovider, updating a couple of the fields, and attempting to commit the changes back to the db with no luck. Here is the code segment:

Integer pick_id = (Integer) this.pickid.getValue();

if (!pick_id.equals(new Integer(0))){

getSessionBean1().getPicksRowUpdate().setObject(1, pick_id);

picksRowUpdateDataProvider.refresh();

if (picksRowUpdateDataProvider.getRowCount() == 1){

picksRowUpdateDataProvider.cursorFirst();

picksRowUpdateDataProvider.setValue("PICKS.PICK", this.dropDown3.getSelected());

picksRowUpdateDataProvider.setValue("PICKS.COMBINED_SCORE", this.textField1.getValue());

}

}

picksRowUpdateDataProvider.commitChanges();

Any reasons why commitChanges would not be writing my updates to the db? No error messages - as far as I can tell.

The select associated with it is pretty simple too:

SELECT ALL NVFOOTBALLPICKS.PICKS.PICK,

NVFOOTBALLPICKS.PICKS.COMBINED_SCORE

FROM NVFOOTBALLPICKS.PICKS

WHERE NVFOOTBALLPICKS.PICKS.PICKID = ?

Any guideance is greatly appreciated.

Thanks.

[1573 byte] By [MoAsgaria] at [2007-11-26 23:41:00]
# 1
The first guess I have is, that you have the Submit-Button and the Data-Input-fields in different Virtual Forms. Or the Submit-Button in a virtual Form and the Inputfields not.
Willi2793a at 2007-7-11 15:08:14 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks for your response Willi2793. I played around with virtual forms as well with no luck.

But what if the dataprovider is simply being used for updates and is not bound to any fields on the page? Shouldn't it still work?

Furthermore, I have tried it with fields (hidden and display only though) bound to the dataprovider, but still had no luck getting it post to the DB (as part of a virtual form and not - of course making sure the post action was associated with the submit "save" button).

Curently I have no viritual forms. When I click on the "save" button, this code fragment is being executed, but it is not posting to the DB.

The code fragment is actualy part of a drop down's process Value Change method. I have removed the auto-submit against the drop down (which allows me to change the value for multiple table rows) and the drop down's value change method is being triggered when the main form is posted when I click on the "save" button.

Does that make sense?

MoAsgaria at 2007-7-11 15:08:14 > top of Java-index,Development Tools,Java Tools...
# 3
Still searching for some answers here. Does any others have any ideas I can follow up on?I am wondering if there is a more direct way to do simple reads and writes of data to a db withouth having to use a dataprovider.
MoAsgaria at 2007-7-11 15:08:14 > top of Java-index,Development Tools,Java Tools...
# 4
Check this thread. http://forum.java.sun.com/thread.jspa?threadID=5094670&messageID=9326756
Rradhikaa at 2007-7-11 15:08:14 > top of Java-index,Development Tools,Java Tools...
# 5

Well, I managed to figure out what was going on. My "update" data provider was only selecting, and as such attempting to update, a couple of fields back to the database. Once I switched it around whereby I was selecting ALL the fields, and only updating the couple I needed, the commit back to the database started working fine. Phew.. that took sometime to figure out.

Thank you to those who took the time and provided suggestions. I think comment 4 (the last comment in the thread link provided) opened my eyes a bit and helped try something different. Thx.

MoAsgaria at 2007-7-11 15:08:14 > top of Java-index,Development Tools,Java Tools...