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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:38:11+00:00 2026-06-18T11:38:11+00:00

I have an exception from the bellow line of code: def order = new

  • 0

I have an exception from the bellow line of code:

  def order = new PostOrder(pOrder: "post", posts: status, children: lookupPerson().children)

the lookupPerson().children gives a set of 2 Child instances with different id’s

The full exception is:

  org.hibernate.HibernateException: Found shared references to a collection: com.fyp.timeline.PostOrder.children
at com.fyp.timeline.ProfileController$$ENwi3LDE.updateStatus(ProfileController.groovy:134)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

I am really stuck on this. Mainly because it did used to work and randomly stopped. I have added a new user to MySql and a new database but that should not effect this one.

  • 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-18T11:38:12+00:00Added an answer on June 18, 2026 at 11:38 am

    You’re passing lookupPerson().children to the constructor of the PostOrder – I’m assuming that this is a collection in the Person class mapped with static hasMany = [ ... ]. So Hibernate is telling you what’s happening – you’re using the same collection twice. It makes sense to me that there should only be one owner of a mapped collection. Keep in mind that these aren’t regular ArrayLists or HashSets – they’re Hibernate PersistentLists and PersistentSets which implement the correct interfaces but are Hibernate-specific.

    If you want to pass the collection items to the new PostOrder, you can copy them into a new collection, e.g.

    def order = new PostOrder(
        pOrder: "post", posts: status,
        children: [] + lookupPerson().children)
    

    However since this is likely also a mapped collection, you should be using addToChildren, e.g.

    def order = new PostOrder(pOrder: "post", posts: status)
    lookupPerson().children.each { order.addToChildren it }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have below code snippet. It throws the exception at line 3 but query
I have an exception being thrown from a C# method, that takes a generic
I have made my own exception class which derives from runtime_error and is getting
I have a Java regular expression that captures stack exceptions from a string: ((?s).+(?:Exception|Error)[^\n]++(?:\s+at
I am new to Hibernate. I have an exception while running an Hibernate-based application.
The below line code is giving exception when when we are trying to make
In the code below I keep getting a null exception error and have tested
I have a strange behavior. The code below worked from a long time but
I have pasted two function from my code. They are for adding a tab
Related: Cannot view exceptions thrown during Tomcat startup from Eclipse I have Eclipse setup

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.