--
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/5189e508-9e34-40ba-b050-adad4409eac5n%40googlegroups.com.
Hi Rob,
Q: Can you move SimpleCustomer and other entities to another package (not a top level package of "play") ?
While most (if not all) Play! 1 Framework modules are in package play.modules.*, of course I could move them into another.But for a few versions (of this play-ebean module) I'd like to stick at play.modules.ebean while providing an upgrade path.What options do I have at compile time with the AntEnhanceTask or with the Gradle plugin to force processing my play.modules.ebean package?In Play! Framework (version 2) both play-ebean modules use some AntEnhanceTask-like magic to enhance their play.db.ebean package.
Thanks,Szabolcs
--
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/1bbadf43-cadc-4f17-857f-655d6ca1bdc2n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Ebean ORM" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ebean/t9xdTXgBseM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/CAC%3Dts-Gg8ozU7%2BP8gKrH%3DFkgS34BW%2Bx-PeBzWgVDLU%3DUNkuV_w%40mail.gmail.com.
Hi Rob!
I just read about Gradle's "Targeting a specific Java version" and Java 9's "--release" feature.
As I would like to create a few intermediate releases (of this Play! 1 Ebean module) supporting Java 6 and Java 8 before I migrate to Java 11, I thought about how could the Ebean Gradle plugin support earlier versions of Ebean.
Let me ask a few questions regarding your answers below ...
> with manual class enhancement I am a
Ebean has a gradle plugin and you'd be expected to use that. https://ebean.io/docs/getting-started/gradle ... so that SO answer should be ignored or corrected really.
> While most (if not all) Play! 1 Framework modules are in package play.modules.*, of course I cou
Ebean ONLY cares about enhancing the application models and classes (@Entity entities, query beans and classes with @Transactional). We don't care about enhancing any play framework classes.
Now that said, given the link you included it seems that at least some versions of playframework expect the @Entity classes to be in the "play/db/ebean/**" package ... and that is a problem with the IgnoreClassHelper ignoring "play". So pretty much we need to remove that "play" entry from the IgnoreClassHelper it seems.
> In Play! Framework (version 2) both play-ebean modules use some AntEnhanceTask-like magic to enhance their play.db.ebean package.
Yes. Seems like a sbt plugin would be better than that?
And yes, having to put entity beans into the play.db.ebean package means we need to change IgnoreClassHelper.
> If I start using io.ebean.Model in the module, then I still have to call those ctClass.addMethod(ctMethod.make(...))?
My take is that adding those static methods is a bad idea as it's a concept that doesn't scale as you add more finder methods and clutters up the entity class. The recommended approach has been to put those methods on the finder object instead.
That is, the finder for Fish for example isn't quite right - https://github.com/PromanSEW/ebean_example/blob/main/app/models/Fish.java#L17... instead, a class FishFinder extends Finder<Integer,Fish> { ... } ... should be created and used instead. Then we can put the finder methods on that FishFinder and not clutter up the entity class with static finder methods.
The javadoc of io.ebean.Finder shows us the recommended way to use Finder.
So my recommendation is to do that instead, adding find methods to the finder type and not adding lots of static methods to the entity bean. IMO adding those static methods was always a bad idea really.
> Just read ebean-orm/ebean#2689: "IllegalStateException: Error trying to create the prototypeEntityBean for class".
It seems like ebean-core is not part of the classpath used during the enhancement. That means the ebean-agent isn't reading /META-INF/ebean-version.mf resource ... to determine that the enhancement should be for ebean 13.6.0 (which has EntityBeanIntercept as an interface).
Looking at the gradle snippet ... in particular:
new AgentManifest(cl)
I'm pretty sure that classLoader (cl) ... doesn't include ebean-core-13.6.0.jar,
- so then /META-INF/ebean-version.mf is not read by the AgentManifest
- so then AgentManifest.getEbeanInternalVersion() will return 0 and not 141- so then the enhancement thinks ... I'm using an older version of ebean where EntityBeanIntercept is a concrete class (but now with 13.6.0 it's an interface).
A hack to kind of prove that would be to get AgentManifest.getEbeanInternalVersion() to return 141 (and not 0).
Background:ebean-agent needs to be backwards compatible supporting all versions of ebean from 12.x upwards. To do this, it detects the actual version of ebean being used by reading that /META-INF/ebean-version.mf resource.
In the end, I would like to use the latest versions of Ebean and Ebean tools. But until then, I had to use Ebean 4 and Ebean 8 too.
You wrote that ebean-agent (currently 13.x) needs to be backwards
compatible to Ebean 12.x. Where do those Ebean internal version
(which is now enhancement version, ebean-orm/ebean-agent#182)
values like 141 and 128 come from?
How could I find out earlier ebean-agent versions' skew to Ebean?
And how tight is the dependency of the Gradle plugin to
ebean-agent? What could go wrong ™ if I downgrade the Gradle
plugin's ebean-agent's dependency?
As a fallback I could try again with my snippet.
Thanks,
Szabolcs
> Where do those Ebean internal version
(which is now enhancement version, ebean-orm/ebean-agent#182)
values like 141 and 128 come from?
128 means ebean 12.8 or higher is being used
141 meant ebean 14.1 or higher is being used (we expected to bring that feature in with ebean 14.x except we instead pulled that change into 13.x so that doesn't line up per say but that's ok)
These ebean-version indicators do not exist prior to that. It was introduced when we wanted the new behaviour in ebean-agent based on the new version of ebean but keep the old behaviour for people using older ebean. We won't see those versions or anything like them in prior versions of ebean-agent because in theory we didn't need to as we deemed those changes as more bug fixes. That might not be 100% correct if we really should have treated a bug as a behaviour change instead.
> How could I find out earlier ebean-agent versions' skew to Ebean?
Ebean agent from 11.x to 12.8 are expected to work with ebean 11.x to 12.8.
> And how tight is the dependency of the Gradle plugin to
ebean-agent?
It's not tight to the ebean-agent but much more around dealing with Gradle specific lifecycle (when to apply the enhancement) and Gradle specific code to obtain the classpath (used for enhancement).
> What could go wrong ™ if I downgrade the Gradle
plugin's ebean-agent's dependency?
I expect that to work.
--
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/08c90670-8c18-be7d-038c-ab07b4faf1b9%40gmail.com.