开发者

Extending GenericModel for Play Framework

I need to add some logic to GenericModel by means of extending it, but I understand that Play uses generics to enhance t开发者_运维百科he GenericModel. What would be the right and most convenient way to extend this class?

I tried to do this, but some of the methods in GenericModel simply throw a UnsupportedOperationException exception, so this is clearly enhanced somewhere else.


Check out db.jpa.Model which also extends GenericModel.

If you intend to extends the GenericModel, I would do it in the models package. No need for an external module and it is best to avoid touching playframework core. You will have trouble updating it if you do.

But still, after a quick look at the source code, it seems that you are trying to modify JPA related code. What kind of logic are you talking about?


I've managed to get this working by means of reflection. Everything is now working 100%. :) Not really the best solution, but it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