|
|
|
[
Permlink
| « Hide
]
Pham Huu Le Quoc Phuc - 30/Nov/06 01:32 AM
I expect this future!
I think this is real hard future. In SQL DB, it constraint by origin(atomic) type(int, varchar, ...).
In Db4o, I have class: public class Address { string _Phone; string _Street; } public class Employee { Address _Adds; } How to constraint _Adds is unique? Can make an uniquely constraint include many fields?
There's just about no mutli-threaded app (meaning, any web app) that I can build WITHOUT this capability in the collection... I can't synchronize the object-altering methods, there will be far too many firing at once to permit that. And I shouldn't have to try to build my own sync at the application level... i just need a write-if-unique-else-fail capability!
Eu tambem espero esta funcionalidade.
I have to agree with Jim Youll - this is a critical feature for almost any non-trivial application. Once this functionality is available, DB4O becomes a much more compelling persistence solution.
a first implementation is checked in to SVN.
The functionality will be available in the 6.2 release. It would be nice if the UniqueFieldValueConstraintViolationException were to store the class and field name as instance variables, and provide getters for them.
When inserting a large graph of objects, there may be multiple unique field constraints involved. Who knows which one might trigger the exception? A user's code might want to handle certain UniqueFieldValueConstraintViolationExceptions for one class+field, and just rethrow all others. For example, if I'm inserting a new User object, and the username has already been taken, I could rely on the constraint, and inspect the exception. If the class+field are User+userName, then I throw some other exception with a more domain-specific message like "Sorry, this username is already taken". |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||