Hi,
What are domains type in ADFBC?
The answers is “Whenever you are in a situation where you want to standardized the validations and checks on special type attributes e.g. email field must be complete email address or number must be odd or even etc etc. In that case you can create a domain of that type and link with the entity objects or view objects attributes”.
In simple words domains will save a lot amount of time in your development and helps you to make standards.
Note: You can create domains on Oracle object types as well
How to create domain types?
This is a 3 step process which is as follows
1. Create a domain of some type e.g String, Number, Date
2. Override the validate() method in Domain’s java class. In case of fail validation your method must throw DataCreationException in the oracle.jbo package.
3. Choose the Attribute type as your new domain in entity or view object
Steps:
1. Right Click on model and choose New Domain as shown in the slide
Choose the data type for domain
Under java tab of domain’s properties click on the class name appearing
Override the validate method as shown in the slide. Note that there is a string mData is declared automatically which is reference to the type of domain.
Link the Domain to your attribute in entity object in our case i use First Name note that our domain name is appearing in Type List
Right click application module and Choose run and enter more than 30 characters in First name and navigate outside you will see the similar error. it is the validation of domain that causing this…….
Feel free to add this domain to any String attributes you like.
Download the sample code
More info at http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcentities.htm#sm0326
Happy Jdeveloping,
Zeeshan Baig