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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:50:26+00:00 2026-05-17T14:50:26+00:00

here i am again in my self learning hibernate and personal experiment project to

  • 0

here i am again in my self learning hibernate and personal experiment project to gain more understanding.
Here is the description of my environment:
i have a super model entity that all my model inherit from.it has only id property
i use the genericDAO pattern found on hibernate web site.
Now my problem is that i use list instead of set for my one to many mapping (there is no need to avoid duplication here) and when i reference the super entity id in list index or list-index property i have this error :
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session
here is the super entity interface

public interface Model extends Serializable {
public Long getId();
public void setId(Long id);
}

//here is its implementation.they are not in the same physical file
public abstract class ModelImpl implements Model {
private Long id;
public Long getId() {
    return id;
}
public void setId(Long id) {
    this.id = id;
}

}

here is it’s mapping file

<class abstract="true" name="ModelImpl">
<!--i removed doctype and stuffs-->
<id name="id">
  <generator class="assigned"/>
</id>
</class>

here is on pojo interface this is my parent

public interface Message extends Model {
Date getDateSent();
String getGlobalStatus(); 

}
//its implementation is here but on different physical file
public class MessageImpl extends ModelImpl implements Message{
private String globalStatus;
private List response = new ArrayList();
private Date dateSent;
//setters and getters….
}

its mapping file is like so :

<union-subclass extends="ModelImpl" name="MessageImpl">
<property name="globalStatus"/>
<property name="dateSent" type="timestamp"/>

</set>–>

i commented the set because its was given a casting error which makes me realize my error
so the Response class which is the parent is here :

public interface Response extends Model {
String getGatewayMessageId();
Message getMessageId();
}
//its implementation but in different physical file
public class ResponseImpl extends ModelImpl implements Response{

private static final long serialVersionUID = 1L;

private Message messageId;
private String gatewayMessageId;
//setters and getters..
}

so that is basically that.now during my test when i try to save message with its children it throws this :

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

i can do all persitent methods exception the one i just talked about.
i’m a bit lost here coz all of them are inheriting Model id so what am i doing wrong?
thanks for reading.I dont’ really understand the problem here.

  • 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-05-17T14:50:26+00:00Added an answer on May 17, 2026 at 2:50 pm

    solve it.i have a manager(which creates pojos and daos) that inject new Id to every newly create POJO.and during testing i add the id manually.thanks for your help

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

Sidebar

Related Questions

Here we go again, the old argument still arises... Would we better have a
So, I seem to ask hard questions but here I go again. I have
I followed this guide here perfectly and have gone through it again but when
I have some code here: (...) NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(
Rookie C++ Programmer here again I'm using VC++ VS2008 and making an attempt at
I am Manoj again here to ask you my doubts. I heard that in
Here we go again , searched and tried myself but none of the online
Here's a question that comes up again and again in C++ class implementation. I'm
Once again a very beginner-ish question, but here I go: I would like to
Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some

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.