How to create Insert & Update on master-detail form JPA/EJB 3.0
Is there any demonstration or tips how to Insert record on master-details form for JPA/EJB 3.0 with ADF binding?
I have master-detail forms (dept-emp). I drag the dept->operations->create method to JSF page. But when I click create button, only dept form is clear and ready for insert. But emp form is not clear. How can I add create method for this?
Can you give some example how to pass the right object to the persist or merge method so that it can save both the two objects (master-detail tables)
Thanks
Edited by: user560557 on Oct 9, 2009 8:58 AM
Similar Messages
-
Inserting records in master detail form
I am moving an existing Webdb Application to portal. In the application there is a master detail form along the following lines
Dept Id: 10
Dept Name: IMS
Employee ID Employee Name etc
1586 Julie Wilks
Currently users can insert/update/delete detail lines. When inserting, the dept_id foreign key is automatically inserted into the dept_id column in the detail table. My understanding is that for some reason this does not happen in portal. Instead, the user is expected to input any foreign keys manually. As this could lead to all sorts of problems I'd rather not have to do this.
Has anyone found a means to get around this problem?
If solutions have already been posted, please point me in the right direction as a search on the forum hasn't come up with anything.
Many thanks,
Julie WilksHi,
Am I the only one having this problem?
Thanks,
Diana -
Insert error in master-detail form
Probably a stupid question. When I populate the master block of
a master detail form from an LOV, I am asked to save the form.
Since the information is loaded from the LOV, there are no
changes to save. If I answer yes, it gives an Insert error due
to the primary key violation in the master block table. If I
answer no, it opens the detail block and gives the correct
information. The problem is that when I enter information into
the detail block and try to save it, I get the same error
message regarding the primary key violation in the master block.
The form works fine if I do not populate the master block from
the LOV (or from select statements in triggers). Any suggestions
will be appreciated.
LSHi,
Check for the form or block status.Looks like the status has
changed.Thats why u r getting the message.If any of the base
table item has changed then u will get such a message.Try
working on this an check it out.
Thanks
Vinod -
How to display more rows in Master-detail form
I am working on APEX3.2.
I have a master-detail form. The detail form always display 15 rows. However, my customer wants the detail display all the rows. I tries to configure the Number of Rows in the report. It doesn't work. How do I do it?
Thanks a lot!Hi:
To increase number of rows displayed you have to set Number of Rows and pay attention to both Number of Rows (Item) and Maximum Row Count.
After that if didn't work, sign out or close the browser then open it again. Sometimes it keeps the value in current session.
Saad, -
How to create two linked lists (Master/Detail or Parent/Child)
I need to create a couple of related lists in a Master/Detail approach. Users are supposed to choose one "Master" Option, and "Detail" column should be refreshed to display only the items that are strictly related to the chosen option
in "Master". Any posible solution?
Thanks in advance.One option is to connect two web parts. This will give you option button for your master list web part and based on the value selected your results will be filtered in the detailed list web part. Here is the example. Though it is for SP 2010 it should work
the same in SP 2013.
http://sarahlhaase.wordpress.com/2012/05/21/connecting-web-parts-with-a-selector-and-a-detail-pane-sharepoint-2010-version/
Second option is with some customization using Jquery.
http://summit7systems.com/creating-a-parentchild-list-relationship-in-sharepoint-2013/
Amit -
Hi All,
I have a master block and the respective detail block is on a different canvas and I invoke it using 'Show' button in the Master Block. In the Detail/Child block I can able to display all the respective records(5 records display). Now I need to create an 'Update' button to commit the changes/Insertion of New records..The update buttons also created 5 times as the records display.
1. I need only one "Update" button. Also exit and delete buttons as I dont have the default oracle menu for Details block.
2. When I tab out of the 5th record, I want to get a new record field. Currently the tab cursor shuttles within and not able to create a new row to insert new record.
Kindly assist.
Thanks
SriSri,
1. I need only one "Update" button. Also exit and delete buttons as I dont have the default oracle menu for Details block.You have your button in your DETAIL Block. Therefore, it will be displayed as many times as the Records.Number of Records Displayed property of your Detail Block. The best solution is to move your button to a Control block. The other option would be to override the Block propery at the Item and set the Item Records.Number of Records Displayed property to 1.
2. When I tab out of the 5th record, I want to get a new record field. Currently the tab cursor shuttles within and not able to create a new row to insert new record.Check the Block property Navigation.Navigation Style. It sounds like this property is set to "Same Record." If it is, change it to "Change Record."
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Hi guys,
Does anyone know how to create a 3 level master detail form with the level 2 and level 3 on the same page.
Thanks
SamNot required
-
Error ORA-01790: for INSERT in master detail form
Gidday;
I get the error message 'ORA-01790: expression must have same datatype as corresponding expression' when I attempt an insert operation in the detail region of a master/detail form.
I have checked previous entries of this error I could find - as far as I can tell the parent key defaults are correct.
It seems one of the factors could be that the tables are not within the 'home' schema for the application. I have created a similar default master detail form on the tables, with the home schema matching that for the tables. Within my major application I have ensured the correct schema is referenced in all fields (all those I could find - in the Report Attributes / Column Attributes area).
I just cannot find which expressions are mis-matching their datatypes.
thanks; DSHi,
According to [http://ora-01790.ora-code.com] the error is raised because "A SELECT list item corresponds to a SELECT list item with a different datatype in another query of the same set expression." Do you have any Select Lists on your page? If you do, is the "return value" of the same datatype as for the underlying field?
One thing to try in these circumstances is to click the Debug link on the Developer's toolbar at the bottom of the page and then try to insert your record. You will get a whole stream of messages appear on the left of the page and the error should become obvious.
You could also check that all the defaults you have set do not contain spaces or linefeeds at the end - I have seen this cause issues before.
Andy -
Master Detail Forms with 2 composite primary keys - Is there a workaround?
Hello All,
I have been searching for a workaround to the maximum 2 part primary key restriction on the multi-row updates, and master-detail forms, and am hoping that someone can help me. I am using HTMLDB v2.0.0.00.49 with IE 6 against a 9.2 DB.
I successfully implemented the workaround of Fred Stoopendaal's (see Updata PK on HTML DB ) and it works fine for single page multi-record updateable forms, but alas I haven't been able to extend it to master detail forms (I think it is something to do with Oracle not allowing the "returning" clause on views).
Here is what I tried:
two tables, one with a 2 part composite primary key, which is the master table, and a detail table with 3 part composite primary key -
--------- BEGIN SQL ---------
create table master_table
( master_col1 number
, master_col2 number
, master_col3 varchar2(30)
, constraint master_pk primary key (master_col1,master_col2));
create table detail_table
(detail_col1 number
,detail_col2 number
,detail_col3 number
,detail_col4 varchar2(30)
, constraint detail_pk primary key(detail_col1,detail_col2,detail_col3)
, constraint master_detail_fk foreign key (detail_col1,detail_col2) references master_table(master_col1,master_col2));
create or replace view v_master_table as
select rowid mata_rowid,mata.*
from master_table mata;
create or replace view v_detail_table as
select rowid deta_rowid,
(select rowid from master_table mata where mata.master_col1 = deta.detail_col1 and mata.master_col2 = deta.detail_col2) deta_mata_rowid
, deta.*
from detail_table deta;
create or replace trigger mata_ins_upd_trg
instead of insert or update on v_master_table
referencing new as new old as old
for each row
begin
if inserting then
insert into master_table (master_col1, master_col2, master_col3)
values (:new.master_col1, :new.master_col2, :new.master_col3);
end if;
if updating then
update master_table
set master_col1 = :new.master_col1,
master_col2 = :new.master_col2,
master_col3 = :new.master_col3
where rowid = :old.mata_rowid;
end if;
end;
create or replace trigger deta_ins_upd_trg
instead of insert or update on v_detail_table
referencing new as new old as old
for each row
begin
if inserting then
insert into detail_table ( detail_col1, detail_col2, detail_col3, detail_col4)
values (:new.detail_col1, :new.detail_col2, :new.detail_col3, :new.detail_col4);
end if;
if updating then
update detail_table
set detail_col1 = :new.detail_col1,
detail_col2 = :new.detail_col2,
detail_col3 = :new.detail_col3,
detail_col4 = :new.detail_col4
where rowid = :old.deta_rowid;
end if;
end;
--------- END SQL ---------
Then I created a master-detail form in Apex on the two views, using the mata_rowid and deta_rowid as primary keys, and mata_rowid=deta_mata_rowid as the link. I realise that using a function to fetch the master rowid within the detail view query is costly, but it was my intention to modify the record fetch queries to use the real FK columns once things were up and running.
It seems to generate the pages ok, and I can insert/update master table records, but as soon as I modify records in the detail table things go a bit haywire. I can't find any documentation on how the inbuilt MRU/MRD logic works, so can't figure out the issue.
Can anyone out there tell me what the problem is with the logic above, or if they have come up with a neat solution to this annoying limitation. I know that many will say that I should modify the data model to use surrogate primary keys, but many of the uses for HTMLDB are new interfaces for old schemas, so a workaround that doesn't involve wholesale data model changes would be preferable.
Thanks in advance,
Mike CretanHi, this is likely not the most elegant way...but perhaps the simplest -- and I didn't have much time to play.
I used Wizard to create two separate Master Detail forms, each with a separate detail table. Thus I ended up with four pages:
Page "A" - "Selector" page for Master (Report), with Edit link driving to Detail-1
Page "B" - Editable Master/Detail-1 page (HTML / Report)
Page "C" - "Selector" page for Master (Report), with Edit link driving to Detail-2
Page "D" - Editable Master/Detail-2 page (HTML / Report)
Then I selected the primary key column TWICE on the Report on Page A. Modified the second instance of this column to navigate to Page D (passing primary key) exactly the way the original instance of this column navigates to Page B. Then I deleted Page C.
Since you can have only one Tabular Entry form per page, this seemed the best way to drive two separate detail tables from a common interface. -
How can I insert in the table detail of a master/detail form??
Hello, I have created a master/detail form from the assistant, and with the code generated by APEX I do not manage to insert a row in the table detail, I press the button 'Add Row' and refill information, when I press the button ' to apply changes ' me the following mistake appears:
'Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "C85B64D53C8D63E9D3EE83B82728DFA3", item checksum = "244B1FED90DF5CC5B0DDB6728F4D02DD"., update "CRM_ADMIN"."ASIGNACIONES_AM_CONTACTOS" set "SECUENCIA" = :b1, "CODIGO" = :b2, "NOMBRE_CLIENTE" = :b3, "NOMBRE" = :b4, "COMENTARIOS" = :b5, "CODIGO_COMERCIAL" = :b6'
How I can solve and be able to insert in the table it detail?
ThanksHi Law,
Text in a shape or a text box will not feature in the table of contents.
To get a colour behind your titles, type them into your document (not a shape). Format as Heading or some other paragraph style the TOC will recognise.
Select the title text and Format Panel > Text > Font > Gearwheel > Advanced Options.
Choose Character Fill Color and choose a colour from the palette (left) or colour circle (right).
Example Titles (all on the same page for a smaller screen shot).
Chapter 3 (in a coloured Text Box or Shape) does not appear in the TOC:
Hint for cheats :
To give the titles a wider Character Fill Colour, add some Tab characters before and after.
Regards,
Ian. -
How to create a master detail form on same page in apex 4.2.1
Hi All,
i need to design a master detail form on same page i am not finding an option in wizard from where i can do that.
will appreciate your suggestions.
ThanksHi James,
I think that Mike is suggesting that you create a SQL View over the table and join together the individual primary key values into a single, unique, pseudo primary key. You can still include the individual columns in the SQL but you can then use this new column as the primary key on a form. However, you would also need to create INSTEAD OF triggers to handle inserts/updates/deletes as SQL will not allow you to update tables through a view. (See: [http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/create_trigger.htm#i2064426] for the Oracle details on this or Re: How to update view resp. table for an example within Apex).
Ideally, though, you should only really need one key column - is there any need for four?
Andy -
Master Detail Form - How 2 update a field in the Detail form using a query?
Hello,
I have a master detail form with, each master record having a fixed(6) number of detail records. One of the fields in the detail record is the PART_DESCRIPTION field. I am trying to update this field by querying Table_X. TABLE_X is in the format of (desciption id, description). Description id runs from 1 to 6.
When the form displays, the PART_DESCRIPTION field for the 6 detail records needs to be automatically populated with the six values of description stored in Table_X. How can this be done?
Tried using session storage objects, but made no headway.
Would greatly appreciate pointers on how to go about doing this.
Thanks.
DevIf you are on a Portal Version lesser than 3.0.9.8.3, then please try the following to populate
the PART_DESCRIPTION field.
Steps:-
1> Edit the form and go to the Additional PL/SQl section and put the following code in the
"...after displaying the page area" :-
declare
type t_vc_arr is table of varchar2(4000) index by binary_integer;
l_arr_desc t_vc_arr;
l_form_name varchar2(200);
l_form_state varchar2(500);
begin
l_form_name := p_session.get_module().get_name();
l_form_state := p_session.get_value_as_varchar2(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_FORM_STATE'
if l_form_state = 'QUERY_AND_SAVE' then
select description
bulk collect into l_arr_desc
from <schema>.table_x;
htp.p('
<script>
var descArr = new Array();
var Fidx = 1;
var formObj = document.WWVM'||p_session.get_id()||';
var fieldName = "'||l_form_name||'.DETAIL_BLOCK.PART_DESCRIPTION.0";
for i in 1..l_arr_desc.count loop
htp.p('descArr['||to_char(i-1)||']="'||l_arr_desc(i)||'";');
end loop;
htp.p('
for (var i=0; i < formObj.length; i++){
if (formObj.elements.name == fieldName+Fidx){
formObj.elements[i].value = descArr[Fidx-1];
++Fidx;
htp.p('</script>');
end if;
end; -
How to create a master detail form using single table
Hi,
how to create a master detail form using single table.
Regards,
M. SatishHi
how to create a master detail form using single table.Make the Master ur pks the details the rest of ur data base field in the detail it's a mater of organizing fields on a form M-Detail...
Now What ?
Regards,
Amatu Allah -
How to create Master Detail Form in htmldb 2.0
This option use to be available in 1.6 but I can't see it anywhere in 2.0.
Anonymous - Create Page>Form>Master Detail Form.
Scott -
How to determine the ROWNUM in a Master Detail Form
Hello,
I am working in a Master Detail Form with Orders and Order Items Information; and I created a process that allows the users to select a Product ID on a tabular form, and the next column is populated automatically with the Product Description.
To achieve that, I followed some instructions by Denes Kubicek (http://apex.oracle.com/pls/otn/f?p=31517:241), but my case is slightly different:
<ul>I am using a wizard-created tabular form, instead of a manual tabular form; and </ul>
<ul>Instead of using another page as a Popup to pass the parameter of the ROWNUM, I am using a plug-in called “Tabular Form Super LOV” which is a modified version of the SkillBuilders’ Super LOV that works on Tabular Forms. </ul>
The Product ID is returned in the correct row by the plug-in; but in the case of the Product Description, it is always returned into the first row; and my problem is that I don't know how to determine the row where the user clicked to call the plug-in.
I set up an example in apex.oracle.com in case someone would like to look at it:
Workspace: ediazjorge
Username: test
Password: test
App Name: Sample App
App Number: 1550
BTW, I am using Apex 4.1.1.00.23 and Oracle DB 10.3.2.
Thanks in advance,
ErickHello VC,
Thank you for your time and help.
Unfortunately, it is still not working properly:
1. When the Popup LOV opens, the first row of the tabular form is 0, the second row is 1, and so on. How can I assign the values starting with 1 and in the format *0001* ? (I am still a novice on Apex and new to JavaScript :-), sorry about that).
--2. Also, when I close the Popup LOV, the value of P1_ROWNUM is ‘undefined’ again so I'm not sure if the Product Name column will be populated.--
3. And finally, you are using the jQuery Selector uPopupLOVIcon, which is an attribute of the Cloudy Theme. In my real application (Apex 4.1.1.00.26), my element looks like: *<img src="/i/lov_16x16.gif" width="16" height="16" alt="Popup Lov" alt="List" style="vertical-align:middle;" align="middle" />*. What do you recommend me to use as a jQuery Selector?
Again, I really appreciate your help and time. I think you solved the most difficult part.
Thank you so much,
Erick
Update: I just found out that the problem with my comment 2 is because I didn’t delete the previous dynamic action that set the value to P1_ROWNUM.
Edited by: ediazjorge on Sep 18, 2012 11:20 AM
Maybe you are looking for
-
when i take a picture with my ipad 2 lets say im looking to the right and i take the picture and when i go to the gallery my face is looking the other way(left)
-
How to get photos of of iPhone 4s
how do you get photos off of Iphone. it no longer shows up as a device
-
Increased Shared Pool size longer hot backup time?
Hello, I have hot backup that usually took 2 hours to complete. Then we had to increase Shared pool size from 280Mb to 380Mb due to some performance issue. One week after increase of size the hot backup is taking 4 hours to complete. Since there was
-
Hi You All, As per requirement we developed the small Addon which is attached to sales quotation & for that AddOn I need a approval which is on based userdefind query.I done this much of portation BUT as per standard. in Approval Template-Setup we ha
-
Uff, estoy muy decepcionada con mi iphone 4
Uff, estoy muy decepcionada con mi iphone 4, no llego a acabar nunca una conversación o directamente no entra la llamada , hoy es la 7 veces que envio a mi operador , por lo nemo una explicacion clara y combicente por favor