Auto-populate a foreign key field
454814Feb 9 2006 — edited Feb 10 2006Hello,
I'm using ADF Faces and ADF BC. I've got a VO combining fields from 2 tables. I'm using a form page to create a new record in each table. The problem is auto-populating the foreign key field with the same value as the primary key of the master table.
I've overridden the create() method of each EO to supply primary keys from sequences. That works fine. So, I thought I could just grab the primary key via accessor methods and set my foreign key. I was wrong-- the accessor methods are returning null, so it seems that the detail EO is being created before the master EO, or the accessor methods only work after the foreign key is in place.
I've also thought about overriding doDML in the EO of the detail table. However, this seems like the wrong place for the same reason-- I believe the accessor methods will only work if the foreign key is in place.
So, it looks like the VO is the place to do this simple work. However, there's no create() method to override. In the View Object Editor > Java screen, it says that the View Row Class is the place to implement custom logic for default values. I don't see any methods to override, though.
Does anyone have a good solution to this?
Thanks,
-Anthony