Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:47:56+00:00 2026-06-04T09:47:56+00:00

Imagine two Grails applications which share a domain class. Maybe a Book domain class.

  • 0

Imagine two Grails applications which share a domain class. Maybe a Book domain class.

One application is identified as the owner of the data, one will have to access the domain data. Something like amazon and the amazon web services.

I guess it is trivial that the owning application will use a normal domain class and will expose the data through web services – no problem in grails.

But what would be best practice to implement the domain in the other application?

  • use a service to access the remote domain and not implement a local domain class at all?
  • implement a local domain class, overwrite the get()-method in order to fetch the remote data and use the local database as cache?
  • what other solution comes to your mind?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:47:58+00:00Added an answer on June 4, 2026 at 9:47 am

    Ryan Geyer has a very interesting article Modularizing your Grails application domain classes which lists 3 solutions to this problem:

    1. As a RESTful JSON Service – easy to get this setup in Grails but then you lose the automatic GORM functionality.

    2. Separate out the domain classes into a library JAR file and reference that library in both of my other applications. This is not as easy as it first sounds

    3. Create a Grails plugin. Put the domain object in the plugin. Each of your applications can then import this plugin. You can then create different controllers with different functionality as required. The sample code for this is available at:

      git clone git://ec2.nslms.com/grails/blog_example_modular

    Ted Naleid gives a great tip later in the post and recommends…

    "create a grails-app/conf/BuildConfig.groovy file and put the plugin name and path to the source in it. … If you do this, your applications will see the live changes to your domain/controller/service/etc classes as if they were actually in current app and there isn’t any need to repackage and reinstall the plugin when you make changes."

    Using memcache should enable both applications to have a consistent view of the data and would avoid each individual application having it’s own inconsistent cache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine the following two entities. Element is simple class containing some data: @Entity public
Imagine I have two TextInput components. How do I know which one is active,
Imagine two simple java applications. Both of them are implementing the same JAR file
Imagine that I have a form in a flash application with two fields, input1
Imagine two projects. The first is the framework-core project which is in version 1.1.0
Imagine the following two classes of a chess game: TChessBoard = class private FBoard
Let's imagine I have two threads which execute some database-oriented code in thread-specific TransactionScopes
Imagine you have two tables, with a one to many relationship. For this example,
Imagine I have two class A and B defined like this : class A
Imagine you have two fields in your Model: public class MyModel { [Required(ErrorMessageResourceType =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.