This content has been marked as final. Show 12 replies
tried it again-delete the COMMIT,button and redrag and drop again. the problem remains:
1.SUBMIT->COMMIT,-->refresh the page-->show the updated field data. but cannot see this updates in database.
--if I have enter or update wrong data in the field, will some alert be given?
2. if DELETE->SUBMIT->COMMIT-> can see the record been deleted in database.
I tried again and let me give more details:
1.There are three VOes which derived from same EO, and there is a LINK between VO1 and VO2 as a mater-detail relationship by a (*id, parent_id*) attributes pair(1-m relationship). and there is another link between VO1 and VO3 by a (id, id) attributes pair(1-1 relationship).
The data control pallete looks someting like:
2.drop the VO1-VO2 data controls as a TABLE TREE component, and the VO3 data control as a ADF FORM component into the same jspx page with SUBMIT button on. and
3.drag and drop DELETE, CREATEINSERT(from the VO3 data control pallete), COMMIT, ROLLBACK button after the ADF FORM component.
when it runs:
1.Can DELETE the record and COMMIT into the database successfully. BUT,
2.Cannot update fields for the ADF FORM components(drag from VO3 data control)--can SUBMIT and COMMIT in the page, but no updates in database--and gives no error msg in log file.
3.When click CREATEINSERT button. get a error msg like this (in Chinese): too many objects matches the primary key oracle.jbo.Key.
Is it because I'm trying to update the detail VO3 with more than one records (but it is a 1-1 relationship)?
How to implement this USE CASE (displaying an entity data which has a self master-detail relationship with a tree structure, and performance CRUD for this entity )?
Edited by: user6715237 on 2013-3-23 下午9:51
Have a look at the sample created for the same : http://www.datafilehost.com/download-babbe51a.html
1. Delete working fine as you said.
2. Update is also working fine... You can have a look at the implementation.
3. Create Insert : too many objects matches the primary key oracle.jbo.Key.
Note : You have defined link between VO1 and VO3 by a (id, id). So when you try to do a createInsert, it will try to create a record in VO3 with id of VO1 which are used for creating the link i.e. you are trying to create two links with same id.
To understand this - As implemented in my sample, say you have selected a employee Steven ( Id 103 ) in your tree. Same is selected in VO3 as there is 1-1 relationship. Now if you try to create an employee in VO3, will it now create a record with Emp Id as 103 which is primary key in VO3 also. Should it happen - Yes. How about product Supplier scenario where the viewLink is based on Product Id. So when you create a supplier under a master detail relation, product Id is prepopulated in Supplier record created. There is no error because productId is not the primary key for Supplier table.
I hope this answers your query.
Thank you for your good suggestions!
But after download your sample , a warning was given by the anti-virus software in my computer as:
The downloaded file ThreadId2516225.exe contains malware,(HEUR/Malware.QVM20.Gen).....
and was deleted automatically.
Edited by: user6715237 on 2013-3-25 上午3:04
Thank you very much for your kindness and patience to send me the sample you created! I'v download and have a try. Here is the results:
1.Since there is a 1-1 (id,id) relation between VO1 and VO3, we cannot create new records for VO3 without violating PK constraint for EO.
so I delete all VO3 page components and re-drag and drop VO1 from data control into the page again.
--now the TREE display and adf-FORM components are all based on the same VO1, and also add createinsert, delete button for the page.
and to my suprise, the newly created adf FORM components include all attributes from EO (employeeid,firstname,lastname,departmentid,email,hiredate...)
--but the VO1 query only include 3 attributes (employeeid,firstname,lastname)
-- and these three attributes can be seen under the DATA CONTROL structrue tree.
and I went on..
2.At the EmployeesEO attributes tab page, set the EmployeeId.type to DBSequence.--to create PK- employeeid automatically.
3.Run the testView.jspx page.
all seems ok even now:
--the TREE at left panel display rightly.
--the navigate button functions rightly for the right panel's emp form.and the records can be synced between the tree and the form.
--DELETE->SUBMIT->COMMIT is ok.
--edit some field ->SUBMIT-COMMIT is ok.
but when I press CREATINSERT :
--only three fields(employeeid,firstname,lastname) left on the page, others dispeared, and empoyeeid = -2,
--press SUBMIT, warnnings to fill required fields showed: email,hiredate,jobid are requiring input.
--press SUBMIT again, all fields(more than the above three) appeared again now. and filling all fields.
--press SUBMIT again, no warnings.
--press COMMIT, an error popup showed: ORA-01400: cannot insert a NULL ("HR"."EMPLOYEES"."EMPLOYEE_ID")
ORA-06512: 在 line 1.
--change employeeid = 2,
--press COMMIT again.
--data were saved succussfully now.
BUT there are must have something wrong in the above process.
and if i :
At the EmployeesEO attributes tab page, set the EmployeeId.type to integer.
and run Test.jspx:
the tree and form cannot display correctly nowand there is an error on the log file:
java.lang.ClassCastException: java.lang.Integer cannot be cast to oracle.jbo.domain.DBSequence
Can you help me further to solve these problems?
Thank you again.
Edited by: user6715237 on 2013-3-26 上午4:35
Wasn't the reply helpful.. ? Marking posts helpful and answered as per [Please read this before you post |https://forums.oracle.com/forums/ann.jspa?annID=56]
If you can send me the application ( modified after whatever u tried ) and the required implementation you want to achieve. I can take a look
Your first post to this thread is not only helpful, but almost close to correct! And I'm thinking to mark it as Correct after I have clear out all left doubts--but now I mark it helpful first. And i really thank you very much.
I am a newbie to Jdev/adf technology, i have 3 years dev experience for Oracle Forms many years ago. And have very few knowledge on java. So the questions I post in this forum maybe pretty simple.
The required implementation I want to achieve for this thread is: for a self-related entity (such as Employee entity with manager-emp relation), displaying data in a tree for navigation and perform CRUD in a form layout in the same page.-- Just like Your sample's implementation.
And my last try was on your sample--but I cannot access the dropbox site here(China), so one of my friends in Canada download it and send to me in email. I don't know how to send email to you? Here is my email: firstname.lastname@example.org
The modification to your sample is: delete VO3 components in the page, and drag/drop VO1 from data control and choose adf form components. And the running results is as described in my last posts --there is something wrong yet, and I hope someone like you can give further help.
Here goes the updated sample ...
I have introduced another table from a new VO ... just for your help.. Because when u select a record and try delete ... it will be allowed for records which are not having any dependency. I hope you understand that. SO fo quickly checking independent records that table is there.