svn commit: r449144 - /incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml

2006-09-22 Thread pcl
Author: pcl
Date: Fri Sep 22 18:57:05 2006
New Revision: 449144

URL: http://svn.apache.org/viewvc?view=rev&rev=449144
Log:
removed erroneous docs about GeneratedValue

Modified:
incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml

Modified: 
incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml?view=diff&rev=449144&r1=449143&r2=449144
==
--- 
incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml 
(original)
+++ 
incubator/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_meta.xml 
Fri Sep 22 18:57:05 2006
@@ -750,8 +750,7 @@
 Id annotation. It is often convenient to allow the
 persistence implementation to assign a unique value to your identity fields
 automatically. JPA includes the the GeneratedValue
-annotation for this purpose. You can only apply the  GeneratedValue
- annotation to numeric fields. It has the following properties:
+annotation for this purpose. It has the following properties:
 
 
 




svn commit: r449130 - /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java

2006-09-22 Thread mprudhom
Author: mprudhom
Date: Fri Sep 22 17:04:51 2006
New Revision: 449130

URL: http://svn.apache.org/viewvc?view=rev&rev=449130
Log:
Use the escape character to escape out wildcard characters from the source 
string.

Modified:

incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java

Modified: 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java?view=diff&rev=449130&r1=449129&r2=449130
==
--- 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
 Fri Sep 22 17:04:51 2006
@@ -95,8 +95,12 @@
 // create a DB wildcard string by replacing the
 // multi token (e.g., '.*') and the single token (e.g., ".")
 // with '%' and '.' with '_'
-str = Strings.replace(str, _multi, "%");
-str = Strings.replace(str, _single, "_");
+String[] parts;
+StringBuffer repbuf;
+
+str = replaceEscape(str, _multi, "%", _escape);
+str = replaceEscape(str, _single, "_", _escape);
+
 buf.append(" LIKE ").appendValue(str, col);
 
 // escape out characters by using the database's escape sequence
@@ -104,6 +108,39 @@
 buf.append(" ESCAPE '").append(_escape).append("'");
 }
 sel.append(buf, state.joins);
+}
+
+/** 
+ * Perform a string replacement with simplistic escape handing. 
+ *  
+ * @param  str  the source string
+ * @param  from the string to find
+ * @param  to   the string to replace
+ * @param  escape   the string to use to escape replacement
+ * @return  the replaced string
+ */
+private static String replaceEscape(String str, String from, String to,
+String escape) {
+String[] parts = Strings.split(str, from, Integer.MAX_VALUE);
+StringBuffer repbuf = new StringBuffer();
+for (int i = 0; parts != null && i < parts.length; i++) {
+if (i > 0) {
+// if the previous part ended with an escape character, then
+// escape the character and remove the previous escape;
+// this doesn't support any double-escaping or other more
+// sophisticated features
+if (parts[i - 1].endsWith(escape)) {
+repbuf.setLength(repbuf.length() - 1);
+repbuf.append(from);
+}
+else {
+repbuf.append(to);
+}
+}
+repbuf.append(parts[i]);
+}
+
+return repbuf.toString();
 }
 
 public void selectColumns(Select sel, ExpContext ctx, ExpState state, 




svn commit: r449105 - in /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc: kernel/exps/PCPath.java kernel/exps/SelectConstructor.java kernel/exps/Val.java sql/SelectImpl.jav

2006-09-22 Thread awhite
Author: awhite
Date: Fri Sep 22 15:06:06 2006
New Revision: 449105

URL: http://svn.apache.org/viewvc?view=rev&rev=449105
Log:
When selecting a relation field as a projection, outer join across the relation
even if forceOuter on the original path is false.


Modified:

incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java

incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java

incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java

incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java

Modified: 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java?view=diff&rev=449105&r1=449104&r2=449105
==
--- 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
 Fri Sep 22 15:06:06 2006
@@ -415,7 +415,8 @@
 traverseField(pstate, key, forceOuter, true);
 pstate.joinedRel = false;
 if ((flags & JOIN_REL) != 0)
-joinRelation(pstate, key, forceOuter, false);
+joinRelation(pstate, key, forceOuter || (flags & FORCE_OUTER) != 0,
+false);
 return pstate;
 }
 

Modified: 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java?view=diff&rev=449105&r1=449104&r2=449105
==
--- 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
 Fri Sep 22 15:06:06 2006
@@ -194,7 +194,7 @@
 // have to join through to related type for pc object 
 // projections; this ensures that we have all our joins cached
 state.projections[i] = resultVal.initialize(sel, ctx, 
-Val.JOIN_REL);
+Val.JOIN_REL | Val.FORCE_OUTER);
 joins = sel.and(joins, state.projections[i].joins);
 }
 }

Modified: 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java?view=diff&rev=449105&r1=449104&r2=449105
==
--- 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
 Fri Sep 22 15:06:06 2006
@@ -38,12 +38,18 @@
 /**
  * Initialization flag indicating that this value will be compared to null.
  */
-public final int NULL_CMP = 1;
+public final int NULL_CMP = 2 << 0;
 
 /**
  * Initialization flag indicating to join into any relation path.
  */
