0

I'm working on a small REST application server and I'm trying to be able to save a Java bean using DataNucleus JDO with MySQL.

My only problem is that I can't find any examples of any application that uses DataNucleus JDO and is built using Gradle.

I'm new to using Java and I have essentially no idea how to go about doing this. At this moment I'm just considering going with Hibernate JPA instead but I feel like JDO would be better for me in the long run. I would really appreciate any help pointing me in the right direction.

Essam Al-Mansouri
  • 1,049
  • 2
  • 11
  • 19
  • Gradle surely must have ample documentation, and all you are doing with DataNucleus is executing Java processes. A simple search reveals such as https://divinespear.github.io/jpa-schema-gradle-plugin/ which you could easily inspect and use. – Neil Stockton May 21 '17 at 07:24
  • @Neil That example specifically doesn't support datanucleus though. Thank you though, I will try adapting it. – Essam Al-Mansouri May 21 '17 at 10:34
  • You mean the thing that says "version 0.2 Support datanucleus" ? – Neil Stockton May 21 '17 at 15:01
  • what happened to your "adapting" ? – Neil Stockton Jun 06 '17 at 07:43
  • @NeilStockton Oh, sorry I should have come back to fill you in. I followed Adrian's solution I found [here](https://stackoverflow.com/questions/29279503/how-can-i-run-datanucleus-enhancer-from-gradle) with a minor edit. I modified the task to depend on processResources instead of compileJava and made classes depend on datanucleusEnhance, otherwise it didn't work for me. I would normally tell you the error I got but I couldn't see the enhancer's error output. The solution essentially calls an ant task to enhance the classes instead of using Gradle only. It's not the most elegant but it worked. – Essam Al-Mansouri Jun 09 '17 at 15:09
  • Great, so suggest that you add an ANSWER with your solution in it, for future people who need it – Neil Stockton Jun 09 '17 at 17:20

1 Answers1

1

I followed Adrian's solution I found here with a minor edit: I modified the task to depend on processResources instead of compileJava and made classes depend on datanucleusEnhance, otherwise it didn't work for me.

I would normally tell you the error I got but I couldn't see the enhancer's error output.

The solution essentially calls an ant task to enhance the classes instead of using Gradle only. It's not the most elegant but it worked.

Essam Al-Mansouri
  • 1,049
  • 2
  • 11
  • 19