You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ke...@apache.org on 2007/06/28 18:12:36 UTC

svn commit: r551608 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/ maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/

Author: kevan
Date: Thu Jun 28 09:12:32 2007
New Revision: 551608

URL: http://svn.apache.org/viewvc?view=rev&rev=551608
Log:
GERONIMO-3270 Avoid foreign key violations in CMP. Using operation-order avoids the problem

Modified:
    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.sh
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.bat?view=diff&rev=551608&r1=551607&r2=551608
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.bat (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.bat Thu Jun 28 09:12:32 2007
@@ -311,9 +311,10 @@
 :doneSetArgs
 
 @REM Setup the Java programming language agent
+@REM For proper CMP behavior, we currently must specify operation-order
 set JAVA_AGENT_JAR=%GERONIMO_BASE%\bin\jpa.jar
 set JAVA_AGENT_OPTS=
-if exist "%JAVA_AGENT_JAR%" set JAVA_AGENT_OPTS=-javaagent:"%JAVA_AGENT_JAR%"
+if exist "%JAVA_AGENT_JAR%" set JAVA_AGENT_OPTS=-javaagent:"%JAVA_AGENT_JAR%" -Dopenjpa.jdbc.UpdateManager=operation-order
 
 @REM Execute Java with the applicable properties
 if not "%JDB%" == "" goto doJDB

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.sh
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.sh?view=diff&rev=551608&r1=551607&r2=551608
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.sh (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.sh Thu Jun 28 09:12:32 2007
@@ -284,9 +284,10 @@
 fi
 
 # Setup the Java programming language agent
+# For proper CMP behavior, we currently must specify operation-order
 JAVA_AGENT_JAR="$GERONIMO_BASE/bin/jpa.jar"
 if [ -f "$JAVA_AGENT_JAR" ]; then
-    JAVA_AGENT_OPTS="-javaagent:$JAVA_AGENT_JAR"
+    JAVA_AGENT_OPTS="-javaagent:$JAVA_AGENT_JAR -Dopenjpa.jdbc.UpdateManager=operation-order"
 else
     JAVA_AGENT_OPTS=""
 fi

Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java?view=diff&rev=551608&r1=551607&r2=551608
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java (original)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java Thu Jun 28 09:12:32 2007
@@ -187,9 +187,11 @@
         }
 
         // Load the Java programming language agent for JPA
+        // set operation-order is required for compliant behavior from OpenJPA
         File javaAgentJar = new File(geronimoHome, "bin/jpa.jar");
         if (javaAgentJar.exists()) {
             java.createJvmarg().setValue("-javaagent:" + javaAgentJar.getCanonicalPath());
+            setSystemProperty(java, "openjpa.jdbc.UpdateManager", "operation-order");
         }
 
         // Propagate some properties from Maven to the server if enabled



Re: svn commit: r551608 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/ maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/

Posted by Kevan Miller <ke...@gmail.com>.
On Jun 28, 2007, at 5:54 PM, David Jencks wrote:

> This looks to me like a dreadful approach.  Did you try including  
> the property in defaultPersistenceUnitProperties in the persistence  
> builder config
>
> <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
>
>     <gbean name="PersistenceUnitBuilder"  
> class="org.apache.geronimo.persistence.builder.PersistenceUnitBuilder" 
> >
>         <attribute  
> name="defaultPersistenceProviderClassName">org.apache.openjpa.persiste 
> nce.PersistenceProviderImpl</attribute>
>         <attribute name="extendedEntityManagerRegistryName">? 
> name=ExtendedEntityManagerRegistry#org.apache.geronimo.persistence.Ext 
> endedEntityManagerRegistry</attribute>
>         <attribute name="defaultPersistenceUnitProperties">
>             openjpa.Log=commons
>             openjpa.ClassTransformerOptions=ScanDevPath=true
>              
> openjpa.jdbc.DBDictionary=org.apache.openjpa.jdbc.sql.DerbyDictionary
>             openjpa.jdbc.SynchronizeMappings=buildSchema 
> (ForeignKeys=true,SchemaAction='add,deleteTableContents')
>             openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100)
>         </attribute>
>         <xml-attribute name="defaultEnvironment">
>             <environment xmlns="http://geronimo.apache.org/xml/ns/ 
> deployment-1.1">
>                 <dependencies>
>                     <dependency>
>                         <groupId>org.apache.geronimo.configs</groupId>
>                         <artifactId>openjpa</artifactId>
>                         <type>car</type>
>                     </dependency>
>                 </dependencies>
>             </environment>
>         </xml-attribute>
>     </gbean>
>

