Initial testing seems to indicate that this works like a charm.

1) Include the JRbel SDK as a dependency in your project

<dependency>
        <groupId>org.zeroturnaround</groupId>
        <artifactId>javarebel-sdk</artifactId>
        <version>2.0.2</version>
</dependency>

2) Add the following class to your project and invoke it's register() method at 
application startup time (of course you’ll have to adapt the class to your own 
environment)

https://gist.github.com/hugith/4d6ae65783ddb7dcd6f1aa7e4a79bc6c

Voila—instant reloading of Cayenne models.

- hugi


> On 30. maí 2016, at 12:52, Andrus Adamchik <and...@objectstyle.org> wrote:
> 
> Please share the recipe if it works.
> 
> A.
> 
>> On May 30, 2016, at 3:51 PM, Hugi Thordarson <h...@karlmenn.is> wrote:
>> 
>> In my case it’s a singleton, created by me and lazily initialized—so I 
>> should only need to set that variable to null on a model change event. 
>> Experimenting with this now.
>> 
>> - hugi
>> 
>> 
>> 
>>> On 30. maí 2016, at 12:48, Andrus Adamchik <and...@objectstyle.org> wrote:
>>> 
>>> In a typical app ServerRuntime is a singleton controlled by your code. You 
>>> are probably creating it explicitly in your app somewhere on startup. Or 
>>> are you relying on CayenneFilter to bootstrap Cayenne? (in which case 
>>> runtime is accessible via WebUtil.getCayenneRuntime(..)).
>>> 
>>> Andrus
>>> 
>>>> On May 30, 2016, at 3:44 PM, Hugi Thordarson <h...@karlmenn.is> wrote:
>>>> 
>>>> I currently use JRebel for class reloading when developing WO. It has a 
>>>> relatively simple plugin API that can be used to watch changes to Cayenne 
>>>> project files and trigger stuff on file/class modification. It could 
>>>> replace the ServerRuntime instance, but it would need some way to know 
>>>> what ServerRuntime instances to replace with a new instance. This could be 
>>>> specified in a configuration file—or is there some way for me to retrieve 
>>>> all ServerRuntime instances related to the modified entities?
>>>> 
>>>> - hugi
>>>> 
>>>> 
>>>> 
>>>>> On 30. maí 2016, at 12:31, Andrus Adamchik <and...@objectstyle.org> wrote:
>>>>> 
>>>>> Doable in theory - just create a new runtime every time you detect a 
>>>>> change. The bigger question is how practical this is, considering you 
>>>>> also need to reload Java classes. I guess also doable if you run in debug 
>>>>> mode that does class reloading.
>>>>> 
>>>>> Andrus
>>>>> 
>>>>>> On May 30, 2016, at 3:27 PM, Hugi Thordarson <h...@karlmenn.is> wrote:
>>>>>> 
>>>>>> Hi all,
>>>>>> I’ve been working with Ebean for the past couple of months (customer 
>>>>>> unfortunately mandated the use of Ebean). I don’t really like working 
>>>>>> with it, but it has one feature that I really like—I can change model 
>>>>>> classes at will (add attributes, relationships etc.) and the changes 
>>>>>> take effect immediately, i.e. I don’t need to restart the application.
>>>>>> 
>>>>>> Is it possible to do something similes in Cayenne? I.e., can I make 
>>>>>> changes to the model and then reload the runtime, or something of the 
>>>>>> ilk?
>>>>>> 
>>>>>> Cheers,
>>>>>> - hugi
>>>>> 
>>>> 
>>> 
>> 
> 

Reply via email to