-public final int JOIN_REL = 2; 
+public final int JOIN_REL = 2 << 1; 
+
+/**
+ * Initialization flag indicating to force an outer join into any relation 
+ * path.
+ */
+public final int FORCE_OUTER = 2 << 2; 
 
 /**
  * Initialize the value. This method should recursively initialize any

Modified: 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?view=diff&rev=449105&r1=449104&r2=449105
==
--- 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
 Fri Sep 22 15:06:06 2006
@@ -2258,8 +2258,7 @@
 return FROM_SELECT_ALIAS + "." + alias + "_" + col;
 return alias + "_" + col;
 }
-alias = _sel.toAlias(_sel.getTableIndex(col.getTable(), pj,
-false));
+alias = _sel.toAlias(_sel.getTableIndex(col.getTable(), pj, 
false));
 return (alias == null) ? null : alias + "." + col;
 }
 




svn commit: r449048 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java

2006-09-22 Thread awhite
Author: awhite
Date: Fri Sep 22 11:51:23 2006
New Revision: 449048

URL: http://svn.apache.org/viewvc?view=rev&rev=449048
Log:
Version number fixes.


Modified:

incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java

Modified: 
incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java?view=diff&rev=449048&r1=449047&r2=449048
==
--- 
incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
 Fri Sep 22 11:51:23 2006
@@ -46,7 +46,7 @@
 
 /**
  * Whether to interpret quoted numbers in query strings as numbers.
- * OpenJPA versions 3.1 and prior treated them as numbers; more recent
+ * OpenJPA versions 0.3.1 and prior treated them as numbers; more recent
  * versions treat them as strings.
  */
 public boolean getQuotedNumbersInQueries() {
@@ -55,7 +55,7 @@
 
 /**
  * Whether to interpret quoted numbers in query strings as numbers.
- * OpenJPA versions 3.1 and prior treated them as numbers; more recent
+ * OpenJPA versions 0.3.1 and prior treated them as numbers; more recent
  * versions treat them as strings.
  */
 public void setQuotedNumbersInQueries(boolean quotedNumbers) {
@@ -65,8 +65,8 @@
 /**
  * Whether to return hollow instances to broker lookups with a
  * validate parameter of false. OpenJPA versions prior to
- * 4.0 did not return hollow instances without special configuration
- * (the ObjectLookupMode). Beginning with 4.0, hollow
+ * 0.4.0 did not return hollow instances without special configuration
+ * (the ObjectLookupMode). Beginning with 0.4.0, hollow
  * objects are the default.
  */
 public boolean getValidateFalseReturnsHollow() {
@@ -76,8 +76,8 @@
 /**
  * Whether to return hollow instances to broker lookups with a
  * validate parameter of false. OpenJPA versions prior to
- * 4.0 did not return hollow instances without special configuration
- * (the ObjectLookupMode). Beginning with 4.0, hollow
+ * 0.4.0 did not return hollow instances without special configuration
+ * (the ObjectLookupMode). Beginning with 0.4.0, hollow
  * objects are the default.
  */
 public void setValidateFalseReturnsHollow(boolean hollow) {
@@ -87,7 +87,7 @@
 /**
  * Whether to check the datastore for the existence of a nontransactional
  * cached object in broker lookups with a validate parameter
- * of true. OpenJPA versions prior to 4.0 checked the datastore.
+ * of true. OpenJPA versions prior to 0.4.0 checked the datastore.
  */
 public boolean getValidateTrueChecksStore() {
 return _checkStore;
@@ -96,7 +96,7 @@
 /**
  * Whether to check the datastore for the existence of a nontransactional
  * cached object in broker lookups with a validate parameter
- * of true. OpenJPA versions prior to 4.0 checked the datastore.
+ * of true. OpenJPA versions prior to 0.4.0 checked the datastore.
  */
 public void setValidateTrueChecksStore(boolean check) {
 _checkStore = check;
@@ -104,7 +104,7 @@
 
 /**
  * Whether to copy identity objects before returning them to client code.
- * Versions of OpenJPA prior to 3.0 always copied identity objects. Also,
+ * Versions of OpenJPA prior to 0.3.0 always copied identity objects. Also,
  * you should configure OpenJPA to copy identity objects if you mutate them
  * after use.
  */
@@ -114,7 +114,7 @@
 
 /**
  * Whether to copy identity objects before returning them to client code.
- * Versions of OpenJPA prior to 3.0 always copied identity objects. Also,
+ * Versions of OpenJPA prior to 0.3.0 always copied identity objects. Also,
  * you should configure OpenJPA to copy identity objects if you mutate them
  * after use.
  */
@@ -124,7 +124,7 @@
 
 /**
  * Whether to close the broker when the managed transaction commits.
- * Versions of OpenJPA prior to 3.0 did not close the broker.
+ * Versions of OpenJPA prior to 0.3.0 did not close the broker.
  */
 public boolean getCloseOnManagedCommit() {
 return _closeOnCommit;
@@ -132,7 +132,7 @@
 
 /**
  * Whether to close the broker when the managed transaction commits.
- * Versions of OpenJPA prior to 3.0 did not close the broker.
+ * Versions of OpenJPA prior to 0.3.0 did not close the broker.
  */
 public void setCloseOnManagedCommit(boolean close) {
 _closeOnCommit = close;
@@ -140,7 +140,7 @@
 
 /** 
  * Whether or not to perform a version check on instances being upda

svn commit: r449044 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PDeletedState.java

2006-09-22 Thread awhite
Author: awhite
Date: Fri Sep 22 11:37:11 2006
New Revision: 449044

URL: http://svn.apache.org/viewvc?view=rev&rev=449044
Log:
PDeleted version check causing problems.


Modified:

incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PDeletedState.java

Modified: 
incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PDeletedState.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PDeletedState.java?view=diff&rev=449044&r1=449043&r2=449044
==
--- 
incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PDeletedState.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PDeletedState.java
 Fri Sep 22 11:37:11 2006
@@ -69,10 +69,6 @@
 return error("deleted", context);
 }
 
-boolean isVersionCheckRequired(StateManagerImpl context) {
-return true;
-}
-
 boolean isTransactional() {
 return true;
 }