You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/09/02 06:30:01 UTC
cvs commit: jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/jdbc JdbcMapper.java
dgraham 2003/09/01 21:30:01
Modified: mapper/src/share/org/apache/commons/mapper/jdbc
JdbcMapper.java
Log:
Removed uppercasing query names. Now all query names must be correctly
specified.
Revision Changes Path
1.6 +22 -24 jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/jdbc/JdbcMapper.java
Index: JdbcMapper.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/jdbc/JdbcMapper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JdbcMapper.java 28 Aug 2003 00:11:23 -0000 1.5
+++ JdbcMapper.java 2 Sep 2003 04:30:01 -0000 1.6
@@ -82,8 +82,8 @@
/**
* DataSource to get connections from. Making this protected allows child
- * Mappers to redefine the database they should use although most of the time
- * they'll probably use the default database.
+ * Mappers to redefine the database they should use although most of the
+ * time they'll probably use the default database.
*/
protected DataSource ds = null;
@@ -96,12 +96,10 @@
protected MapperFactory mapperFactory = null;
/**
- * Stores a map of query names to actual SQL queries. This allows queries to be
- * externalized to support multiple database types. This member is private to
- * force subclasses to use the getQuery() method to retrieve queries with case
- * insensitive names.
+ * Stores a map of query names to actual SQL queries. This allows queries
+ * to be externalized to support multiple database types.
*/
- private Map queries = null;
+ protected Map queries = null;
/**
* Constructor for JdbcMapper.
@@ -115,7 +113,7 @@
* @see org.apache.commons.mapper.Mapper#create(Object)
*/
public Object create(Object domainObject) throws MapperException {
- throw new UnsupportedOperationException("Create not supported.");
+ throw new UnsupportedOperationException("create() not supported.");
}
/**
@@ -124,7 +122,7 @@
*/
public Object findByUniqueId(Object id)
throws MapperException {
- throw new UnsupportedOperationException("Find by unique ID not supported.");
+ throw new UnsupportedOperationException("findByUniqueId() not supported.");
}
/**
@@ -132,7 +130,7 @@
* @see org.apache.commons.mapper.Mapper#delete(Object)
*/
public void delete(Object object) throws MapperException {
- throw new UnsupportedOperationException("Delete not supported.");
+ throw new UnsupportedOperationException("delete() not supported.");
}
/**
@@ -140,7 +138,7 @@
* @see org.apache.commons.mapper.Mapper#update(Object)
*/
public void update(Object object) throws MapperException {
- throw new UnsupportedOperationException("Update not supported.");
+ throw new UnsupportedOperationException("update() not supported.");
}
/**
@@ -148,23 +146,23 @@
* @see org.apache.commons.mapper.Mapper#findAllObjects()
*/
public Collection findAllObjects() throws MapperException {
- throw new UnsupportedOperationException("Find all objects not supported.");
+ throw new UnsupportedOperationException("findAllObjects() not supported.");
}
/**
- * Returns the SQL query for the given query name. The name is case
- * insensitive so a lookup on "PERSON" and "person" will return the same object.
- * @throws IllegalArgumentException if there is no mapping for the given name.
+ * Returns the SQL query for the given query name.
+ * @param queryName The logical name of an SQL statement.
+ * @throws IllegalArgumentException if there is no mapping for the given
+ * name.
*/
protected String getQuery(String queryName) {
- // uppercase key for case insensitive lookups
- String sqlQuery = (String) this.queries.get(queryName.toUpperCase());
- if (sqlQuery == null) {
+ String sql = (String) this.queries.get(queryName);
+ if (sql == null) {
throw new IllegalArgumentException(
queryName + " is not a valid query name.");
}
- return sqlQuery;
+ return sql;
}
/**
@@ -177,7 +175,7 @@
/**
* Sets the mapperFactory.
- * @param mapperFactory The mapperFactory to set
+ * @param mapperFactory The mapperFactory that created this Mapper.
*/
public void setMapperFactory(MapperFactory mapperFactory) {
this.mapperFactory = mapperFactory;
@@ -185,7 +183,7 @@
/**
* Sets the queries.
- * @param queries The queries to set
+ * @param queries The queries to set.
*/
public void setQueries(Map queries) {
this.queries = queries;