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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:36:35+00:00 2026-05-16T00:36:35+00:00

i have the two classes Person and Attribut, in short: @Entity @Indexed @Table(name=persons) public

  • 0

i have the two classes Person and Attribut, in short:

@Entity
@Indexed
@Table(name="persons")
public class Person {

  private int id;
  private List<Attribute> attributes;

  @Id
  @DocumentId
  @GeneratedValue
  @Column(name="person_id")
  public int getId() {
   return id;
  }

  @ManyToMany
  @JoinTable(
    name="attribute_alloc",
    joinColumns={@JoinColumn(name="person_id")},
    inverseJoinColumns={@JoinColumn(name="attribute_id")}
    )
  @Audited
  public List<Attribute> getAttributes() {
   return attributes;
  }

  // other properties, setters and getters...
}


@Entity
@Indexed
@Table(name="attributes")
public class Attribute {

  private int id;
  private List<Person> persons;

  @Id
  @DocumentId
  @GeneratedValue
  @Column(name="attribute_id")
  public int getId() {
   return id;
  }

  @ManyToMany(mappedBy="attributes")
  public List<Attribute> getPersons() {
   return persons;
  }

  // other properties, setters and getters...
}

For these classes the db tables persons, attributes, attribute_alloc, persons_aud, attributes_aud and attribute_alloc_aud were correctly generated.

All works well except the audit for the attributes in Person. In the table attribute_alloc_aud the changes (for example removing an attribute and adding a new one to a person) are tracked correctly, but always marked with the REVTYPE ADD. For example:

  • REV; person_id; attribute_id; REVTYPE
  • 1; 1; 1; 0
  • 1; 1; 2; 0
  • 2; 1; 1; 0
  • 2; 1; 5; 0
  • 3; 1; 8; 0

Consequence is that the audited person in the last revision has the attributes 1, 2, 5 and 8. Correct would be only 8!

What’s wrong?
Thanks a lot!
Best regards

Levi

  • 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-16T00:36:36+00:00Added an answer on May 16, 2026 at 12:36 am

    This may be probably when you update the Collection in ManyToMany you may be clearing out collection and then adding new collection.

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

Sidebar

Related Questions

I have two entity classes: Person and Position . public class Person { public
I have these two classes public class Person { } public class Company {
I have two basic domain classes: public class Event { private Long id; private
I have two classes: public class Person { public string FirstName { get {
I have two classes public class JobDataProvider { public List<Job> Get(int id){ List<Job> jobs
Let's say I have the following two classes: public class Person { public string
I have two similar classes : Person , PersonDto public class Person { public
There are two classes: class Person include Mongoid::Document field :name embeds_many :addresses end class
I have this weird situation. I have these two classes: Public Class Entry End
I have two classes, Person and Company, derived from another class Contact. They are

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.