This content has been marked as final. Show 7 replies
You can set "Primary Key" for multiple EO attributes - that will give you a composite primary key. If you are trying to do a composite unique constraint (as opposed to a composite primary key), you could take one of two approaches:
1). Put a unique index on the item in the DB and let the DB catch it (which is what I would do) - it's quite efficient.
2). Put an entity-level validation rule on the EO that validates the uniqueness of the combination.
Ok, thats what I allready have (uk constraint in DB) but I need an extra uk because of the fact that I base my EOs on views with instead of triggers.
Problem in creating Entity for view which has "INSTEAD OF " trigger
I'd still let the database handle this - it should work no differently. Assume an insert operation:
1). User fills in data (assume the UK will be violated)
2). Submit data
3). ADF BC does the insert
4). Instead-of-insert trigger fires, tries to do its magic and insert data
5). UK is violated on underlying table
6). Error propogates back to ADF BC
or, am I missing something?
the problem is not in the error handling but in the chose architecture (EO based on views with instead off triggers). Default I get the following error:
ORA-22816: unsupported feature with RETURNING clause
The solution to this is twofold:
- create a custom entity def impl class for your entity on the Java panel
and override the isUseReturningClause() and return false
- mark another attribute as being unique
The second option was the base of my question.
The paper about business rules in ADF BC gives some suggestions how to deal with secondary unique identifiers (and also explains why the Unique property does not work as you might expect it to do). You can find it here in section 22.214.171.124.1: