openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: identity class IllegalArgumentException
Date Wed, 09 Jun 2010 21:33:06 GMT

> I remember that I had some problems doing compile time enhancements
> (with Scala and Maven) but I will retry this tomorrow.

I am not conversant with Scala to comment whether that will introduce any
further complexity to OpenJPA enhancement step. But I have heard numerous
painful user experience on enhancement.
It is sad because build-time enhancement is really a simple (I mean simple
as easy) process of
invoking a Java program with correct classpath and a single argument.

I have added the bare essentials in an Ant script required to enhance domain
classes.

Please note that
   1. how the ${jap.properties} variable is defined with its parent
directory META-INF followed by the file name persistence.xml and then
appended with an unit name. The content of the persistence.xml should use
the same unit name and list all the classes in <class> clause.
 
   2. the classpath should include the parent directory of META-INF
directory

   3. fork the java process

   4. ensure OpenJPA libraries are in classpath. Recent OpenJPA distribution
folds all runtime dependencies in a single jar file. 


	<!-- JPA configuration file anchored by the persistence unit name       --> 
	<property name="jpa.properties" 
value="META-INF/persistence.xml#OpenBooks"/>
	<!-- root directory of Java Source files                                -->
	<property name="src.dir"      value="${basedir}/src/main/java"/>
	<!-- root directory of compiled class files                             -->
	<property name="classes.dir"  value="${target.dir}/classes"/>
	<!-- root directory of resource files e.g web.xml or persistence.xml    -->
	<property name="rsrc.dir"     value="${basedir}/src/main/resources"/>

	<path id="compile.classpath" 
		description="Compilation classpath requires OpenJPA specific library
because of bytecode enhancement">
		<pathelement location="${src.dir}" />
		<pathelement location="${classes.dir}" />
		<pathelement location="${rsrc.dir}" />
		<fileset dir="${openjpa.lib}">
			<include name="*.jar" />
		</fileset>
	</path>

	<target name="enhance" 
		description="Enhance persistent domain classes.">
		<java classname="org.apache.openjpa.enhance.PCEnhancer" fork="true">
			<arg value="-properties" />
			<arg value="${jpa.properties}" />
			<classpath refid="compile.classpath" />
		</java>
	</target>


-----
Pinaki 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/identity-class-IllegalArgumentException-tp5159262p5160588.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message