我们正尝试使用Play Framework 2.3.3
设置OpenJPA
。我们无法使运行时或构建时间增强工作。将RuntimeUnenhancedClasses
属性设置为 persistance.xml 中支持的属性时,OpenJPA可以正常工作,但不建议用于生产,这是不行的。
我们尝试使用javaagent
JVM参数,但没有这样的运气:
activator -J-javaagent:lib/openjpa-all-2.3.0.jar run.
如何配置增强器?
答案 0 :(得分:0)
感谢您的建议。
以下是问题的解决方案:
https://github.com/kristijanbambir/play-openjpa/blob/master/build.sbt
应该在buid.sbt中添加此PCEnhancer调用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)