We are trying to set up Play Framework 2.3.3
with OpenJPA
. We are unable to make Runtime or Build Time enhancement work. OpenJPA works when setting the RuntimeUnenhancedClasses
property to supported in persistance.xml, but that's not recommended for production and is a no-go.
We tried using the javaagent
JVM parameter with no luck like this:
activator -J-javaagent:lib/openjpa-all-2.3.0.jar run.
How can the enhancer be configured?
Thank you for your advice.
Here is the solution for the problem:
https://github.com/kristijanbambir/play-openjpa/blob/master/build.sbt
in buid.sbt should be added this PCEnhancer call
lazy val enhance = taskKey[Unit]("Enhances model classes")
enhance <<= (fullClasspath in Runtime, runner, streams).map({(cp, run, s) =>
// only files from classpath are needed
val classpath = cp.files
// any options that need to be passed to the enhancer
val options = Seq()
// returns an option of errormessage
val result = run.run("org.apache.openjpa.enhance.PCEnhancer", classpath, options, s.log)
// if case of errormessage, throw an exception
result.foreach(sys.error)
}) triggeredBy(compile in Compile)