Author: aadamchik
Date: Mon May 25 06:51:01 2009
New Revision: 778308
URL: http://svn.apache.org/viewvc?rev=778308&view=rev
Log:
CAY-1224 reverse engineering partially changed schema shows empty error messge
window
Modified:
cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=778308&r1=778307&r2=778308&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Mon May 25
06:51:01 2009
@@ -8,10 +8,21 @@
http://issues.apache.org/cayenne/
----------------------------------
-Release: 3.0M6
+Release: 3.0M7
Date:
----------------------------------
+Changes/New Features Since M6:
+
+Bug Fixes Since M5:
+
+CAY-1224 reverse engineering partially changed schema shows empty error messge
window
+
+----------------------------------
+Release: 3.0M6
+Date: 25 May 2009
+----------------------------------
+
Changes/New Features Since M5:
CAY-289 Implement Quoting of identifiers
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java?rev=778308&r1=778307&r2=778308&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
Mon May 25 06:51:01 2009
@@ -354,9 +354,7 @@
public boolean loadDbEntities(DataMap map, List<? extends DbEntity> tables)
throws SQLException {
this.dbEntityList = new ArrayList<DbEntity>();
-
for (DbEntity dbEntity : tables) {
-
// Check if there already is a DbEntity under such name
// if so, consult the delegate what to do
DbEntity oldEnt = map.getDbEntity(dbEntity.getName());
@@ -461,27 +459,34 @@
// get primary keys for each table and store it in dbEntity
for (final DbEntity dbEntity : map.getDbEntities()) {
- String tableName = dbEntity.getName();
- ResultSet rs = metaData.getPrimaryKeys(null, dbEntity.getSchema(),
tableName);
-
- try {
- while (rs.next()) {
- String keyName = rs.getString(4);
- DbAttribute attribute = (DbAttribute)
dbEntity.getAttribute(keyName);
+ if (tables.contains(dbEntity)) {
+ String tableName = dbEntity.getName();
+ ResultSet rs = metaData.getPrimaryKeys(
+ null,
+ dbEntity.getSchema(),
+ tableName);
+ try {
+ while (rs.next()) {
+ String keyName = rs.getString(4);
+ DbAttribute attribute = (DbAttribute) dbEntity
+ .getAttribute(keyName);
- if (attribute != null) {
- attribute.setPrimaryKey(true);
- }
- else {
- // why an attribute might be null is not quiet clear
- // but there is a bug report 731406 indicating that it
is possible
- // so just print the warning, and ignore
- logObj.warn("Can't locate attribute for primary key: "
+ keyName);
+ if (attribute != null) {
+ attribute.setPrimaryKey(true);
+ }
+ else {
+ // why an attribute might be null is not quiet
clear
+ // but there is a bug report 731406 indicating
that it is
+ // possible
+ // so just print the warning, and ignore
+ logObj.warn("Can't locate attribute for primary
key: "
+ + keyName);
+ }
}
}
- }
- finally {
- rs.close();
+ finally {
+ rs.close();
+ }
}
}
@@ -665,14 +670,19 @@
continue;
}
- forwardRelationship.addJoin(new DbJoin(
- forwardRelationship,
- pkName,
- fkName));
- reverseRelationship.addJoin(new DbJoin(
- reverseRelationship,
- fkName,
- pkName));
+ if (forwardRelationship != null) {
+ forwardRelationship.addJoin(new DbJoin(
+ forwardRelationship,
+ pkName,
+ fkName));
+ }
+ if (reverseRelationship != null) {
+ reverseRelationship.addJoin(new DbJoin(
+ reverseRelationship,
+ fkName,
+ pkName));
+ }
+
}
} while (rs.next());