In addition, last night I created a trait for your model companion
object so that you have easy access to all the DAO methods. Since I
don't know what's idiomatic to Play and what's not, I need some help
testing and adapting this trait. In addition, I am hoping it can fix
some stubborn class cast exceptions people are getting when Play
reloads the view.
> In addition, last night I created a trait for your model companion > object so that you have easy access to all the DAO methods. Since I > don't know what's idiomatic to Play and what's not, I need some help > testing and adapting this trait. In addition, I am hoping it can fix > some stubborn class cast exceptions people are getting when Play > reloads the view.
> If you're interested in helping out, please review the section on > ModelCompanion on the updated wiki link, and look over the code and > the spec:
Thanks for working on this, Rose and Leon. It would be great to have a fix/workaround on the Salat side, because I have a feeling Play will be a bit slower moving. I'd like to help out, too, but since I'm using the plugin it might be somewhat difficult to switch to using straight Salat--can you comment on that Leon? What would I do to use the latest snapshot?
I have a feeling Salat will experience a nice adoption rate because of Play 2.0, if it's a solid choice compared to Morphia/others.
>> In addition, last night I created a trait for your model companion >> object so that you have easy access to all the DAO methods. Since I >> don't know what's idiomatic to Play and what's not, I need some help >> testing and adapting this trait. In addition, I am hoping it can fix >> some stubborn class cast exceptions people are getting when Play >> reloads the view.
I'm going to do some tests and see if I get the class loader errors. and if not, I'll probably update to wiki / plugin to use this new way of working, since it's more in tune with how the anorm plugin looks.
I'll post back here as soon as I've got some new info.
> I'm going to do some tests and see if I get the class loader errors. and if > not, I'll probably update to wiki / plugin to use this new way of working, > since it's more in tune with how the anorm plugin looks.
> I'll post back here as soon as I've got some new info.
> In addition, last night I created a trait for your model companion > object so that you have easy access to all the DAO methods. Since I > don't know what's idiomatic to Play and what's not, I need some help > testing and adapting this trait. In addition, I am hoping it can fix > some stubborn class cast exceptions people are getting when Play > reloads the view.
> If you're interested in helping out, please review the section on > ModelCompanion on the updated wiki link, and look over the code and > the spec:
> In addition, last night I created a trait for your model companion > object so that you have easy access to all the DAO methods. Since I > don't know what's idiomatic to Play and what's not, I need some help > testing and adapting this trait. In addition, I am hoping it can fix > some stubborn class cast exceptions people are getting when Play > reloads the view.
> If you're interested in helping out, please review the section on > ModelCompanion on the updated wiki link, and look over the code and > the spec:
> In addition, last night I created a trait for your model companion > object so that you have easy access to all the DAO methods. Since I > don't know what's idiomatic to Play and what's not, I need some help > testing and adapting this trait. In addition, I am hoping it can fix > some stubborn class cast exceptions people are getting when Play > reloads the view.
> If you're interested in helping out, please review the section on > ModelCompanion on the updated wiki link, and look over the code and > the spec:
>> In addition, last night I created a trait for your model companion >> object so that you have easy access to all the DAO methods. Since I >> don't know what's idiomatic to Play and what's not, I need some help >> testing and adapting this trait. In addition, I am hoping it can fix >> some stubborn class cast exceptions people are getting when Play >> reloads the view.
>> If you're interested in helping out, please review the section on >> ModelCompanion on the updated wiki link, and look over the code and >> the spec:
>> In addition, last night I created a trait for your model companion >> object so that you have easy access to all the DAO methods. Since I >> don't know what's idiomatic to Play and what's not, I need some help >> testing and adapting this trait. In addition, I am hoping it can fix >> some stubborn class cast exceptions people are getting when Play >> reloads the view.
>> If you're interested in helping out, please review the section on >> ModelCompanion on the updated wiki link, and look over the code and >> the spec:
>> In addition, last night I created a trait for your model companion >> object so that you have easy access to all the DAO methods. Since I >> don't know what's idiomatic to Play and what's not, I need some help >> testing and adapting this trait. In addition, I am hoping it can fix >> some stubborn class cast exceptions people are getting when Play >> reloads the view.
>> If you're interested in helping out, please review the section on >> ModelCompanion on the updated wiki link, and look over the code and >> the spec:
Thanks to Leon's work the ClassCastException issue can now be solved.
The explanation:
Every hot recompilation leads to classloader replacement (only in Play2 dev mode). The problem is that, after that, the context is linked to the wrong classloader... which leads to this ClassCastException on your models.
To solve this problem, you need to force the context to be rebuilt with the model classes. To do so you have to define a custom context IN YOUR app. The default context provided with salat imports won't be recompiled in play2 dev mode. In addition, in leon's plugin former releases (before 1.0.6) the context included in the plugin wasn't recompiled.
Defining your custom context in you app permits to have hot rebuild without the ClassCastException issue. This solution works with Play2 with or without leon's plugin.
I don't know why but with salat versions < 0.0.8 this solution wasn't working. I had some problems with 0.0.8-SNAPSHOT also...
> >> In addition, last night I created a trait for your model companion
> >> object so that you have easy access to all the DAO methods. Since I
> >> don't know what's idiomatic to Play and what's not, I need some help
> >> testing and adapting this trait. In addition, I am hoping it can fix
> >> some stubborn class cast exceptions people are getting when Play
> >> reloads the view.
> >> If you're interested in helping out, please review the section on
> >> ModelCompanion on the updated wiki link, and look over the code and
> >> the spec:
> >> In addition, last night I created a trait for your model companion
> >> object so that you have easy access to all the DAO methods. Since I
> >> don't know what's idiomatic to Play and what's not, I need some help
> >> testing and adapting this trait. In addition, I am hoping it can fix
> >> some stubborn class cast exceptions people are getting when Play
> >> reloads the view.
> >> If you're interested in helping out, please review the section on
> >> ModelCompanion on the updated wiki link, and look over the code and
> >> the spec:
> >> In addition, last night I created a trait for your model companion
> >> object so that you have easy access to all the DAO methods. Since I
> >> don't know what's idiomatic to Play and what's not, I need some help
> >> testing and adapting this trait. In addition, I am hoping it can fix
> >> some stubborn class cast exceptions people are getting when Play
> >> reloads the view.
> >> If you're interested in helping out, please review the section on
> >> ModelCompanion on the updated wiki link, and look over the code and
> >> the spec: