diff options
author | Shawn O. Pearce <sop@google.com> | 2010-06-04 12:19:25 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-06-04 12:45:13 -0700 |
commit | c689603a805e1a9ca6521ccf716be42231540be1 (patch) | |
tree | b467147aedb1b5bf9e27dfd1b1528ff7aa65fb66 | |
parent | c10c53b2a390b3c01144398af47f89b49b855f76 (diff) | |
download | gwtorm-c689603a805e1a9ca6521ccf716be42231540be1.tar.gz |
Don't allow multiple queries with the same method name
Require that the query name be unique within the access
interface, so that the implementation can use it as the
index name within the data store.
Change-Id: I7e73878c8b12a7ae8a758d84025c5383343c100b
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | src/main/java/com/google/gwtorm/schema/RelationModel.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/google/gwtorm/schema/RelationModel.java b/src/main/java/com/google/gwtorm/schema/RelationModel.java index 85c440f..de323f8 100644 --- a/src/main/java/com/google/gwtorm/schema/RelationModel.java +++ b/src/main/java/com/google/gwtorm/schema/RelationModel.java @@ -104,7 +104,13 @@ public abstract class RelationModel { } } - protected void addQuery(final QueryModel q) { + protected void addQuery(final QueryModel q) throws OrmException { + for (QueryModel e : queries) { + if (e.getName().equals(q.getName())) { + throw new OrmException("Duplicate query " + q.getName() // + + " in " + getAccessInterfaceName()); + } + } queries.add(q); } |