In my recent project I have faced an issue with editable table and validation functionality for table columns in JDeveloper 10.1.3. The problem was - when table was updated with wrong data, 500 Internal Server Error was generated, instead of error message. For sure, quite negative behavior. At first I have checked all validation rules, there was no any errors. For primary key attribute was assigned DBSequence type, I have tried to change it into oracle.jbo.domain.Number type, run test again - and application started to work correctly.
However, DBSequence type wasn't a source of problem. Problem was in Updatable While New option, when DBSequence type is used primary key attribute is read-only for existing rows, this means Updatable While New is selected automatically. Steve Muench have registered Updatable While New issue as a bug with reference - bug# 6138325, and provided workaround for us. Thanks Steve!
I have developed sample application - AttributeList.zip, in order to demonstrate this issue and to show how Steve's workaround works. In sample application EMPLOYEES table from standard HR schema is used. This table contains columns with NUMBER type, so it is suitable in our case. Sample provides two pages - test1.jspx and test2.jspx, first page shows wrong behaviour and second - correct.
At first, in JDeveloper 10.1.3 I have created simple editable table in standard way, like it is described in Oracle ADF Developer Guide. Table contains salary column, let's say we want to increase salary value for Alexander Hunold, column precision declared in database is 8, try to submit with precision 10:
Exception is generated:
Unusual behaviour, instead of validation error, exception is received and application crashed. However, workaround is available and in later JDeveloper versions this bug is fixed. Workaround is pretty simple and elegant, just put any updatable attribute in page definition file before read-only attribute for existing rows:
EmployeeId is declared as read-only attribute for existing rows:
And let's run a test again, correct behavior is received - no exception and expected validation message is shown:
Hope, shared experience will be useful for those, who will face the same issue in Oracle JDeveloper 10.1.3.
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.
Saturday, June 30, 2007
Updatable While New problem in JDeveloper 10.1.3
Labels:
ADF
Wednesday, June 27, 2007
Nice Norway
Just wanted to share nice view of Norway, that I have captured on those days. Rain is coming, but sunlight is still here :).
Labels:
Traveling
Saturday, June 23, 2007
Create, Edit and Delete operations in Master-Detail af:table components
It seems, my previous post about Create, Edit and Delete operations in ADF Faces af:table component is popular, I have received comments and questions from JDeveloper/ADF developers. One of the most interesting questions was about how to use the same functionality for Master-Detail, when both are based on af:table component. I have decided to implement Create/Edit/Delete functionality for Master-Detail case and to show how it works in Oracle ADF - EditableMasterDetailTable.zip.
Business logic is simple - relation between Countries and Locations entities from standard HR schema is implemented. Countries is for Master, and Locations for Detail. Master-Detail screen:
When row in Master table is selected, Detail table is updated automatically. It happens, because Oracle ADF provides Partial Page Rendering (PPR) functionality. Developed sample allows to manage Master record and at the same time dependent Detail records can be managed also.
Create functionality in Master table:
When record in Master table is saved, it becomes possible to add dependent records in Detail table:
Business logic is simple - relation between Countries and Locations entities from standard HR schema is implemented. Countries is for Master, and Locations for Detail. Master-Detail screen:
When row in Master table is selected, Detail table is updated automatically. It happens, because Oracle ADF provides Partial Page Rendering (PPR) functionality. Developed sample allows to manage Master record and at the same time dependent Detail records can be managed also.
Create functionality in Master table:
When record in Master table is saved, it becomes possible to add dependent records in Detail table:
Labels:
ADF
Sunday, June 10, 2007
Web Services in Oracle JDeveloper 11g
I have received a comment for my previous post - Web Services and Oracle TopLink, about if to try similar sample on Oracle JDeveloper 11g Technical Preview release. Yes, it is interesting, just because you can compare and evaluate new powerful features that will bring JDeveloper 11g Production release. I have tested Web Services development support in 11g using developed sample application - WSTopLink11.zip, this sample implements annotation only Web Service. I have used the same business logic as for previous one.
For persistence layer I'm using JPA entity with two Named Queries - Countries.findAll and Countries.findByName. When creating EJB Session Bean, Web Service Endpoint Interface is declared in the same way as in JDeveloper 10.1.3:
Generated interface for EJB Session Bean contains @WebService annotation, that in fact allows to use EJB Session Bean as Web Service directly:
Developed application structure in Application navigator window:
Oracle JDeveloper 11g provides embedded tool, that allows to test developed Web Service without deploying it to the server - just right click on EJB Session Bean and select - Test Web Service:
HTTP Analyzer window will be opened, where you can choose available operations to test, provide values for parameters and browse through generated result. Four views are provided - SOAP structure, HTTP Content, Hex Content and Raw Message. In our case, queryCountriesFindAll() generates similar result:
And, for queryCountriesByName(parameter) only result that is correct for specified parameter is shown:
For persistence layer I'm using JPA entity with two Named Queries - Countries.findAll and Countries.findByName. When creating EJB Session Bean, Web Service Endpoint Interface is declared in the same way as in JDeveloper 10.1.3:
Generated interface for EJB Session Bean contains @WebService annotation, that in fact allows to use EJB Session Bean as Web Service directly:
Developed application structure in Application navigator window:
Oracle JDeveloper 11g provides embedded tool, that allows to test developed Web Service without deploying it to the server - just right click on EJB Session Bean and select - Test Web Service:
HTTP Analyzer window will be opened, where you can choose available operations to test, provide values for parameters and browse through generated result. Four views are provided - SOAP structure, HTTP Content, Hex Content and Raw Message. In our case, queryCountriesFindAll() generates similar result:
And, for queryCountriesByName(parameter) only result that is correct for specified parameter is shown:
Labels:
JDeveloper 11g,
TopLink,
Web Services
Wednesday, June 6, 2007
Master in Computer Science degree
Today I have finished university studies, and received Master in Computer Science degree. Finally..., 6 years of studies are finished :). However, I'll never forget Professor Vigirdas Mackevicius and his Mathematical Analysis course. He is really cool Professor, knowledge and expertise that he have shared with us, first year bachelors, is and will be useful in our everyday life.
I'm not leaving academy, I have received an offer to be assistant lecturer in our faculty - I will teach Oracle/J2EE and IBM/J2EE from 2007 autumn semester for first year Masters.
I'm not leaving academy, I have received an offer to be assistant lecturer in our faculty - I will teach Oracle/J2EE and IBM/J2EE from 2007 autumn semester for first year Masters.
Labels:
Uncategorized
Sunday, June 3, 2007
Web Services and Oracle TopLink
If you are Oracle TopLink developer and want to access persistence layer through Web Service interface, hopefully you will find an answer in this post. Developed sample - WSTopLink.zip, doesn't provide user interface, it will be tested on Oracle Application Server. I will post how to use Web Services in Oracle ADF Faces in my future posts. Current sample is based on standard HR schema and provides functionality of querying for all or one particular country. Below I will provide main aspects I have noticed, when developing access to TopLink persistence layer through Web Service.
1. You should create Oracle TopLink entity objects in the same way, like you create them always. But, when creating EJB Session Bean don't forget to include Web Service Endpoint interface.
2. When creating Java Web Service, don't check 'Autogenerate Service Endpoint Interface'. It's because endpoint interface is already generated and is represented by EJB Session Bean.
3. In the step 5 of 8 in Java Web Service dialog you can select methods accessible through Web Service. In developed sample I have enabled access only to two methods - findAllCountries and findCountryByName.
4. Finally, JDeveloper generates all needed files. Generated WSDL document should look similar in Design view:
5. Developed application structure in Application navigator window:
6. One important thing - WAR Deployment Profile Properties dialog. Deployment profile for Web Service is generated automatically, but Oracle TopLink configuration files aren't included into it by default. So, don't forget to include them.
7. Access to persistence layer through Web Service is done, it's time to test it. I have deployed developed application to Oracle Application Server and have tested using standard interface provided by AS.
8. Let's press 'Invoke' button - information about all countries available in database table will be returned.
9. I have defined two operations to be available. Second operation accepts parameter and provides information only for country specified in that parameter. For example, if parameter value is set to Albania and 'Invoke' button is pressed, information only for that country will be returned.
Result:
1. You should create Oracle TopLink entity objects in the same way, like you create them always. But, when creating EJB Session Bean don't forget to include Web Service Endpoint interface.
2. When creating Java Web Service, don't check 'Autogenerate Service Endpoint Interface'. It's because endpoint interface is already generated and is represented by EJB Session Bean.
3. In the step 5 of 8 in Java Web Service dialog you can select methods accessible through Web Service. In developed sample I have enabled access only to two methods - findAllCountries and findCountryByName.
4. Finally, JDeveloper generates all needed files. Generated WSDL document should look similar in Design view:
5. Developed application structure in Application navigator window:
6. One important thing - WAR Deployment Profile Properties dialog. Deployment profile for Web Service is generated automatically, but Oracle TopLink configuration files aren't included into it by default. So, don't forget to include them.
7. Access to persistence layer through Web Service is done, it's time to test it. I have deployed developed application to Oracle Application Server and have tested using standard interface provided by AS.
8. Let's press 'Invoke' button - information about all countries available in database table will be returned.
9. I have defined two operations to be available. Second operation accepts parameter and provides information only for country specified in that parameter. For example, if parameter value is set to Albania and 'Invoke' button is pressed, information only for that country will be returned.
Result:
Labels:
TopLink,
Web Services
Subscribe to:
Posts (Atom)