You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2014/01/10 18:02:33 UTC

JRebel support in DataNucleus?

Hi Andy,

I'm considering writing a plugin to JRebel [1] to reduce the turnaround
time.  But such a plugin would also need to play nicely with DataNucleus.

I googled but couldn't find any JRebel plugin for DataNucleus, so I'm
thinking that my plugin would need to interface with both Isis and
DataNucleus.

Basically, I think it amounts to rebuilding the metamodel for the changed
class(es).  In Isis I already have such an API [2], but is there anything
similar in DataNucleus?

Thx

Dan


[1] http://zeroturnaround.com/software/jrebel/learn/jrebel-plugins/
[2]
https://github.com/apache/isis/blob/master/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/SpecificationLoaderSpi.java#L51

Re: JRebel support in DataNucleus?

Posted by Andy Jefferson <an...@datanucleus.org>.
On Saturday 11 Jan 2014 09:06:19 Dan Haywood wrote:
> On 10 January 2014 18:41, Andy Jefferson <an...@datanucleus.org> 
wrote:
> > > Basically, I think it amounts to rebuilding the metamodel for the
> > > changed
> > > class(es).  In Isis I already have such an API [2], but is there
> > > anything
> > > similar in DataNucleus?
> > 
> > it would be to reload the
> > PMF/EMF when metadata/class files change, and when a persistence 
class
> > changes
> > then flush cache entries.
> 
> In Isis the PMF is held (in effect) globally [1].  So if I basically throw
> away the old PMF and recreate, would that be sufficient?
> I guess the bit I'm querying is "flush cache entries".  What does that 
mean
> if I have a new PMF?

Sufficient if you're happy with blowing away the persistence context and 
starting again. I think the JRebel plugins for other persistence providers 
cater for 2 situations : the one you're thinking of, and also where a 
persistence class (only) is being reloaded. This second one is where the 
cache needs flushing of all instances of the old version of that class (so 
PM/EM should likely call flush() and then call evictAll() on the L1 cache).


-- 
Andy
DataNucleus (Web: http://www.datanucleus.org   Twitter: @datanucleus)

Re: JRebel support in DataNucleus?

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 10 January 2014 18:41, Andy Jefferson <an...@datanucleus.org> wrote:

>
> > Basically, I think it amounts to rebuilding the metamodel for the changed
> > class(es).  In Isis I already have such an API [2], but is there anything
> > similar in DataNucleus?
>
> it would be to reload the
> PMF/EMF when metadata/class files change, and when a persistence class
> changes
> then flush cache entries.
>


In Isis the PMF is held (in effect) globally [1].  So if I basically throw
away the old PMF and recreate, would that be sufficient?

I guess the bit I'm querying is "flush cache entries".  What does that mean
if I have a new PMF?

Thx
Dan



[1]
https://github.com/apache/isis/blob/37beb951ec55170062eb1f9ae5023e428d619016/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java#L47

Re: JRebel support in DataNucleus?

Posted by Andy Jefferson <an...@datanucleus.org>.
Hi Dan,

> Basically, I think it amounts to rebuilding the metamodel for the changed
> class(es).  In Isis I already have such an API [2], but is there anything
> similar in DataNucleus?

I've never heard of anything that does that, but looking at their description 
for the Hibernate/EclipseLink/OpenJPA plugins it would be to reload the 
PMF/EMF when metadata/class files change, and when a persistence class changes 
then flush cache entries. Maybe JRebel would provide you with the code for one 
of those to get a start point ? (since its in their interests for more people 
to use JRebel, and this is only positive in that respect).



Regards
-- 
Andy
DataNucleus (Web: http://www.datanucleus.org   Twitter: @datanucleus)