You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2009/11/16 23:06:38 UTC
svn commit: r880993 [2/4] - in /cayenne/main/trunk/framework:
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/a...
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresPkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresPkGenerator.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresPkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresPkGenerator.java Mon Nov 16 22:06:17 2009
@@ -41,18 +41,11 @@
* @since 1.2
*/
public class IngresPkGenerator extends OraclePkGenerator {
-
- /**
- * @deprecated since 3.0
- */
- protected IngresPkGenerator() {
- super();
- }
-
+
protected IngresPkGenerator(JdbcAdapter adapter) {
super(adapter);
}
-
+
@Override
protected long longPkFromDatabase(DataNode node, DbEntity entity) throws Exception {
@@ -92,56 +85,6 @@
con.close();
}
}
-
- /**
- * Generates primary key by calling Oracle sequence corresponding to the
- * <code>dbEntity</code>. Executed SQL looks like this:
- *
- * <pre>
- * SELECT nextval(pk_table_name)
- * </pre>
- *
- * @deprecated since 3.0
- */
- @Override
- protected int pkFromDatabase(DataNode node, DbEntity ent) throws Exception {
-
- DbKeyGenerator pkGenerator = ent.getPrimaryKeyGenerator();
- String pkGeneratingSequenceName;
- if (pkGenerator != null
- && DbKeyGenerator.ORACLE_TYPE.equals(pkGenerator.getGeneratorType())
- && pkGenerator.getGeneratorName() != null)
- pkGeneratingSequenceName = pkGenerator.getGeneratorName();
- else
- pkGeneratingSequenceName = sequenceName(ent);
-
- Connection con = node.getDataSource().getConnection();
- try {
- Statement st = con.createStatement();
- try {
- String sql = "SELECT " + pkGeneratingSequenceName + ".nextval";
- QueryLogger.logQuery(sql, Collections.EMPTY_LIST);
- ResultSet rs = st.executeQuery(sql);
- try {
- // Object pk = null;
- if (!rs.next()) {
- throw new CayenneRuntimeException(
- "Error generating pk for DbEntity " + ent.getName());
- }
- return rs.getInt(1);
- }
- finally {
- rs.close();
- }
- }
- finally {
- st.close();
- }
- }
- finally {
- con.close();
- }
- }
@Override
protected List<String> getExistingSequences(DataNode node) throws SQLException {
@@ -159,8 +102,8 @@
List<String> sequenceList = new ArrayList<String>();
while (rs.next()) {
String name = rs.getString(1);
- if(name != null) {
- sequenceList.add(name.trim());
+ if (name != null) {
+ sequenceList.add(name.trim());
}
}
return sequenceList;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java Mon Nov 16 22:06:17 2009
@@ -201,7 +201,7 @@
*/
@Override
protected PkGenerator createPkGenerator() {
- return new MySQLPkGenerator();
+ return new MySQLPkGenerator(this);
}
/**
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java Mon Nov 16 22:06:17 2009
@@ -35,17 +35,10 @@
*/
public class MySQLPkGenerator extends JdbcPkGenerator {
- /**
- * @deprecated since 3.0
- */
- MySQLPkGenerator(){
- super();
- }
-
- MySQLPkGenerator(JdbcAdapter adapter){
+ MySQLPkGenerator(JdbcAdapter adapter) {
super(adapter);
}
-
+
@Override
protected String dropAutoPkString() {
return "DROP TABLE IF EXISTS AUTO_PK_SUPPORT";
@@ -137,90 +130,6 @@
}
/**
- * Overrides superclass's implementation to perform locking of the primary key lookup
- * table.
- *
- * @deprecated since 3.0
- */
- @Override
- protected int pkFromDatabase(DataNode node, DbEntity ent) throws Exception {
-
- // must work directly with JDBC connection, since we
- // must unlock the AUTO_PK_SUPPORT table in case of
- // failures.... ah..JDBC is fun...
-
- // chained SQL exception
- SQLException exception = null;
- int pk = -1;
-
- Connection con = node.getDataSource().getConnection();
- try {
-
- if (con.getAutoCommit()) {
- con.setAutoCommit(false);
- }
-
- Statement st = con.createStatement();
-
- try {
- pk = getPrimaryKey(st, ent.getName());
- con.commit();
- }
- catch (SQLException pkEx) {
-
- try {
- con.rollback();
- }
- catch (SQLException e) {
-
- }
-
- exception = processSQLException(pkEx, exception);
- }
- finally {
- // UNLOCK!
- // THIS MUST BE EXECUTED NO MATTER WHAT, OR WE WILL LOCK THE PRIMARY KEY
- // TABLE!!
- try {
- String unlockString = "UNLOCK TABLES";
- QueryLogger.logQuery(unlockString, Collections.EMPTY_LIST);
- st.execute(unlockString);
- }
- catch (SQLException unlockEx) {
- exception = processSQLException(unlockEx, exception);
- }
- finally {
- // close statement
- try {
- st.close();
- }
- catch (SQLException stClosingEx) {
- // ignoring...
- }
- }
- }
- }
- catch (SQLException otherEx) {
- exception = processSQLException(otherEx, exception);
- }
- finally {
- try {
- con.close();
- }
- catch (SQLException closingEx) {
- // ignoring
- }
- }
-
- // check errors
- if (exception != null) {
- throw exception;
- }
-
- return pk;
- }
-
- /**
* Appends a new SQLException to the chain. If parent is null, uses the exception as
* the chain root.
*/
@@ -244,57 +153,6 @@
}
/**
- * @deprecated since 3.0
- */
- protected int getPrimaryKey(Statement statement, String entityName)
- throws SQLException {
- // lock
- String lockString = "LOCK TABLES AUTO_PK_SUPPORT WRITE";
- QueryLogger.logQuery(lockString, Collections.EMPTY_LIST);
- statement.execute(lockString);
-
- // select
- int pk = -1;
-
- String selectString = super.pkSelectString(entityName);
- QueryLogger.logQuery(selectString, Collections.EMPTY_LIST);
- ResultSet rs = statement.executeQuery(selectString);
- try {
- if (!rs.next()) {
- throw new SQLException("No rows for '" + entityName + "'");
- }
-
- pk = rs.getInt(1);
-
- if (rs.next()) {
- throw new SQLException("More than one row for '" + entityName + "'");
- }
- }
- finally {
- try {
- rs.close();
- }
- catch (Exception ex) {
- // ignoring...
- }
- }
-
- // update
- String updateString = super.pkUpdateString(entityName) + " AND NEXT_ID = " + pk;
- QueryLogger.logQuery(updateString, Collections.EMPTY_LIST);
- int updated = statement.executeUpdate(updateString);
- // optimistic lock failure...
- if (updated != 1) {
- throw new SQLException("Error updating PK count '"
- + entityName
- + "': "
- + updated);
- }
-
- return pk;
- }
-
- /**
* @since 3.0
*/
protected long getLongPrimaryKey(Statement statement, String entityName)
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java Mon Nov 16 22:06:17 2009
@@ -44,36 +44,11 @@
*/
public class OpenBasePkGenerator extends JdbcPkGenerator {
-
- /**
- * @deprecated since 3.0
- */
- protected OpenBasePkGenerator() {
- super();
- }
-
protected OpenBasePkGenerator(JdbcAdapter adapter) {
super(adapter);
}
/**
- * Returns a non-repeating primary key for a given entity. Since OpenBase-specific
- * mechanism is used, key caching is disabled. Instead a database operation is
- * performed on every call.
- *
- * @deprecated since 3.0
- */
- @Override
- public Object generatePkForDbEntity(DataNode node, DbEntity entity) throws Exception {
- // check for binary pk
- Object binPK = binaryPK(entity);
- if (binPK != null) {
- return binPK;
- }
- return Integer.valueOf(pkFromDatabase(node, entity));
- }
-
- /**
* Returns a non-repeating primary key for a given PK attribute. Since
* OpenBase-specific mechanism is used, key caching is disabled. Instead a database
* operation is performed on every call.
@@ -149,50 +124,6 @@
}
/**
- * Generates new (unique and non-repeating) primary key for specified DbEntity.
- * Executed SQL looks like this:
- *
- * <pre>
- * NEWID FOR Table Column
- * </pre>
- *
- * COLUMN must be marked as UNIQUE in order for this to work properly.
- *
- * @deprecated since 3.0
- */
- @Override
- protected int pkFromDatabase(DataNode node, DbEntity entity) throws Exception {
- String sql = newIDString(entity);
- QueryLogger.logQuery(sql, Collections.EMPTY_LIST);
-
- Connection con = node.getDataSource().getConnection();
- try {
- Statement st = con.createStatement();
- try {
-
- ResultSet rs = st.executeQuery(sql);
- try {
- // Object pk = null;
- if (!rs.next()) {
- throw new CayenneRuntimeException(
- "Error generating pk for DbEntity " + entity.getName());
- }
- return rs.getInt(1);
- }
- finally {
- rs.close();
- }
- }
- finally {
- st.close();
- }
- }
- finally {
- con.close();
- }
- }
-
- /**
* Returns SQL string that can generate new (unique and non-repeating) primary key for
* specified DbEntity. No actual database operations are performed.
*
@@ -291,15 +222,16 @@
+ "' has no PK defined.");
}
- StringBuilder buffer = new StringBuilder();
+ StringBuilder buffer = new StringBuilder();
buffer.append("CREATE PRIMARY KEY ");
boolean status;
- if(entity.getDataMap()!=null && entity.getDataMap().isQuotingSQLIdentifiers()){
- status= true;
- } else {
+ if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
+ status = true;
+ }
+ else {
status = false;
}
- QuotingStrategy context = getAdapter().getQuotingStrategy(status);
+ QuotingStrategy context = getAdapter().getQuotingStrategy(status);
buffer.append(context.quoteString(entity.getName()));
@@ -328,12 +260,13 @@
protected String createUniquePKIndexString(DbEntity entity) {
Collection<DbAttribute> pk = entity.getPrimaryKeys();
boolean status;
- if(entity.getDataMap()!=null && entity.getDataMap().isQuotingSQLIdentifiers()){
- status= true;
- } else {
+ if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
+ status = true;
+ }
+ else {
status = false;
}
- QuotingStrategy context = getAdapter().getQuotingStrategy(status);
+ QuotingStrategy context = getAdapter().getQuotingStrategy(status);
if (pk == null || pk.size() == 0) {
throw new CayenneRuntimeException("Entity '"
+ entity.getName()
@@ -345,7 +278,7 @@
// compound PK doesn't work well with UNIQUE index...
// create a regular one in this case
buffer.append(pk.size() == 1 ? "CREATE UNIQUE INDEX " : "CREATE INDEX ");
-
+
buffer.append(context.quoteString(entity.getName()));
buffer.append(" (");
@@ -382,5 +315,5 @@
public void setPkCacheSize(int pkCacheSize) {
// noop, no PK caching
}
-
+
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java Mon Nov 16 22:06:17 2009
@@ -110,14 +110,6 @@
}
}
- /**
- * @deprecated since 3.0, as a generic BLOB method is used to write BLOBs.
- */
- @Deprecated
- public static Method getOutputStreamFromBlobMethod() {
- return outputStreamFromBlobMethod;
- }
-
// TODO: rename to something that looks like English ...
public static boolean isSupportsOracleLOB() {
return supportsOracleLOB;
@@ -152,14 +144,6 @@
}
/**
- * @deprecated since 3.0, as a generic CLOB method is used to write CLOBs.
- */
- @Deprecated
- public static Method getWriterFromClobMethod() {
- return writerFromClobMethod;
- }
-
- /**
* Returns an Oracle JDBC extension type defined in
* oracle.jdbc.driver.OracleTypes.CURSOR. This value is determined from Oracle driver
* classes via reflection in runtime, so that Cayenne code has no compile dependency
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java Mon Nov 16 22:06:17 2009
@@ -31,9 +31,9 @@
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.access.DataNode;
import org.apache.cayenne.access.QueryLogger;
-import org.apache.cayenne.dba.QuotingStrategy;
import org.apache.cayenne.dba.JdbcAdapter;
import org.apache.cayenne.dba.JdbcPkGenerator;
+import org.apache.cayenne.dba.QuotingStrategy;
import org.apache.cayenne.map.DataMap;
import org.apache.cayenne.map.DbEntity;
import org.apache.cayenne.map.DbKeyGenerator;
@@ -52,21 +52,13 @@
* <pre>
* dataNode.getAdapter().getPkGenerator().setPkCacheSize(1);
* </pre>
- *
*/
public class OraclePkGenerator extends JdbcPkGenerator {
- /**
- * @deprecated since 3.0
- */
- protected OraclePkGenerator() {
- super();
- }
-
protected OraclePkGenerator(JdbcAdapter adapter) {
super(adapter);
}
-
+
private static final String _SEQUENCE_PREFIX = "pk_";
@Override
@@ -104,19 +96,20 @@
while (it.hasNext()) {
DbEntity ent = (DbEntity) it.next();
String name;
- if(ent.getDataMap().isQuotingSQLIdentifiers()){
+ if (ent.getDataMap().isQuotingSQLIdentifiers()) {
DbEntity tempEnt = new DbEntity();
- DataMap dm = new DataMap();
+ DataMap dm = new DataMap();
dm.setQuotingSQLIdentifiers(false);
tempEnt.setDataMap(dm);
tempEnt.setName(ent.getName());
name = stripSchemaName(sequenceName(tempEnt));
- } else {
+ }
+ else {
name = stripSchemaName(sequenceName(ent));
- }
+ }
if (sequences.contains(name)) {
runUpdate(node, dropSequenceString(ent));
- }
+ }
}
}
@@ -148,7 +141,7 @@
* primary key generation process for a specific DbEntity.
*/
protected String dropSequenceString(DbEntity ent) {
-
+
StringBuilder buf = new StringBuilder();
buf.append("DROP SEQUENCE ").append(sequenceName(ent));
return buf.toString();
@@ -205,56 +198,6 @@
}
- /**
- * Generates primary key by calling Oracle sequence corresponding to the
- * <code>dbEntity</code>. Executed SQL looks like this:
- *
- * <pre>
- * SELECT pk_table_name.nextval FROM DUAL
- * </pre>
- *
- * @deprecated since 3.0
- */
- @Override
- protected int pkFromDatabase(DataNode node, DbEntity ent) throws Exception {
-
- DbKeyGenerator pkGenerator = ent.getPrimaryKeyGenerator();
- String pkGeneratingSequenceName;
- if (pkGenerator != null
- && DbKeyGenerator.ORACLE_TYPE.equals(pkGenerator.getGeneratorType())
- && pkGenerator.getGeneratorName() != null)
- pkGeneratingSequenceName = pkGenerator.getGeneratorName();
- else
- pkGeneratingSequenceName = sequenceName(ent);
-
- Connection con = node.getDataSource().getConnection();
- try {
- Statement st = con.createStatement();
- try {
- String sql = "SELECT " + pkGeneratingSequenceName + ".nextval FROM DUAL";
- QueryLogger.logQuery(sql, Collections.EMPTY_LIST);
- ResultSet rs = st.executeQuery(sql);
- try {
- // Object pk = null;
- if (!rs.next()) {
- throw new CayenneRuntimeException(
- "Error generating pk for DbEntity " + ent.getName());
- }
- return rs.getInt(1);
- }
- finally {
- rs.close();
- }
- }
- finally {
- st.close();
- }
- }
- finally {
- con.close();
- }
- }
-
protected int pkCacheSize(DbEntity entity) {
// use custom generator if possible
DbKeyGenerator keyGenerator = entity.getPrimaryKeyGenerator();
@@ -274,12 +217,13 @@
/** Returns expected primary key sequence name for a DbEntity. */
protected String sequenceName(DbEntity entity) {
boolean status;
- if(entity.getDataMap()!=null && entity.getDataMap().isQuotingSQLIdentifiers()){
- status= true;
- } else {
+ if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
+ status = true;
+ }
+ else {
status = false;
}
- QuotingStrategy context = getAdapter().getQuotingStrategy(status);
+ QuotingStrategy context = getAdapter().getQuotingStrategy(status);
// use custom generator if possible
DbKeyGenerator keyGenerator = entity.getPrimaryKeyGenerator();
@@ -295,11 +239,13 @@
if (entity.getSchema() != null && entity.getSchema().length() > 0) {
- seqName = context.quoteString(entity.getSchema()) + "." +
- context.quoteString(seqName);
- } else {
+ seqName = context.quoteString(entity.getSchema())
+ + "."
+ + context.quoteString(seqName);
+ }
+ else {
seqName = context.quoteString(seqName);
- }
+ }
return seqName;
}
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java Mon Nov 16 22:06:17 2009
@@ -41,17 +41,10 @@
*/
public class PostgresPkGenerator extends OraclePkGenerator {
- /**
- * @deprecated since 3.0
- */
- protected PostgresPkGenerator() {
- super();
- }
-
protected PostgresPkGenerator(JdbcAdapter adapter) {
super(adapter);
}
-
+
@Override
protected String createSequenceString(DbEntity ent) {
// note that PostgreSQL 7.4 and newer supports INCREMENT BY and START WITH
@@ -112,68 +105,20 @@
}
/**
- * Generates primary key by calling Oracle sequence corresponding to the
- * <code>dbEntity</code>. Executed SQL looks like this:
- *
- * <pre>
- * SELECT nextval(pk_table_name)
- * </pre>
- *
- * @deprecated since 3.0
- */
- @Override
- protected int pkFromDatabase(DataNode node, DbEntity ent) throws Exception {
-
- DbKeyGenerator pkGenerator = ent.getPrimaryKeyGenerator();
- String pkGeneratingSequenceName;
- if (pkGenerator != null
- && DbKeyGenerator.ORACLE_TYPE.equals(pkGenerator.getGeneratorType())
- && pkGenerator.getGeneratorName() != null)
- pkGeneratingSequenceName = pkGenerator.getGeneratorName();
- else
- pkGeneratingSequenceName = sequenceName(ent);
-
- Connection con = node.getDataSource().getConnection();
- try {
- Statement st = con.createStatement();
- try {
- String sql = "SELECT nextval('" + pkGeneratingSequenceName + "')";
- QueryLogger.logQuery(sql, Collections.EMPTY_LIST);
- ResultSet rs = st.executeQuery(sql);
- try {
- // Object pk = null;
- if (!rs.next()) {
- throw new CayenneRuntimeException(
- "Error generating pk for DbEntity " + ent.getName());
- }
- return rs.getInt(1);
- }
- finally {
- rs.close();
- }
- }
- finally {
- st.close();
- }
- }
- finally {
- con.close();
- }
- }
-
- /**
* Fetches a list of existing sequences that might match Cayenne generated ones.
*/
@Override
protected List<String> getExistingSequences(DataNode node) throws SQLException {
boolean status;
- if(node.getDataMap(node.getName())!=null && node.getDataMap(node.getName()).isQuotingSQLIdentifiers()){
- status= true;
- } else {
+ if (node.getDataMap(node.getName()) != null
+ && node.getDataMap(node.getName()).isQuotingSQLIdentifiers()) {
+ status = true;
+ }
+ else {
status = false;
}
- QuotingStrategy context = getAdapter().getQuotingStrategy(status);
+ QuotingStrategy context = getAdapter().getQuotingStrategy(status);
// check existing sequences
Connection con = node.getDataSource().getConnection();
@@ -186,7 +131,7 @@
ResultSet rs = sel.executeQuery(sql);
try {
List<String> sequenceList = new ArrayList<String>();
- while (rs.next()) {
+ while (rs.next()) {
sequenceList.add(context.quoteString(rs.getString(1)));
}
return sequenceList;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseAdapter.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseAdapter.java Mon Nov 16 22:06:17 2009
@@ -33,25 +33,23 @@
import org.apache.cayenne.dba.PkGenerator;
import org.apache.cayenne.merge.MergerFactory;
-/**
+/**
* DbAdapter implementation for <a href="http://www.sybase.com">Sybase RDBMS</a>.
- *
*/
public class SybaseAdapter extends JdbcAdapter {
final static String MYSQL_QUOTE_SQL_IDENTIFIERS_CHAR_START = "[";
final static String MYSQL_QUOTE_SQL_IDENTIFIERS_CHAR_END = "]";
-
+
/**
- *
- * @since 3.0
- */
+ * @since 3.0
+ */
@Override
- public void initIdentifiersQuotes(){
+ public void initIdentifiersQuotes() {
this.identifiersStartQuote = MYSQL_QUOTE_SQL_IDENTIFIERS_CHAR_START;
this.identifiersEndQuote = MYSQL_QUOTE_SQL_IDENTIFIERS_CHAR_END;
}
-
+
/**
* @since 3.0
*/
@@ -59,7 +57,7 @@
protected EJBQLTranslatorFactory createEJBQLTranslatorFactory() {
return new SybaseEJBQLTranslatorFactory();
}
-
+
/**
* Returns word "go".
*
@@ -69,10 +67,10 @@
public String getBatchTerminator() {
return "go";
}
-
+
/**
- * Installs appropriate ExtendedTypes as converters for passing values
- * between JDBC and Java layers.
+ * Installs appropriate ExtendedTypes as converters for passing values between JDBC
+ * and Java layers.
*/
@Override
protected void configureExtendedTypes(ExtendedTypeMap map) {
@@ -89,24 +87,22 @@
map.registerType(new ByteType(true));
}
- /**
- * Creates and returns a primary key generator.
- * Overrides superclass implementation to return an
- * instance of SybasePkGenerator.
+ /**
+ * Creates and returns a primary key generator. Overrides superclass implementation to
+ * return an instance of SybasePkGenerator.
*/
@Override
protected PkGenerator createPkGenerator() {
- return new SybasePkGenerator();
+ return new SybasePkGenerator(this);
}
@Override
public void bindParameter(
- PreparedStatement statement,
- Object object,
- int pos,
- int sqlType,
- int precision)
- throws SQLException, Exception {
+ PreparedStatement statement,
+ Object object,
+ int pos,
+ int sqlType,
+ int precision) throws SQLException, Exception {
// Sybase driver doesn't like CLOBs and BLOBs as parameters
if (object == null) {
@@ -117,15 +113,15 @@
sqlType = Types.VARBINARY;
}
}
-
- if (object == null && sqlType==0) {
+
+ if (object == null && sqlType == 0) {
statement.setNull(pos, Types.VARCHAR);
}
else {
super.bindParameter(statement, object, pos, sqlType, precision);
}
}
-
+
@Override
public MergerFactory mergerFactory() {
return new SybaseMergerFactory();
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybasePkGenerator.java Mon Nov 16 22:06:17 2009
@@ -36,21 +36,13 @@
* Primary key generator implementation for Sybase. Uses a lookup table named
* "AUTO_PK_SUPPORT" and a stored procedure "auto_pk_for_table" to search and increment
* primary keys for tables.
- *
*/
public class SybasePkGenerator extends JdbcPkGenerator {
-
- /**
- * @deprecated since 3.0
- */
- protected SybasePkGenerator() {
- super();
- }
-
+
protected SybasePkGenerator(JdbcAdapter adapter) {
super(adapter);
}
-
+
@Override
protected String pkTableCreateString() {
StringBuilder buf = new StringBuilder();
@@ -77,7 +69,6 @@
* NEXT_ID DECIMAL(19,0) NOT NULL
* )
* </pre>
- *
* <p>
* 2. Executed under any circumstances.
* </p>
@@ -88,19 +79,18 @@
* DROP PROCEDURE auto_pk_for_table
* END
* </pre>
- *
* <p>
* 3. Executed under any circumstances.
* </p>
* CREATE PROCEDURE auto_pk_for_table
*
* <pre>
- * @tname VARCHAR(32),
- * @pkbatchsize INT AS BEGIN BEGIN TRANSACTION UPDATE AUTO_PK_SUPPORT set NEXT_ID =
+ * @tname VARCHAR(32),
+ * @pkbatchsize INT AS BEGIN BEGIN TRANSACTION UPDATE AUTO_PK_SUPPORT set NEXT_ID =
* NEXT_ID +
- * @pkbatchsize WHERE TABLE_NAME =
- * @tname SELECT NEXT_ID from AUTO_PK_SUPPORT where NEXT_ID =
- * @tname COMMIT END
+ * @pkbatchsize WHERE TABLE_NAME =
+ * @tname SELECT NEXT_ID from AUTO_PK_SUPPORT where NEXT_ID =
+ * @tname COMMIT END
* </pre>
*
* @param node node that provides access to a DataSource.
@@ -224,72 +214,6 @@
}
}
- /**
- * @deprecated since 3.0
- */
- @Override
- protected int pkFromDatabase(DataNode node, DbEntity ent) throws Exception {
- // handle CAY-588 - get connection that is separate from the connection in the
- // current transaction.
-
- // TODO (andrus, 7/6/2006) Note that this will still work in a pool with a single
- // connection, as PK generator is invoked early in the transaction, before the
- // connection is grabbed for commit... So maybe promote this to other adapters in
- // 3.0?
-
- Transaction transaction = Transaction.getThreadTransaction();
- Transaction.bindThreadTransaction(null);
-
- try {
-
- Connection connection = node.getDataSource().getConnection();
- try {
- CallableStatement statement = connection
- .prepareCall("{call auto_pk_for_table(?, ?)}");
- try {
- statement.setString(1, ent.getName());
- statement.setInt(2, super.getPkCacheSize());
-
- // can't use "executeQuery"
- // per http://jtds.sourceforge.net/faq.html#expectingResultSet
- statement.execute();
- if (statement.getMoreResults()) {
- ResultSet rs = statement.getResultSet();
-
- try {
- if (rs.next()) {
- return rs.getInt(1);
- }
- else {
- throw new CayenneRuntimeException(
- "Error generating pk for DbEntity "
- + ent.getName());
- }
- }
- finally {
- rs.close();
- }
- }
- else {
- throw new CayenneRuntimeException(
- "Error generating pk for DbEntity "
- + ent.getName()
- + ", no result set from stored procedure.");
- }
- }
- finally {
- statement.close();
- }
- }
- finally {
- connection.close();
- }
- }
- finally {
- Transaction.bindThreadTransaction(transaction);
- }
- }
-
private String safePkTableDrop() {
StringBuilder buf = new StringBuilder();
buf
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/EventManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/EventManager.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/EventManager.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/EventManager.java Mon Nov 16 22:06:17 2009
@@ -34,12 +34,9 @@
* This class acts as bridge between an Object that wants to inform others about its
* current state or a change thereof (Publisher) and a list of objects interested in the
* Subject (Listeners).
- *
*/
public class EventManager {
- private static volatile EventManager defaultManager;
-
public static final int DEFAULT_DISPATCH_THREAD_COUNT = 5;
// keeps weak references to subjects
@@ -50,26 +47,6 @@
List<DispatchThread> dispatchThreads;
/**
- * Returns the shared EventManager. It is created on demand on the first call to this
- * method. Cayenne internally doesn't use default EventManager. Instead Configuration
- * EventManager is propagated to DataDomains and DataContexts.
- *
- * @return EventManager the shared EventManager instance
- * @deprecated since 3.0 users should create their own instances of EventManager using
- * constructor and share them as appropriate for their target use.
- */
- public static EventManager getDefaultManager() {
- if (defaultManager == null) {
- synchronized (EventManager.class) {
- if (defaultManager == null) {
- defaultManager = new EventManager(2);
- }
- }
- }
- return defaultManager;
- }
-
- /**
* Creates a multithreaded EventManager using default thread count.
*/
public EventManager() {
@@ -286,8 +263,8 @@
*
* @param listener the object to be unregistered
* @param subject the subject from which the listener is to be unregistered
- * @return <code>true</code> if <code>listener</code> could be removed for the
- * given subject, else returns <code>false</code>.
+ * @return <code>true</code> if <code>listener</code> could be removed for the given
+ * subject, else returns <code>false</code>.
*/
public boolean removeListener(Object listener, EventSubject subject) {
return this.removeListener(listener, subject, null);
@@ -301,8 +278,8 @@
* @param subject the subject from which the listener is to be unregistered
* @param sender the object whose events the listener was interested in;
* <code>null</code> means 'any sender'.
- * @return <code>true</code> if <code>listener</code> could be removed for the
- * given subject, else returns <code>false</code>.
+ * @return <code>true</code> if <code>listener</code> could be removed for the given
+ * subject, else returns <code>false</code>.
*/
public boolean removeListener(Object listener, EventSubject subject, Object sender) {
if (listener == null || subject == null) {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java Mon Nov 16 22:06:17 2009
@@ -30,11 +30,9 @@
import java.util.SortedMap;
import java.util.TreeMap;
-import org.apache.cayenne.map.event.AttributeEvent;
import org.apache.cayenne.map.event.DbEntityListener;
import org.apache.cayenne.map.event.EntityEvent;
import org.apache.cayenne.map.event.ObjEntityListener;
-import org.apache.cayenne.map.event.RelationshipEvent;
import org.apache.cayenne.project.Project;
import org.apache.cayenne.query.NamedQuery;
import org.apache.cayenne.query.Query;
@@ -1186,72 +1184,6 @@
}
/**
- * Attribute property changed.
- *
- * @deprecated since 3.0 DataMap no longer implements DbAttributeListener
- */
- @Deprecated
- public void dbAttributeChanged(AttributeEvent e) {
- Entity entity = e.getEntity();
- if (entity instanceof DbEntity) {
- ((DbEntity) entity).dbAttributeChanged(e);
- }
- }
-
- /**
- * New attribute has been created/added.
- *
- * @deprecated since 3.0 DataMap no longer implements DbAttributeListener
- */
- @Deprecated
- public void dbAttributeAdded(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * Attribute has been removed.
- *
- * @deprecated since 3.0 DataMap no longer implements DbAttributeListener
- */
- @Deprecated
- public void dbAttributeRemoved(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship property changed.
- *
- * @deprecated since 3.0 DataMap no longer implements DbRelationshipListener
- */
- @Deprecated
- public void dbRelationshipChanged(RelationshipEvent e) {
- Entity entity = e.getEntity();
- if (entity instanceof DbEntity) {
- ((DbEntity) entity).dbRelationshipChanged(e);
- }
- }
-
- /**
- * Relationship has been created/added.
- *
- * @deprecated since 3.0 DataMap no longer implements DbRelationshipListener
- */
- @Deprecated
- public void dbRelationshipAdded(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship has been removed.
- *
- * @deprecated since 3.0 DataMap no longer implements DbRelationshipListener
- */
- @Deprecated
- public void dbRelationshipRemoved(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
* ObjEntity property changed. May be name, attribute or relationship added or
* removed, etc. Attribute and relationship property changes are handled in respective
* listeners.
@@ -1292,64 +1224,4 @@
public void objEntityRemoved(EntityEvent e) {
// does nothing currently
}
-
- /**
- * Attribute property changed.
- *
- * @deprecated since 3.0 DataMap no longer implements ObjAttributeListener
- */
- @Deprecated
- public void objAttributeChanged(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * New attribute has been created/added.
- *
- * @deprecated since 3.0 DataMap no longer implements ObjAttributeListener
- */
- @Deprecated
- public void objAttributeAdded(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * Attribute has been removed.
- *
- * @deprecated since 3.0 DataMap no longer implements ObjAttributeListener
- */
- @Deprecated
- public void objAttributeRemoved(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship property changed.
- *
- * @deprecated since 3.0 DataMap no longer implements ObjRelationshipListener
- */
- @Deprecated
- public void objRelationshipChanged(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship has been created/added.
- *
- * @deprecated since 3.0 DataMap no longer implements ObjRelationshipListener
- */
- @Deprecated
- public void objRelationshipAdded(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship has been removed.
- *
- * @deprecated since 3.0 DataMap no longer implements ObjRelationshipListener
- */
- @Deprecated
- public void objRelationshipRemoved(RelationshipEvent e) {
- // does nothing currently
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbAttribute.java Mon Nov 16 22:06:17 2009
@@ -226,24 +226,6 @@
}
/**
- * Returns the number of digits after period for DECIMAL.
- *
- * @deprecated since 3.0 as this property really referred to 'scale'. Use
- * {@link #getScale()} instead.
- */
- public int getPrecision() {
- return getScale();
- }
-
- /**
- * @deprecated since 3.0 as this property really referred to 'scale'. Use
- * {@link #setScale(int)} instead.
- */
- public void setPrecision(int i) {
- setScale(i);
- }
-
- /**
* Returns true if this column value is generated by the database. Other terms for
* such columns are "auto-increment" or "identity".
*
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java Mon Nov 16 22:06:17 2009
@@ -173,14 +173,6 @@
}
/**
- * @deprecated since 3.0 use {@link #getPrimaryKeys()} that returns a collection.
- */
- @Deprecated
- public List<DbAttribute> getPrimaryKey() {
- return new ArrayList<DbAttribute>(getPrimaryKeys());
- }
-
- /**
* Returns a Collection of all attributes that either belong to this DbEntity or
* inherited.
*/
@@ -214,19 +206,6 @@
}
/**
- * Overrides super to fire an AttributeEvent.
- *
- * @deprecated in favour of {@link #addAttribute(DbAttribute attr)}. Scheduled for
- * removal in Cayenne 4.
- */
- @Override
- @Deprecated
- public void addAttribute(Attribute attr) {
- super.addAttribute(attr);
- this.dbAttributeAdded(new AttributeEvent(this, attr, this, MapEvent.ADD));
- }
-
- /**
* Removes attribute from the entity, removes any relationship joins containing this
* attribute. Does nothing if the attribute name is not found.
*
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbRelationship.java Mon Nov 16 22:06:17 2009
@@ -27,9 +27,6 @@
import java.util.Map;
import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.event.EventManager;
-import org.apache.cayenne.event.EventSubject;
-import org.apache.cayenne.map.event.RelationshipEvent;
import org.apache.cayenne.util.Util;
import org.apache.cayenne.util.XMLEncoder;
import org.apache.commons.collections.CollectionUtils;
@@ -38,17 +35,9 @@
/**
* A DbRelationship is a descriptor of a database inter-table relationship based on one or
* more primary key/foreign key pairs.
- *
*/
public class DbRelationship extends Relationship {
- /**
- * @deprecated since 3.0 - unused
- */
- public static final EventSubject PROPERTY_DID_CHANGE = EventSubject.getSubject(
- DbRelationship.class,
- "PropertyDidChange");
-
// The columns through which the join is implemented.
protected List<DbJoin> joins = new ArrayList<DbJoin>(2);
@@ -227,7 +216,7 @@
*/
public boolean isToPK() {
for (DbJoin join : getJoins()) {
-
+
DbAttribute target = join.getTarget();
if (target == null) {
return false;
@@ -240,7 +229,7 @@
return false;
}
-
+
/**
* @since 3.0
*/
@@ -273,9 +262,9 @@
}
/**
- * Returns <code>true</code> if relationship from source to target points to
- * dependent primary key. Dependent PK is a primary key column of the destination
- * table that is also a FK to the source column.
+ * Returns <code>true</code> if relationship from source to target points to dependent
+ * primary key. Dependent PK is a primary key column of the destination table that is
+ * also a FK to the source column.
*/
public boolean isToDependentPK() {
return toDependentPK;
@@ -473,15 +462,6 @@
this.toMany = toMany;
}
- /**
- * @deprecated since 3.0 - unused.
- */
- protected void firePropertyDidChange() {
- RelationshipEvent event = new RelationshipEvent(this, this, this
- .getSourceEntity());
- EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
- }
-
final static class JoinTransformers {
static final Transformer targetExtractor = new Transformer() {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java Mon Nov 16 22:06:17 2009
@@ -114,7 +114,7 @@
fullName,
embeddableAttribute.getType(),
(ObjEntity) getEntity());
- oa.setDbAttributeName(dbPath);
+ oa.setDbAttributePath(dbPath);
return oa;
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java Mon Nov 16 22:06:17 2009
@@ -283,28 +283,6 @@
String relationshipPath);
/**
- * Convenience method returning the last component in the path iterator, either an
- * {@link ObjAttribute} or an {@link ObjRelationship}.
- *
- * @since 1.1
- * @deprecated since 3.0 use {@link #lastPathComponent(Expression, Map)} method that
- * supports aliases.
- */
- @Deprecated
- public Object lastPathComponent(Expression path) {
-
- PathComponent<Attribute, Relationship> last = lastPathComponent(
- path,
- Collections.EMPTY_MAP);
- if (last != null) {
- return last.getAttribute() != null ? last.getAttribute() : last
- .getRelationship();
- }
-
- return null;
- }
-
- /**
* Convenience method returning the last component in the path iterator. If the last
* component is an alias, it is fully resolved down to the last ObjRelationship.
*
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java Mon Nov 16 22:06:17 2009
@@ -651,31 +651,6 @@
}
/**
- * Looks in the DataMap's that this object was created with for the DbEntity that
- * services the specified class
- *
- * @return the required DbEntity, or null if none matches the specifier
- * @deprecated since 3.0 - lookup DbEntity via ObjEntity instead.
- */
- @Deprecated
- public synchronized DbEntity lookupDbEntity(Class<?> aClass) {
- ObjEntity oe = lookupObjEntity(aClass);
- return oe != null ? oe.getDbEntity() : null;
- }
-
- /**
- * Looks in the DataMap's that this object was created with for the DbEntity that
- * services the specified data Object
- *
- * @return the required DbEntity, or null if none matches the specifier
- * @deprecated since 3.0 - lookup DbEntity via ObjEntity instead.
- */
- @Deprecated
- public synchronized DbEntity lookupDbEntity(Persistent dataObject) {
- return lookupDbEntity(dataObject.getClass());
- }
-
- /**
* Returns EntityInheritanceTree representing inheritance hierarchy that starts with a
* given ObjEntity as root, and includes all its subentities. If ObjEntity has no
* known subentities, null is returned.
@@ -747,18 +722,6 @@
return lookupObjEntity(object.getClass());
}
- /**
- * Looks in the DataMap's that this object was created with for the ObjEntity that
- * maps to the services the class with the given name
- *
- * @return the required ObjEntity or null if there is none that matches the specifier
- * @deprecated since 3.0 - use getObjEntity() instead.
- */
- @Deprecated
- public synchronized ObjEntity lookupObjEntity(String entityName) {
- return _lookupObjEntity(entityName);
- }
-
public Procedure lookupProcedure(Query q) {
return q.getMetaData(this).getProcedure();
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java Mon Nov 16 22:06:17 2009
@@ -821,17 +821,6 @@
}
/**
- * Creates, configures and returns ResourceLocator object used to lookup DataMap
- * files.
- *
- * @deprecated since 3.0 use {@link #createResourceFinder()}.
- */
- @Deprecated
- protected ResourceLocator configLocator() {
- return (ResourceLocator) createResourceFinder();
- }
-
- /**
* Creates, configures and returns a default ResourceFinder.
*
* @since 3.0
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjAttribute.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjAttribute.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjAttribute.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjAttribute.java Mon Nov 16 22:06:17 2009
@@ -29,7 +29,6 @@
/**
* An ObjAttribute is a mapping descriptor of a Java class property.
- *
*/
public class ObjAttribute extends Attribute {
@@ -245,22 +244,6 @@
}
/**
- * Set mapped DbAttribute.
- *
- * @deprecated since 3.0 - this method only works for non-flattened attributes.
- * 'setDbAttributePath' should be used instead.
- */
- @Deprecated
- public void setDbAttribute(DbAttribute dbAttribute) {
- if (dbAttribute == null) {
- setDbAttributePath(null);
- }
- else {
- setDbAttributePath(dbAttribute.getName());
- }
- }
-
- /**
* Returns the the name of the mapped DbAttribute. This value is the same as
* "dbAttributePath" for regular attributes mapped to columns. It is equql to the last
* path component for the flattened attributes.
@@ -278,16 +261,6 @@
return dbAttributePath.substring(lastDot + 1);
}
- /**
- * Sets the name of the mapped DbAttribute.
- *
- * @deprecated since 3.0 use {@link #setDbAttributePath(String)}.
- */
- @Deprecated
- public void setDbAttributeName(String name) {
- setDbAttributePath(name);
- }
-
public void setDbAttributePath(String dbAttributePath) {
this.dbAttributePath = dbAttributePath;
@@ -306,14 +279,6 @@
}
/**
- * @deprecated since 3.0 use 'isFlattened'.
- */
- @Deprecated
- public boolean isCompound() {
- return isFlattened();
- }
-
- /**
* Returns whether this attribute is "flattened", meaning that it points to a column
* from an entity other than the DbEntity mapped to the parent ObjEntity.
*
@@ -322,18 +287,20 @@
public boolean isFlattened() {
return dbAttributePath != null && dbAttributePath.indexOf('.') >= 0;
}
-
+
/**
* Returns whether this attribute is mandatory
+ *
* @see DbAttribute#isMandatory()
*/
public boolean isMandatory() {
DbAttribute dbAttribute = getDbAttribute();
return dbAttribute == null ? false : dbAttribute.isMandatory();
}
-
+
/**
* Returns this attribute's maximum allowed length
+ *
* @see DbAttribute#getMaxLength()
*/
public int getMaxLength() {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java Mon Nov 16 22:06:17 2009
@@ -34,10 +34,8 @@
import org.apache.cayenne.exp.Expression;
import org.apache.cayenne.exp.ExpressionException;
import org.apache.cayenne.exp.ExpressionFactory;
-import org.apache.cayenne.map.event.AttributeEvent;
import org.apache.cayenne.map.event.EntityEvent;
import org.apache.cayenne.map.event.ObjEntityListener;
-import org.apache.cayenne.map.event.RelationshipEvent;
import org.apache.cayenne.util.CayenneMapEntry;
import org.apache.cayenne.util.NameConverter;
import org.apache.cayenne.util.Util;
@@ -1205,66 +1203,6 @@
}
/**
- * Attribute property changed.
- *
- * @deprecated since 3.0 ObjEntity no longer implements ObjAttributeListener
- */
- @Deprecated
- public void objAttributeChanged(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * New attribute has been created/added.
- *
- * @deprecated since 3.0 ObjEntity no longer implements ObjAttributeListener
- */
- @Deprecated
- public void objAttributeAdded(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * Attribute has been removed.
- *
- * @deprecated since 3.0 ObjEntity no longer implements ObjAttributeListener
- */
- @Deprecated
- public void objAttributeRemoved(AttributeEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship property changed.
- *
- * @deprecated since 3.0 ObjEntity no longer implements ObjRelationshipListener
- */
- @Deprecated
- public void objRelationshipChanged(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship has been created/added.
- *
- * @deprecated since 3.0 ObjEntity no longer implements ObjRelationshipListener
- */
- @Deprecated
- public void objRelationshipAdded(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
- * Relationship has been removed.
- *
- * @deprecated since 3.0 ObjEntity no longer implements ObjRelationshipListener
- */
- @Deprecated
- public void objRelationshipRemoved(RelationshipEvent e) {
- // does nothing currently
- }
-
- /**
* Returns true if the default lifecycle listeners should not be notified of this
* entity lifecycle events.
*
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java Mon Nov 16 22:06:17 2009
@@ -28,7 +28,6 @@
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.exp.ExpressionException;
import org.apache.cayenne.exp.parser.ASTDbPath;
-import org.apache.cayenne.map.event.RelationshipEvent;
import org.apache.cayenne.util.CayenneMapEntry;
import org.apache.cayenne.util.ToStringBuilder;
import org.apache.cayenne.util.Util;
@@ -53,10 +52,10 @@
protected boolean usedForLocking;
protected List<DbRelationship> dbRelationships = new ArrayList<DbRelationship>(2);
-
+
/**
- * Db-relationships path that is set but not yet parsed (turned into List<DbRelationship>)
- * Used during map loading
+ * Db-relationships path that is set but not yet parsed (turned into
+ * List<DbRelationship>) Used during map loading
*/
String deferredPath;
@@ -446,15 +445,6 @@
}
/**
- * @deprecated since 3.0 as ObjRelationship no longer reacts to DbRelationship events.
- */
- @Deprecated
- public void dbRelationshipDidChange(RelationshipEvent event) {
- recalculateToManyValue();
- recalculateReadOnlyValue();
- }
-
- /**
* Returns whether this attribute should be used for locking.
*
* @since 1.1
@@ -479,7 +469,7 @@
*/
public String getDbRelationshipPath() {
refreshFromDeferredPath();
-
+
// build path on the fly
if (getDbRelationships().isEmpty()) {
return null;
@@ -544,7 +534,7 @@
refreshFromPath(relationshipPath, false);
}
}
-
+
/**
* Sets relationship path, but does not trigger its conversion to List<DbRelationship>
* For internal purposes, primarily datamap loading
@@ -554,7 +544,7 @@
deferredPath = relationshipPath;
}
}
-
+
/**
* Loads path from "deferredPath" variable (if specified)
*/
@@ -634,9 +624,9 @@
}
}
catch (ExpressionException ex) {
- if (!stripInvalid) {
- throw ex;
- }
+ if (!stripInvalid) {
+ throw ex;
+ }
}
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/QueryLoader.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/QueryLoader.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/QueryLoader.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/QueryLoader.java Mon Nov 16 22:06:17 2009
@@ -28,6 +28,7 @@
import org.apache.cayenne.exp.Expression;
import org.apache.cayenne.query.Ordering;
import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.SortOrder;
/**
* A builder that constructs Cayenne queries from abstract configuration information
@@ -106,11 +107,10 @@
this.rootName = rootName;
}
- void setEjbql(String ejbql) {
- this.ejbql = ejbql;
+ void setEjbql(String ejbql) {
+ this.ejbql = ejbql;
}
-
/**
* Adds raw sql. If adapterClass parameter is not null, sets the SQL string to be
* adapter-specific. Otherwise it is used as a default SQL string.
@@ -155,7 +155,21 @@
}
boolean isDescending = "true".equalsIgnoreCase(descending);
boolean isIgnoringCase = "true".equalsIgnoreCase(ignoreCase);
- orderings.add(new Ordering(path, !isDescending, isIgnoringCase));
+
+ SortOrder order;
+
+ if (isDescending) {
+ order = isIgnoringCase
+ ? SortOrder.DESCENDING_INSENSITIVE
+ : SortOrder.DESCENDING;
+ }
+ else {
+ order = isIgnoringCase
+ ? SortOrder.ASCENDING_INSENSITIVE
+ : SortOrder.ASCENDING;
+ }
+
+ orderings.add(new Ordering(path, order));
}
void addPrefetch(String path) {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java Mon Nov 16 22:06:17 2009
@@ -111,14 +111,6 @@
return true;
}
- /**
- * @deprecated since 3.0
- */
- @Deprecated
- public boolean isResolvingInherited() {
- return true;
- }
-
public int getPageSize() {
return QueryMetadata.PAGE_SIZE_DEFAULT;
}
@@ -126,14 +118,6 @@
public int getFetchOffset() {
return -1;
}
-
- /**
- * @deprecated since 3.0
- */
- @Deprecated
- public int getFetchStartIndex() {
- return getFetchOffset();
- }
public int getFetchLimit() {
return QueryMetadata.FETCH_LIMIT_DEFAULT;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/Ordering.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/Ordering.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/Ordering.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/Ordering.java Mon Nov 16 22:06:17 2009
@@ -41,35 +41,18 @@
* DataObjects.
*/
public class Ordering implements Comparator<Object>, Serializable, XMLSerializable {
- /**
- * Symbolic representation of ascending ordering criterion.
- *
- * @deprecated Use SortOrder.ASCENDING instead.
- */
- @Deprecated
- public static final boolean ASC = true;
-
- /**
- * Symbolic representation of descending ordering criterion.
- *
- * @deprecated Use SortOrder.DESCENDING instead.
- */
- @Deprecated
- public static final boolean DESC = false;
protected String sortSpecString;
protected transient Expression sortSpec;
protected SortOrder sortOrder;
-// protected boolean ascending;
-// protected boolean caseInsensitive;
protected boolean pathExceptionSuppressed = false;
protected boolean nullSortedFirst = true;
/**
* Orders a given list of objects, using a List of Orderings applied according the
* default iteration order of the Orderings list. I.e. each Ordering with lower index
- * is more significant than any other Ordering with higher index. List being ordered is
- * modified in place.
+ * is more significant than any other Ordering with higher index. List being ordered
+ * is modified in place.
*/
public static void orderList(List<?> objects, List<Ordering> orderings) {
Collections.sort(objects, ComparatorUtils.chainedComparator(orderings));
@@ -78,11 +61,6 @@
public Ordering() {
}
- @Deprecated
- public Ordering(String sortPathSpec, boolean ascending) {
- this(sortPathSpec, ascending, false);
- }
-
/**
* @since 3.0
*/
@@ -91,29 +69,6 @@
setSortOrder(sortOrder);
}
- @Deprecated
- public Ordering(String sortPathSpec, boolean ascending, boolean caseInsensitive) {
- setSortSpecString(sortPathSpec);
- setAscending(ascending);
- setCaseInsensitive(caseInsensitive);
-// this.ascending = ascending;
-// this.caseInsensitive = caseInsensitive;
- }
-
- @Deprecated
- public Ordering(Expression sortExpression, boolean ascending) {
- this(sortExpression, ascending, false);
- }
-
- @Deprecated
- public Ordering(Expression sortExpression, boolean ascending, boolean caseInsensitive) {
- setSortSpec(sortExpression);
- setAscending(ascending);
- setCaseInsensitive(caseInsensitive);
-// this.ascending = ascending;
-// this.caseInsensitive = caseInsensitive;
- }
-
/**
* Sets sortSpec to be an expression represented by string argument.
*
@@ -125,38 +80,41 @@
this.sortSpec = null;
}
}
-
+
/**
- * Sets sort order for whether nulls are at the top or bottom of the resulting list. Default is true.
+ * Sets sort order for whether nulls are at the top or bottom of the resulting list.
+ * Default is true.
*
- * @param nullSortedFirst true sorts nulls to the top of the list, false sorts nulls to the bottom
+ * @param nullSortedFirst true sorts nulls to the top of the list, false sorts nulls
+ * to the bottom
*/
public void setNullSortedFirst(boolean nullSortedFirst) {
this.nullSortedFirst = nullSortedFirst;
}
-
- /**
+
+ /**
* Get sort order for nulls.
*
- * @return true if nulls are sorted to the top of the list, false if sorted to the bottom
+ * @return true if nulls are sorted to the top of the list, false if sorted to the
+ * bottom
*/
public boolean isNullSortedFirst() {
return nullSortedFirst;
}
-
+
/**
- * Sets whether a path with a null in the middle is ignored. For example, a sort from <code>painting</code>
- * on <code>artist.name</code> would by default throw an exception if the artist was null.
- * If set to true, then this is treated just like a null value.
- * Default is false.
+ * Sets whether a path with a null in the middle is ignored. For example, a sort from
+ * <code>painting</code> on <code>artist.name</code> would by default throw an
+ * exception if the artist was null. If set to true, then this is treated just like a
+ * null value. Default is false.
*
* @param pathExceptionSuppressed true to suppress exceptions and sort as null
*/
public void setPathExceptionSupressed(boolean pathExceptionSuppressed) {
this.pathExceptionSuppressed = pathExceptionSuppressed;
}
-
- /**
+
+ /**
* Is a path with a null in the middle is ignored.
*
* @return true is exception is suppressed and sorted as null
@@ -164,8 +122,7 @@
public boolean isPathExceptionSuppressed() {
return pathExceptionSuppressed;
}
-
-
+
/**
* Returns sortSpec string representation.
*
@@ -186,7 +143,9 @@
/** Returns true if sorting is done in ascending order. */
public boolean isAscending() {
- return sortOrder == null || sortOrder == SortOrder.ASCENDING || sortOrder == SortOrder.ASCENDING_INSENSITIVE;
+ return sortOrder == null
+ || sortOrder == SortOrder.ASCENDING
+ || sortOrder == SortOrder.ASCENDING_INSENSITIVE;
}
/**
@@ -199,21 +158,8 @@
}
/**
- * Sets <code>ascending</code> property of this Ordering.
- *
- * @deprecated Use setSortOrder() or setAscending() or setDescending().
- */
- @Deprecated
- public void setAscending(boolean ascending) {
- if (ascending)
- setAscending();
- else
- setDescending();
- }
-
- /**
- * If the sort order is DESCENDING or DESCENDING_INSENSITIVE, sets
- * the sort order to ASCENDING or ASCENDING_INSENSITIVE, respectively.
+ * If the sort order is DESCENDING or DESCENDING_INSENSITIVE, sets the sort order to
+ * ASCENDING or ASCENDING_INSENSITIVE, respectively.
*
* @since 3.0
*/
@@ -225,8 +171,8 @@
}
/**
- * If the sort order is ASCENDING or ASCENDING_INSENSITIVE, sets
- * the sort order to DESCENDING or DESCENDING_INSENSITIVE, respectively.
+ * If the sort order is ASCENDING or ASCENDING_INSENSITIVE, sets the sort order to
+ * DESCENDING or DESCENDING_INSENSITIVE, respectively.
*
* @since 3.0
*/
@@ -248,20 +194,9 @@
* @since 3.0
*/
public boolean isCaseSensitive() {
- return sortOrder == null || sortOrder == SortOrder.ASCENDING || sortOrder == SortOrder.DESCENDING;
- }
-
- /**
- * Sets <code>caseInsensitive</code> property of this Ordering.
- *
- * @deprecated Use setSortOrder() or setCaseInsensitive() or setCaseSensitive().
- */
- @Deprecated
- public void setCaseInsensitive(boolean caseInsensitive) {
- if (caseInsensitive)
- setCaseInsensitive();
- else
- setCaseSensitive();
+ return sortOrder == null
+ || sortOrder == SortOrder.ASCENDING
+ || sortOrder == SortOrder.DESCENDING;
}
/**
@@ -278,8 +213,8 @@
}
/**
- * If the sort order is ASCENDING_INSENSITIVE or DESCENDING_INSENSITIVE,
- * sets the sort order to ASCENDING or DESCENDING, respectively.
+ * If the sort order is ASCENDING_INSENSITIVE or DESCENDING_INSENSITIVE, sets the sort
+ * order to ASCENDING or DESCENDING, respectively.
*
* @since 3.0
*/
@@ -330,36 +265,44 @@
*/
public int compare(Object o1, Object o2) {
Expression exp = getSortSpec();
- Object value1 = null;
- Object value2 = null;
- try {
- value1 = exp.evaluate(o1);
- } catch (ExpressionException e) {
- if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
- //do nothing, we expect this
- } else {
- //re-throw
- throw e;
- }
- }
-
- try {
- value2 = exp.evaluate(o2);
- } catch (ExpressionException e) {
- if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
- //do nothing, we expect this
- } else {
- //rethrow
- throw e;
- }
- }
-
- if (value1 == null && value2 == null) {
- return 0;
- } else if (value1 == null) {
- return nullSortedFirst? -1:1;
- } else if (value2 == null) {
- return nullSortedFirst? 1:-1;
+ Object value1 = null;
+ Object value2 = null;
+ try {
+ value1 = exp.evaluate(o1);
+ }
+ catch (ExpressionException e) {
+ if (pathExceptionSuppressed
+ && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
+ // do nothing, we expect this
+ }
+ else {
+ // re-throw
+ throw e;
+ }
+ }
+
+ try {
+ value2 = exp.evaluate(o2);
+ }
+ catch (ExpressionException e) {
+ if (pathExceptionSuppressed
+ && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
+ // do nothing, we expect this
+ }
+ else {
+ // rethrow
+ throw e;
+ }
+ }
+
+ if (value1 == null && value2 == null) {
+ return 0;
+ }
+ else if (value1 == null) {
+ return nullSortedFirst ? -1 : 1;
+ }
+ else if (value2 == null) {
+ return nullSortedFirst ? 1 : -1;
}
if (isCaseInsensitive()) {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java Mon Nov 16 22:06:17 2009
@@ -364,42 +364,6 @@
}
/**
- * @deprecated since 3.0. With introduction of the cache strategies this setting is
- * redundant, although it is still being taken into account. It will be
- * removed in the later versions of Cayenne.
- */
- @Deprecated
- public boolean isRefreshingObjects() {
- return metaData.isRefreshingObjects();
- }
-
- /**
- * @deprecated since 3.0. With introduction of the cache strategies this setting is
- * redundant, although it is still being taken into account. It will be
- * removed in the later versions of Cayenne.
- */
- @Deprecated
- public void setRefreshingObjects(boolean flag) {
- // noop
- }
-
- /**
- * @deprecated since 3.0. Inheritance resolving is not optional anymore.
- */
- @Deprecated
- public boolean isResolvingInherited() {
- return true;
- }
-
- /**
- * @deprecated since 3.0. Inheritance resolving is not optional anymore.
- */
- @Deprecated
- public void setResolvingInherited(boolean b) {
- // noop
- }
-
- /**
* Adds a named parameter to the internal map of parameters.
*
* @since 1.1
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java Mon Nov 16 22:06:17 2009
@@ -76,7 +76,7 @@
public Procedure getProcedure() {
return info.getProcedure();
}
-
+
/**
* @since 3.0
*/
@@ -133,22 +133,10 @@
return b != null && b.booleanValue();
}
- /**
- * @deprecated since 3.0 as super is deprecated.
- */
- @Deprecated
public boolean isRefreshingObjects() {
return true;
}
- /**
- * @deprecated since 3.0 inheritance resolving is not optional.
- */
- @Deprecated
- public boolean isResolvingInherited() {
- return true;
- }
-
public int getPageSize() {
if (!overrideExists(QueryMetadata.PAGE_SIZE_PROPERTY)) {
return info.getPageSize();
@@ -161,14 +149,6 @@
public int getFetchOffset() {
return info.getFetchOffset();
}
-
- /**
- * @deprecated since 3.0
- */
- @Deprecated
- public int getFetchStartIndex() {
- return getFetchOffset();
- }
public int getFetchLimit() {
if (!overrideExists(QueryMetadata.FETCH_LIMIT_PROPERTY)) {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java Mon Nov 16 22:06:17 2009
@@ -264,9 +264,8 @@
Object columnNamesCapitalization = properties
.get(COLUMN_NAME_CAPITALIZATION_PROPERTY);
this.columnNamesCapitalization = (columnNamesCapitalization != null)
- ? CapsStrategy.valueOf(columnNamesCapitalization
- .toString()
- .toUpperCase())
+ ? CapsStrategy
+ .valueOf(columnNamesCapitalization.toString().toUpperCase())
: null;
}
@@ -386,42 +385,6 @@
}
/**
- * @deprecated since 3.0. With introduction of the cache strategies this setting is
- * redundant, although it is still being taken into account. It will be
- * removed in the later versions of Cayenne.
- */
- @Deprecated
- public boolean isRefreshingObjects() {
- return metaData.isRefreshingObjects();
- }
-
- /**
- * @deprecated since 3.0. With introduction of the cache strategies this setting is
- * redundant, although it is still being taken into account. It will be
- * removed in the later versions of Cayenne.
- */
- @Deprecated
- public void setRefreshingObjects(boolean flag) {
- // noop
- }
-
- /**
- * @deprecated since 3.0. Inheritance resolving is not optional anymore.
- */
- @Deprecated
- public boolean isResolvingInherited() {
- return true;
- }
-
- /**
- * @deprecated since 3.0. Inheritance resolving is not optional anymore.
- */
- @Deprecated
- public void setResolvingInherited(boolean b) {
- // noop
- }
-
- /**
* Returns default SQL template for this query.
*/
public String getDefaultTemplate() {
@@ -611,15 +574,16 @@
public SQLResult getResult() {
return result;
}
-
+
/**
* Sets statement's fetch size (0 for no default size)
- * @since 3.0
+ *
+ * @since 3.0
*/
public void setStatementFetchSize(int size) {
metaData.setStatementFetchSize(size);
}
-
+
/**
* @return statement's fetch size
* @since 3.0
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java?rev=880993&r1=880992&r2=880993&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java Mon Nov 16 22:06:17 2009
@@ -341,25 +341,15 @@
nonNullOrderings().addAll(orderings);
}
- /** Adds ordering specification to this query orderings. */
- @Deprecated
- public void addOrdering(String sortPathSpec, boolean isAscending) {
- addOrdering(new Ordering(sortPathSpec, isAscending));
- }
-
- /** Adds ordering specification to this query orderings. */
- @Deprecated
- public void addOrdering(String sortPathSpec, boolean isAscending, boolean ignoreCase) {
- addOrdering(new Ordering(sortPathSpec, isAscending, ignoreCase));
- }
-
/**
* Adds ordering specification to this query orderings.
+ *
* @since 3.0
*/
public void addOrdering(String sortPathSpec, SortOrder order) {
addOrdering(new Ordering(sortPathSpec, order));
}
+
/**
* Removes ordering.
*
@@ -473,30 +463,6 @@
}
/**
- * Returns refresh policy of this query. Default is <code>true</code>.
- *
- * @since 1.1
- * @deprecated since 3.0. With introduction of the cache strategies this setting is
- * redundant, although it is still being taken into account. It will be
- * removed in the later versions of Cayenne.
- */
- @Deprecated
- public boolean isRefreshingObjects() {
- return metaData.isRefreshingObjects();
- }
-
- /**
- * @since 1.1
- * @deprecated since 3.0. With introduction of the cache strategies this setting is
- * redundant, although it is still being taken into account. It will be
- * removed in the later versions of Cayenne.
- */
- @Deprecated
- public void setRefreshingObjects(boolean flag) {
- // noop
- }
-
- /**
* @since 3.0
*/
public QueryCacheStrategy getCacheStrategy() {
@@ -573,30 +539,6 @@
}
/**
- * Returns true if objects fetched via this query should be fully resolved according
- * to the inheritance hierarchy.
- *
- * @since 1.1
- * @deprecated since 3.0. Inheritance resolving is not optional anymore.
- */
- @Deprecated
- public boolean isResolvingInherited() {
- return true;
- }
-
- /**
- * Sets whether the objects fetched via this query should be fully resolved according
- * to the inheritance hierarchy.
- *
- * @since 1.1
- * @deprecated since 3.0. Inheritance resolving is not optional anymore.
- */
- @Deprecated
- public void setResolvingInherited(boolean b) {
- // noop
- }
-
- /**
* Returns a list that internally stores orderings, creating it on demand.
*
* @since 1.2