Discussion:
[Middlegen-user] Return type for finder on unique fields
Russell Black
2002-11-27 17:03:02 UTC
Permalink
I have the following table:

CREATE TABLE person (
person_id int PRIMARY KEY,
email varchar(256) NOT NULL,
name varchar(256) NOT NULL,
...
UNIQUE(email)
);

Note that email is unique, but not the primary key. Middlegen makes a findByEmail xdoclet tag that returns a collection instead of a single person. For the short term, is there a way, using the mergedir or something else, to get a findByEmail that doesn't return a collection? Long term, is it possible for middlegen to recognize that it's unique and make the appropriate xdoclet tag? Does middlegen glean unique constraints from the database?

Russell

Loading...