Setting the property on defaultPersistenceUnitProperties doesn't  
work. Setting the property in CmpJpaConversion.java in OpenEJB didn't  
work, either. I'll dig further. First, however, I'll have a look at  
remaining tck problems...

--kevan

Re: svn commit: r551608 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/ maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/

Posted by Dain Sundstrom <da...@iq80.com>.
On Jun 28, 2007, at 6:52 PM, Kevan Miller wrote:

>
> On Jun 28, 2007, at 5:54 PM, David Jencks wrote:
>
>> This looks to me like a dreadful approach.  Did you try including  
>> the property in defaultPersistenceUnitProperties in the  
>> persistence builder config
>
> No. I didn't find the existing properties. Did try setting a  
> property in OpenEJB, which didn't work. I'll give this a try. More  
> dreadful, IMO, is using the flag to *avoid* the problem. Best is  
> for someone familiar with JPA/CMP to actually investigate and fix  
> the underlying problem. I found the cause of the problem and fixed  
> it the best I could. Which doesn't seem that "dreadful" to me...

My guess is that OpenJPA switched to the constraint based update  
model which uses the database constraints to determine the update  
order.  If the algorithm isn't order preserving (update order should  
be the default), it could introduce new problems.  Update order is a  
fine default until the constraint based code gets exercised more.

-dain

Re: svn commit: r551608 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/ maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/

Posted by Kevan Miller <ke...@gmail.com>.
On Jun 28, 2007, at 5:54 PM, David Jencks wrote:

> This looks to me like a dreadful approach.  Did you try including  
> the property in defaultPersistenceUnitProperties in the persistence  
> builder config

No. I didn't find the existing properties. Did try setting a property  
in OpenEJB, which didn't work. I'll give this a try. More dreadful,  
IMO, is using the flag to *avoid* the problem. Best is for someone  
familiar with JPA/CMP to actually investigate and fix the underlying  
problem. I found the cause of the problem and fixed it the best I  
could. Which doesn't seem that "dreadful" to me...

--kevan



Re: svn commit: r551608 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/src/main/resources/bin/ maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/

Posted by David Jencks <da...@yahoo.com>.
This looks to me like a dreadful approach.  Did you try including the  
property in defaultPersistenceUnitProperties in the persistence  
builder config

<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">

     <gbean name="PersistenceUnitBuilder"  
class="org.apache.geronimo.persistence.builder.PersistenceUnitBuilder">
         <attribute  
name="defaultPersistenceProviderClassName">org.apache.openjpa.persistenc 
e.PersistenceProviderImpl</attribute>
         <attribute name="extendedEntityManagerRegistryName">? 
name=ExtendedEntityManagerRegistry#org.apache.geronimo.persistence.Exten 
dedEntityManagerRegistry</attribute>
         <attribute name="defaultPersistenceUnitProperties">
             openjpa.Log=commons
             openjpa.ClassTransformerOptions=ScanDevPath=true
              
openjpa.jdbc.DBDictionary=org.apache.openjpa.jdbc.sql.DerbyDictionary
             openjpa.jdbc.SynchronizeMappings=buildSchema 
(ForeignKeys=true,SchemaAction='add,deleteTableContents')
             openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100)
         </attribute>
         <xml-attribute name="defaultEnvironment">
             <environment xmlns="http://geronimo.apache.org/xml/ns/ 
deployment-1.1">
                 <dependencies>
                     <dependency>
                         <groupId>org.apache.geronimo.configs</groupId>
                         <artifactId>openjpa</artifactId>
                         <type>car</type>
                     </dependency>
                 </dependencies>
             </environment>
         </xml-attribute>
     </gbean>


?

thanks
david jencks

On Jun 28, 2007, at 9:12 AM, kevan@apache.org wrote:

> Author: kevan
> Date: Thu Jun 28 09:12:32 2007
> New Revision: 551608
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=551608
> Log:
> GERONIMO-3270 Avoid foreign key violations in CMP. Using operation- 
> order avoids the problem
>
> Modified:
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
> src/main/resources/bin/geronimo.bat
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
> src/main/resources/bin/geronimo.sh
>     geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/server/ 
> StartServerMojo.java
>
> Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
> minimal/src/main/resources/bin/geronimo.bat
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/ 
> geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.bat? 
> view=diff&rev=551608&r1=551607&r2=551608
> ====================================================================== 
> ========
> --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
> src/main/resources/bin/geronimo.bat (original)
> +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
> src/main/resources/bin/geronimo.bat Thu Jun 28 09:12:32 2007
> @@ -311,9 +311,10 @@
>  :doneSetArgs
>
>  @REM Setup the Java programming language agent
> +@REM For proper CMP behavior, we currently must specify operation- 
> order
>  set JAVA_AGENT_JAR=%GERONIMO_BASE%\bin\jpa.jar
>  set JAVA_AGENT_OPTS=
> -if exist "%JAVA_AGENT_JAR%" set JAVA_AGENT_OPTS=-javaagent:"% 
> JAVA_AGENT_JAR%"
> +if exist "%JAVA_AGENT_JAR%" set JAVA_AGENT_OPTS=-javaagent:"% 
> JAVA_AGENT_JAR%" -Dopenjpa.jdbc.UpdateManager=operation-order
>
>  @REM Execute Java with the applicable properties
>  if not "%JDB%" == "" goto doJDB
>
> Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
> minimal/src/main/resources/bin/geronimo.sh
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/ 
> geronimo-boilerplate-minimal/src/main/resources/bin/geronimo.sh? 
> view=diff&rev=551608&r1=551607&r2=551608
> ====================================================================== 
> ========
> --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
> src/main/resources/bin/geronimo.sh (original)
> +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
> src/main/resources/bin/geronimo.sh Thu Jun 28 09:12:32 2007
> @@ -284,9 +284,10 @@
>  fi
>
>  # Setup the Java programming language agent
> +# For proper CMP behavior, we currently must specify operation-order
>  JAVA_AGENT_JAR="$GERONIMO_BASE/bin/jpa.jar"
>  if [ -f "$JAVA_AGENT_JAR" ]; then
> -    JAVA_AGENT_OPTS="-javaagent:$JAVA_AGENT_JAR"
> +    JAVA_AGENT_OPTS="-javaagent:$JAVA_AGENT_JAR - 
> Dopenjpa.jdbc.UpdateManager=operation-order"
>  else
>      JAVA_AGENT_OPTS=""
>  fi
>
> Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/ 
> src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/ 
> StartServerMojo.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven- 
> plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/ 
> mavenplugins/geronimo/server/StartServerMojo.java? 
> view=diff&rev=551608&r1=551607&r2=551608
> ====================================================================== 
> ========
> --- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/server/ 
> StartServerMojo.java (original)
> +++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/server/ 
> StartServerMojo.java Thu Jun 28 09:12:32 2007
> @@ -187,9 +187,11 @@
>          }
>
>          // Load the Java programming language agent for JPA
> +        // set operation-order is required for compliant behavior  
> from OpenJPA
>          File javaAgentJar = new File(geronimoHome, "bin/jpa.jar");
>          if (javaAgentJar.exists()) {
>              java.createJvmarg().setValue("-javaagent:" +  
> javaAgentJar.getCanonicalPath());
> +            setSystemProperty(java, "openjpa.jdbc.UpdateManager",  
> "operation-order");
>          }
>
>          // Propagate some properties from Maven to the server if  
> enabled
>
>