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 8295791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:44:02+00:00 2026-06-08T14:44:02+00:00

My domain class looks like this : class UserEvent { User user Event event

  • 0

My domain class looks like this :

class UserEvent { 
    User user
    Event event
    boolean isAttending
}

Generated database table looks has following columns:

[ID , EVENT_ID, USER_ID , IS_ATTENDING ]

I have Event object and only id of User object (user_id).
I want to create new UserEvent object with this data only, without loading User object, it may look something like this:

def userEvent = new UserEvent(user:['id':user_id],isAttending: true, event: event)

I’ve tried a lot of things but didn’t find the solution. I think it is definitely possible, since it is done in a similar way with params in controllers which contain only ids of associated objects:

 def userEvent= new UserEvent(params)

I am looking forward to finding the solution. Thank you.

  • 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-08T14:44:04+00:00Added an answer on June 8, 2026 at 2:44 pm

    When you say “without loading the User object”, you can do this:

    def userEvent = new UserEvent(user:User.load(user_id), isAttending: true, event: event)
    

    Unlike get, the load method does not hit the database. Instead, it creates a proxy object that only fetches its data from the database the first time a non-id property is accessed.

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

Sidebar

Related Questions

Assume a domain class called User . User class looks like this: class User
I have a class in my domain model root that looks like this: namespace
My domain class looks like this: package com.initech.tps class Foo { String stuff static
I have a domain model that looks like this: case class Account(id: Int, name:
I have a domain class that looks like this: class Offerbyuser { Number offerPrice
I have a model named Domain which looks like this: class Domain(models.Model): Model for
In our system our database looks like this One agency has many brokerages, one
If I have a domain object that looks like this: class Note { Long
I have a Domain Model for Countries and States that looks like the following(see
Let's say I have a domain object that looks like this: @Entity @Indexed public

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.