title: Bad issue with Hibernate: records automatically added when querying for a list
body: <p>I'm using - Hibernate 4 - Spring 3</p>
  
  <p>I'm facing a problem I can't understand: When I try to retrieve a list of objects in Hibernate, a different table of my Database is filled with rows. I suspect there's someting wrong with the "CASCADE" and "FETCHING" properties I have set, but I really can't understand.</p>
  
  <p>Let me explain the problem.</p>
  
  <p>Here there are 4 entities:</p>
  
  <ol>
  <li>a User which has all the credentials like <code>username</code>, <code>isEnabled</code>, <code>Authorities List</code> and similar stuff</li>
  <li>an Authority which records the role of the user</li>
  <li>a ProfiledUser which has all the stuff related to <code>profile data</code>, <code>address data</code>, and a list of <code>checkups</code> as well, and finally </li>
  <li>a Checkup which have some data and a reference to the user</li>
  </ol>
  
  <p>I tried to model the following</p>
  
  <p><img src="https://i.stack.imgur.com/AJgEs.png" alt="enter image description here"></p>
  
  <p>here's the classes: <strong>User</strong></p>
  
  <pre><code>@Entity
  @Table(name="USERS")
  @Inheritance(strategy=InheritanceType.JOINED)
  public class User implements UserDetails, DomainObject {
  
      private static final long serialVersionUID = 1L;
      private long id;
      //other stuff here
      Set&lt;Authority&gt; authorities = new HashSet&lt;Authority&gt;();
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      @Column(name="id", unique=true, nullable=false)
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      @ElementCollection(fetch=FetchType.EAGER)
      @JoinTable(name="AUTHORITIES", joinColumns=@JoinColumn(name="user_id"))
      public Set&lt;Authority&gt; getAuthorities() {
          return authorities;
      }
  
      public void setAuthorities(Set&lt;Authority&gt; authorities) {
          this.authorities = authorities;
      }   
  }
  </code></pre>
  
  <p><strong>ProfiledUSer</strong></p>
  
  <pre><code>@Entity
  @Table(name="PROFILED_USERS")
  public class ProfiledUser extends User{
  
      private static final long serialVersionUID = 1L;
      //other stuff here. Everything with CASCADE ALL
      private Collection&lt;Checkup&gt; checkupMap = new HashSet&lt;Checkup&gt;();
  
      public ProfiledUser() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
      public Collection&lt;Checkup&gt; getCheckupMap() {
          return checkupMap;
      }
  
      public void setCheckupMap(Collection&lt;Checkup&gt; checkupMap) {
          this.checkupMap = checkupMap;
      }
  }
  </code></pre>
  
  <p><strong>Checkup</strong></p>
  
  <pre><code>@Entity
  @Table(name="CHECKUPS")
  public class Checkup implements DomainObject{
  
      private long id;
      private ProfiledUser profiledUser;
      //other stuff here everyithing fetched EAGERLY
      private boolean pending = true;
  
      public Checkup() {
          super();
      }
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      @Column(name="id")
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      @OneToOne(fetch=FetchType.EAGER)
      @JoinColumn(name="profiledUser")
      public ProfiledUser getProfiledUser() {
          return profiledUser;
      }
  
      public void setProfiledUser(ProfiledUser profiledUser) {
          this.profiledUser = profiledUser;
      }
  
      @Column(name="pending")
      public boolean isPending() {
          return pending;
      }
  
      public void setPending(boolean pending) {
          this.pending = pending;
      }
  }
  </code></pre>
  
  <p>and finally <strong>Authority</strong></p>
  
  <pre><code>@Embeddable
  public class Authority implements GrantedAuthority{
  
      private static final long serialVersionUID = 1L;
      private String authority;  //Spring Security demands them to start with "ROLE_"
  
      public Authority() {
          super();
      }
  
      @Column(name="authority")
      public String getAuthority() {
          return this.authority;
      }
  
      //the administer is the one allowed to change the users' role
      @RolesAllowed("ROLE_ADMIN")
      public void setAuthority(String authority) {
          if(!authority.startsWith("ROLE_"))
              authority= (new String("ROLE_")).concat(authority.toUpperCase());
          this.authority = authority.toUpperCase();
      }
  }
  </code></pre>
  
  <p>Now the problem. When I try to retrieve a LIST of PENDING checkups (pending is a boolean attribute of a Checkup) doing the following</p>
  
  <pre><code>@SuppressWarnings("unchecked")
  @Override
  public List&lt;Checkup&gt; loadPendingCheckups()
  {
      Session session = sessionFactory.getCurrentSession();
      Query query = session.createQuery("from " + objName + " where pending is true");
      List&lt;Checkup&gt; checkupList = query.list();
      if(checkupList.isEmpty())
          return null;
      else
          return checkupList;
  }
  </code></pre>
  
  <p>this method is from <code>CheckupDaoImpl</code> which is annotated with <code>@Transactional</code>.</p>
  
  <p>Hibernate starts to delete and add a great amount of rows form the <code>Authority</code> table. For exmple it deletes the role <code>ROLE_USER</code> form the user 2 and adds is twice so that the number of <code>ROLE_USER</code> for the user 2 doubles with time: 1, 2, 4, 8, 16, 32, 64, ... and so on.
  I really can't understand why asking for a SELECT it ends up with a WRITE operation!
  Please help me because I really don't know where's the problem!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>When I invoke a <code>loadPendingCheckups()</code> I can read the following in the console:</p>
  
  <pre><code>Hibernate: select checkup0_.id as id0_, checkup0_.date as date0_, checkup0_.ending_measurement as ending6_0_, checkup0_.mid_measurement as mid7_0_, checkup0_.pending as pending0_, checkup0_.physiology as physiology0_, checkup0_.profiledUser as profiled9_0_, checkup0_.quiet_measurement as quiet10_0_, checkup0_.maxTrainingFrequency as maxTrain4_0_, checkup0_.minTrainingFrequency as minTrain5_0_, checkup0_.scale_outcome as scale11_0_ from CHECKUPS checkup0_ where checkup0_.pending=1
  Hibernate: select measuremen0_.id as id1_0_, measuremen0_.average_pressure as average2_1_0_, measuremen0_.diastolic_pressure as diastolic3_1_0_, measuremen0_.heart_rate as heart4_1_0_, measuremen0_.spO2 as spO5_1_0_, measuremen0_.systolic_pressure as systolic6_1_0_ from MEASUREMENTS measuremen0_ where measuremen0_.id=?
  Hibernate: select measuremen0_.id as id1_0_, measuremen0_.average_pressure as average2_1_0_, measuremen0_.diastolic_pressure as diastolic3_1_0_, measuremen0_.heart_rate as heart4_1_0_, measuremen0_.spO2 as spO5_1_0_, measuremen0_.systolic_pressure as systolic6_1_0_ from MEASUREMENTS measuremen0_ where measuremen0_.id=?
  Hibernate: select physiology0_.id as id2_0_, physiology0_.height as height2_0_, physiology0_.morphism_type as morphism3_2_0_, physiology0_.structure_type as structure4_2_0_, physiology0_.weight as weight2_0_ from PHYSIOLOGIES physiology0_ where physiology0_.id=?
  Hibernate: select profiledus0_.id as id7_9_, profiledus0_1_.account_non_expired as account2_7_9_, profiledus0_1_.account_non_locked as account3_7_9_, profiledus0_1_.credentials_non_expired as credenti4_7_9_, profiledus0_1_.enabled as enabled7_9_, profiledus0_1_.password as password7_9_, profiledus0_1_.username as username7_9_, profiledus0_.address_data as address3_8_9_, profiledus0_.contact_data as contact4_8_9_, profiledus0_.personal_data as personal5_8_9_, profiledus0_.subscription_date as subscrip1_8_9_, authoritie1_.user_id as user1_7_11_, authoritie1_.authority as authority11_, addressdat2_.id as id4_0_, addressdat2_.country as country4_0_, addressdat2_.location as location4_0_, addressdat2_.street as street4_0_, addressdat2_.street_number as street5_4_0_, addressdat2_.zip_code as zip6_4_0_, checkupmap3_.profiledUser as profiled9_7_12_, checkupmap3_.id as id12_, checkupmap3_.id as id0_1_, checkupmap3_.date as date0_1_, checkupmap3_.ending_measurement as ending6_0_1_, checkupmap3_.mid_measurement as mid7_0_1_, checkupmap3_.pending as pending0_1_, checkupmap3_.physiology as physiology0_1_, checkupmap3_.profiledUser as profiled9_0_1_, checkupmap3_.quiet_measurement as quiet10_0_1_, checkupmap3_.maxTrainingFrequency as maxTrain4_0_1_, checkupmap3_.minTrainingFrequency as minTrain5_0_1_, checkupmap3_.scale_outcome as scale11_0_1_, measuremen4_.id as id1_2_, measuremen4_.average_pressure as average2_1_2_, measuremen4_.diastolic_pressure as diastolic3_1_2_, measuremen4_.heart_rate as heart4_1_2_, measuremen4_.spO2 as spO5_1_2_, measuremen4_.systolic_pressure as systolic6_1_2_, measuremen5_.id as id1_3_, measuremen5_.average_pressure as average2_1_3_, measuremen5_.diastolic_pressure as diastolic3_1_3_, measuremen5_.heart_rate as heart4_1_3_, measuremen5_.spO2 as spO5_1_3_, measuremen5_.systolic_pressure as systolic6_1_3_, physiology6_.id as id2_4_, physiology6_.height as height2_4_, physiology6_.morphism_type as morphism3_2_4_, physiology6_.structure_type as structure4_2_4_, physiology6_.weight as weight2_4_, measuremen7_.id as id1_5_, measuremen7_.average_pressure as average2_1_5_, measuremen7_.diastolic_pressure as diastolic3_1_5_, measuremen7_.heart_rate as heart4_1_5_, measuremen7_.spO2 as spO5_1_5_, measuremen7_.systolic_pressure as systolic6_1_5_, scaleoutco8_.id as id3_6_, scaleoutco8_.bmr as bmr3_6_, scaleoutco8_.body_fat as body3_3_6_, scaleoutco8_.metabolic_age as metabolic4_3_6_, scaleoutco8_.muscle_mass as muscle5_3_6_, scaleoutco8_.skeletal_mass as skeletal6_3_6_, scaleoutco8_.visceral_fat as visceral7_3_6_, scaleoutco8_.water as water3_6_, scaleoutco8_.weight as weight3_6_, contactdat9_.id as id5_7_, contactdat9_.email as email5_7_, contactdat9_.mobile as mobile5_7_, contactdat9_.phone as phone5_7_, personalda10_.id as id6_8_, personalda10_.birth_date as birth2_6_8_, personalda10_.name as name6_8_, personalda10_.second_name as second4_6_8_ from PROFILED_USERS profiledus0_ inner join USERS profiledus0_1_ on profiledus0_.id=profiledus0_1_.id left outer join AUTHORITIES authoritie1_ on profiledus0_.id=authoritie1_.user_id left outer join ADDRESS_DATA addressdat2_ on profiledus0_.address_data=addressdat2_.id left outer join CHECKUPS checkupmap3_ on profiledus0_.id=checkupmap3_.profiledUser left outer join MEASUREMENTS measuremen4_ on checkupmap3_.ending_measurement=measuremen4_.id left outer join MEASUREMENTS measuremen5_ on checkupmap3_.mid_measurement=measuremen5_.id left outer join PHYSIOLOGIES physiology6_ on checkupmap3_.physiology=physiology6_.id left outer join MEASUREMENTS measuremen7_ on checkupmap3_.quiet_measurement=measuremen7_.id left outer join SCALE_OUTCOMES scaleoutco8_ on checkupmap3_.scale_outcome=scaleoutco8_.id left outer join CONTACT_DATA contactdat9_ on profiledus0_.contact_data=contactdat9_.id left outer join PERSONAL_DATA personalda10_ on profiledus0_.personal_data=personalda10_.id where profiledus0_.id=?
  Hibernate: select measuremen0_.id as id1_0_, measuremen0_.average_pressure as average2_1_0_, measuremen0_.diastolic_pressure as diastolic3_1_0_, measuremen0_.heart_rate as heart4_1_0_, measuremen0_.spO2 as spO5_1_0_, measuremen0_.systolic_pressure as systolic6_1_0_ from MEASUREMENTS measuremen0_ where measuremen0_.id=?
  Hibernate: select measuremen0_.id as id1_0_, measuremen0_.average_pressure as average2_1_0_, measuremen0_.diastolic_pressure as diastolic3_1_0_, measuremen0_.heart_rate as heart4_1_0_, measuremen0_.spO2 as spO5_1_0_, measuremen0_.systolic_pressure as systolic6_1_0_ from MEASUREMENTS measuremen0_ where measuremen0_.id=?
  Hibernate: select physiology0_.id as id2_0_, physiology0_.height as height2_0_, physiology0_.morphism_type as morphism3_2_0_, physiology0_.structure_type as structure4_2_0_, physiology0_.weight as weight2_0_ from PHYSIOLOGIES physiology0_ where physiology0_.id=?
  Hibernate: select profiledus0_.id as id7_9_, profiledus0_1_.account_non_expired as account2_7_9_, profiledus0_1_.account_non_locked as account3_7_9_, profiledus0_1_.credentials_non_expired as credenti4_7_9_, profiledus0_1_.enabled as enabled7_9_, profiledus0_1_.password as password7_9_, profiledus0_1_.username as username7_9_, profiledus0_.address_data as address3_8_9_, profiledus0_.contact_data as contact4_8_9_, profiledus0_.personal_data as personal5_8_9_, profiledus0_.subscription_date as subscrip1_8_9_, authoritie1_.user_id as user1_7_11_, authoritie1_.authority as authority11_, addressdat2_.id as id4_0_, addressdat2_.country as country4_0_, addressdat2_.location as location4_0_, addressdat2_.street as street4_0_, addressdat2_.street_number as street5_4_0_, addressdat2_.zip_code as zip6_4_0_, checkupmap3_.profiledUser as profiled9_7_12_, checkupmap3_.id as id12_, checkupmap3_.id as id0_1_, checkupmap3_.date as date0_1_, checkupmap3_.ending_measurement as ending6_0_1_, checkupmap3_.mid_measurement as mid7_0_1_, checkupmap3_.pending as pending0_1_, checkupmap3_.physiology as physiology0_1_, checkupmap3_.profiledUser as profiled9_0_1_, checkupmap3_.quiet_measurement as quiet10_0_1_, checkupmap3_.maxTrainingFrequency as maxTrain4_0_1_, checkupmap3_.minTrainingFrequency as minTrain5_0_1_, checkupmap3_.scale_outcome as scale11_0_1_, measuremen4_.id as id1_2_, measuremen4_.average_pressure as average2_1_2_, measuremen4_.diastolic_pressure as diastolic3_1_2_, measuremen4_.heart_rate as heart4_1_2_, measuremen4_.spO2 as spO5_1_2_, measuremen4_.systolic_pressure as systolic6_1_2_, measuremen5_.id as id1_3_, measuremen5_.average_pressure as average2_1_3_, measuremen5_.diastolic_pressure as diastolic3_1_3_, measuremen5_.heart_rate as heart4_1_3_, measuremen5_.spO2 as spO5_1_3_, measuremen5_.systolic_pressure as systolic6_1_3_, physiology6_.id as id2_4_, physiology6_.height as height2_4_, physiology6_.morphism_type as morphism3_2_4_, physiology6_.structure_type as structure4_2_4_, physiology6_.weight as weight2_4_, measuremen7_.id as id1_5_, measuremen7_.average_pressure as average2_1_5_, measuremen7_.diastolic_pressure as diastolic3_1_5_, measuremen7_.heart_rate as heart4_1_5_, measuremen7_.spO2 as spO5_1_5_, measuremen7_.systolic_pressure as systolic6_1_5_, scaleoutco8_.id as id3_6_, scaleoutco8_.bmr as bmr3_6_, scaleoutco8_.body_fat as body3_3_6_, scaleoutco8_.metabolic_age as metabolic4_3_6_, scaleoutco8_.muscle_mass as muscle5_3_6_, scaleoutco8_.skeletal_mass as skeletal6_3_6_, scaleoutco8_.visceral_fat as visceral7_3_6_, scaleoutco8_.water as water3_6_, scaleoutco8_.weight as weight3_6_, contactdat9_.id as id5_7_, contactdat9_.email as email5_7_, contactdat9_.mobile as mobile5_7_, contactdat9_.phone as phone5_7_, personalda10_.id as id6_8_, personalda10_.birth_date as birth2_6_8_, personalda10_.name as name6_8_, personalda10_.second_name as second4_6_8_ from PROFILED_USERS profiledus0_ inner join USERS profiledus0_1_ on profiledus0_.id=profiledus0_1_.id left outer join AUTHORITIES authoritie1_ on profiledus0_.id=authoritie1_.user_id left outer join ADDRESS_DATA addressdat2_ on profiledus0_.address_data=addressdat2_.id left outer join CHECKUPS checkupmap3_ on profiledus0_.id=checkupmap3_.profiledUser left outer join MEASUREMENTS measuremen4_ on checkupmap3_.ending_measurement=measuremen4_.id left outer join MEASUREMENTS measuremen5_ on checkupmap3_.mid_measurement=measuremen5_.id left outer join PHYSIOLOGIES physiology6_ on checkupmap3_.physiology=physiology6_.id left outer join MEASUREMENTS measuremen7_ on checkupmap3_.quiet_measurement=measuremen7_.id left outer join SCALE_OUTCOMES scaleoutco8_ on checkupmap3_.scale_outcome=scaleoutco8_.id left outer join CONTACT_DATA contactdat9_ on profiledus0_.contact_data=contactdat9_.id left outer join PERSONAL_DATA personalda10_ on profiledus0_.personal_data=personalda10_.id where profiledus0_.id=?
  Hibernate: select measuremen0_.id as id1_0_, measuremen0_.average_pressure as average2_1_0_, measuremen0_.diastolic_pressure as diastolic3_1_0_, measuremen0_.heart_rate as heart4_1_0_, measuremen0_.spO2 as spO5_1_0_, measuremen0_.systolic_pressure as systolic6_1_0_ from MEASUREMENTS measuremen0_ where measuremen0_.id=?
  Hibernate: select measuremen0_.id as id1_0_, measuremen0_.average_pressure as average2_1_0_, measuremen0_.diastolic_pressure as diastolic3_1_0_, measuremen0_.heart_rate as heart4_1_0_, measuremen0_.spO2 as spO5_1_0_, measuremen0_.systolic_pressure as systolic6_1_0_ from MEASUREMENTS measuremen0_ where measuremen0_.id=?
  Hibernate: select physiology0_.id as id2_0_, physiology0_.height as height2_0_, physiology0_.morphism_type as morphism3_2_0_, physiology0_.structure_type as structure4_2_0_, physiology0_.weight as weight2_0_ from PHYSIOLOGIES physiology0_ where physiology0_.id=?
  Hibernate: select profiledus0_.id as id7_9_, profiledus0_1_.account_non_expired as account2_7_9_, profiledus0_1_.account_non_locked as account3_7_9_, profiledus0_1_.credentials_non_expired as credenti4_7_9_, profiledus0_1_.enabled as enabled7_9_, profiledus0_1_.password as password7_9_, profiledus0_1_.username as username7_9_, profiledus0_.address_data as address3_8_9_, profiledus0_.contact_data as contact4_8_9_, profiledus0_.personal_data as personal5_8_9_, profiledus0_.subscription_date as subscrip1_8_9_, authoritie1_.user_id as user1_7_11_, authoritie1_.authority as authority11_, addressdat2_.id as id4_0_, addressdat2_.country as country4_0_, addressdat2_.location as location4_0_, addressdat2_.street as street4_0_, addressdat2_.street_number as street5_4_0_, addressdat2_.zip_code as zip6_4_0_, checkupmap3_.profiledUser as profiled9_7_12_, checkupmap3_.id as id12_, checkupmap3_.id as id0_1_, checkupmap3_.date as date0_1_, checkupmap3_.ending_measurement as ending6_0_1_, checkupmap3_.mid_measurement as mid7_0_1_, checkupmap3_.pending as pending0_1_, checkupmap3_.physiology as physiology0_1_, checkupmap3_.profiledUser as profiled9_0_1_, checkupmap3_.quiet_measurement as quiet10_0_1_, checkupmap3_.maxTrainingFrequency as maxTrain4_0_1_, checkupmap3_.minTrainingFrequency as minTrain5_0_1_, checkupmap3_.scale_outcome as scale11_0_1_, measuremen4_.id as id1_2_, measuremen4_.average_pressure as average2_1_2_, measuremen4_.diastolic_pressure as diastolic3_1_2_, measuremen4_.heart_rate as heart4_1_2_, measuremen4_.spO2 as spO5_1_2_, measuremen4_.systolic_pressure as systolic6_1_2_, measuremen5_.id as id1_3_, measuremen5_.average_pressure as average2_1_3_, measuremen5_.diastolic_pressure as diastolic3_1_3_, measuremen5_.heart_rate as heart4_1_3_, measuremen5_.spO2 as spO5_1_3_, measuremen5_.systolic_pressure as systolic6_1_3_, physiology6_.id as id2_4_, physiology6_.height as height2_4_, physiology6_.morphism_type as morphism3_2_4_, physiology6_.structure_type as structure4_2_4_, physiology6_.weight as weight2_4_, measuremen7_.id as id1_5_, measuremen7_.average_pressure as average2_1_5_, measuremen7_.diastolic_pressure as diastolic3_1_5_, measuremen7_.heart_rate as heart4_1_5_, measuremen7_.spO2 as spO5_1_5_, measuremen7_.systolic_pressure as systolic6_1_5_, scaleoutco8_.id as id3_6_, scaleoutco8_.bmr as bmr3_6_, scaleoutco8_.body_fat as body3_3_6_, scaleoutco8_.metabolic_age as metabolic4_3_6_, scaleoutco8_.muscle_mass as muscle5_3_6_, scaleoutco8_.skeletal_mass as skeletal6_3_6_, scaleoutco8_.visceral_fat as visceral7_3_6_, scaleoutco8_.water as water3_6_, scaleoutco8_.weight as weight3_6_, contactdat9_.id as id5_7_, contactdat9_.email as email5_7_, contactdat9_.mobile as mobile5_7_, contactdat9_.phone as phone5_7_, personalda10_.id as id6_8_, personalda10_.birth_date as birth2_6_8_, personalda10_.name as name6_8_, personalda10_.second_name as second4_6_8_ from PROFILED_USERS profiledus0_ inner join USERS profiledus0_1_ on profiledus0_.id=profiledus0_1_.id left outer join AUTHORITIES authoritie1_ on profiledus0_.id=authoritie1_.user_id left outer join ADDRESS_DATA addressdat2_ on profiledus0_.address_data=addressdat2_.id left outer join CHECKUPS checkupmap3_ on profiledus0_.id=checkupmap3_.profiledUser left outer join MEASUREMENTS measuremen4_ on checkupmap3_.ending_measurement=measuremen4_.id left outer join MEASUREMENTS measuremen5_ on checkupmap3_.mid_measurement=measuremen5_.id left outer join PHYSIOLOGIES physiology6_ on checkupmap3_.physiology=physiology6_.id left outer join MEASUREMENTS measuremen7_ on checkupmap3_.quiet_measurement=measuremen7_.id left outer join SCALE_OUTCOMES scaleoutco8_ on checkupmap3_.scale_outcome=scaleoutco8_.id left outer join CONTACT_DATA contactdat9_ on profiledus0_.contact_data=contactdat9_.id left outer join PERSONAL_DATA personalda10_ on profiledus0_.personal_data=personalda10_.id where profiledus0_.id=?
  Hibernate: delete from AUTHORITIES where user_id=? and authority=?
  Hibernate: insert into AUTHORITIES (user_id, authority) values (?, ?)
  Hibernate: delete from AUTHORITIES where user_id=? and authority=?
  ...// a very lot of these
  Hibernate: insert into AUTHORITIES (user_id, authority) values (?, ?)
  Hibernate: insert into AUTHORITIES (user_id, authority) values (?, ?)
  Hibernate: insert into AUTHORITIES (user_id, authority) values (?, ?)
  //a very lot of these
  </code></pre>
  
  <p>the physiology, measurement etc, is the stuff inside a checkup. I think it's ok it is retrieved. But after that, it is triggered the massive deletion &amp; insert inside the AUTHORITY table.</p>
  
  <p><strong>EDIT 2:</strong>
  It seems the problem is solved switching form <code>@ElementCollection</code> to <code>@OneToMany</code> relations between User and Authority. Luckily, I'm designing the database and this modification is allowed for me. The problem seems to be disappeared but still I didn't figure out the rationale behind the strange behaviour of the ORM.
  More precisely, the most weird thing is that when I was asking to retrieve Checkups form db Hibernate triggered an incredible amount of </p>
  
  <ol>
  <li>deletion of Authority items</li>
  <li>insertion of Authority items</li>
  </ol>
  
  <p>If anyone can point the thing out it will be very appreciated.</p>