开发者

How to reuse Grails application's domain classes?

I have already create a Grails application. For some reasons开发者_Python百科 I need to create another console application for someone to modify database data.

  1. Is it possible to package Grails application as a JAR library, so that the console application can reuse those domain classes?
  2. Or, I add/create some classes in Grails application and package it as a JAR and run as console application?


If no better answer, probably I will use the batch-launcher plugin to do that.


You can put the domain classes in a JAR and tell Grails that these are your domain classes by adding a Hibernate XML file (in grails-app/conf/hibernate) that refers to the classes in this JAR. You can use this JAR in any other Java/Groovy application, but obviously they'll only have the persistence methods (dynamic finders, save(), etc.) when used in a Grails app.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