Why does the JPA @ManyToMany association remove all entries and reinserts the remaining ones back upon modifications


#1

I have a many-to-many relationship and every time I do an update of any field of the entity, it generates the delete of all relations and then re-inserts them. So I have unnecessary operations. Always a delete and xx insert.

For example I have a person who has many associated devices. If I assign that person a card or change the name, it generates a delete of all the devices (in the corresponding table) and then insert them of all the devices I had.

How can I avoid those delete insert and just leave the update of the name or card of the person?

Try putting CASCADE.all and putting nothing

@ManyToMany(targetEntity=com.inodes.hrdata.entities.CaptureDevice.class, cascade={CascadeType.REFRESH, CascadeType.MERGE})
@ForeignKey(name="FK_PERSON_DEVICE", inverseName="FK_DEVICE_PERSON")
@JoinTable(
		name="PERSON_DEVICE", 
		joinColumns=@JoinColumn(name="PERSON_UID"),
		inverseJoinColumns=@JoinColumn(name="DEVICE_UID")
		)
private List<CaptureDevice> devices = new ArrayList<CaptureDevice>();

#3

There are two ways to fix this issue:

  1. You replace the List with a Set:

    private Set<CaptureDevice> devices = new HashSet<CaptureDevice>();
    

    For a detailed explanation, check out this article.

  2. Or, you map the intermediarry table as an entity, and replace the @ManyToMany association with two bidirectional @OneToMany associations. For more details, check out this article.


#4

Use the first option and it did not work.
I must change something in the annotations


#5

Use the first option and it did not work.

If it worked before for List, it will work for Set. The only difference is that the Set will allow Hibernate to execute more efficient SQL statements.


#6

I meant that the delete and insert statements for each device continue to appear unnecessarily.
Nothing broke


#7

If you run this BidirectionalManyToManySetTest, you will see that using Set with @ManyToMany does not generate any DELETE ALL entries upon updating the many-to-many association.

Try to replicate it with this test case template, and if you can, add the link to the GitHub repository so I can take a look at it.


#8

It is a very big project to be able to put it on github
I can pass what I tell you in a text file with the mysql sentences

…190211 17:13:44 server id 1 end_log_pos 10051 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
delete from hrdata.PERSON_DEVICE where PERSON_UID=‘40288f8260eb11bb0161b8af46b30d26’/!/;

at 501626

#190211 17:13:44 server id 1 end_log_pos 10199 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
delete from hrdata.PERSON_ROUTE where PERSON_UID=‘40288f8260eb11bb0161b8af46b30d26’/!/;

at 501774

#190211 17:13:44 server id 1 end_log_pos 10401 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec23cab80075’)/!/;

at 501976

#190211 17:13:44 server id 1 end_log_pos 10603 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec20d4d20071’)/!/;

at 502178

#190211 17:13:44 server id 1 end_log_pos 10805 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebdaa2b1001c’)/!/;

at 502380

#190211 17:13:44 server id 1 end_log_pos 11007 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebec421f0033’)/!/;

at 502582

#190211 17:13:44 server id 1 end_log_pos 11209 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebe9b69a002f’)/!/;

at 502784

#190211 17:13:44 server id 1 end_log_pos 11411 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebedf7440035’)/!/;

at 502986

#190211 17:13:44 server id 1 end_log_pos 11613 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebdcf3bf0020’)/!/;

at 503188

#190211 17:13:44 server id 1 end_log_pos 11815 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebb850bf000c’)/!/;

at 503390

#190211 17:13:44 server id 1 end_log_pos 12017 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebddeee50022’)/!/;

at 503592

#190211 17:13:44 server id 1 end_log_pos 12219 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1b809a0069’)/!/;

at 503794

#190211 17:13:44 server id 1 end_log_pos 12421 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0db3da0053’)/!/;

at 503996

#190211 17:13:44 server id 1 end_log_pos 12623 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec199c130063’)/!/;

at 504198

#190211 17:13:44 server id 1 end_log_pos 12825 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebe86798002d’)/!/;

at 504400

#190211 17:13:44 server id 1 end_log_pos 13027 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1628aa0059’)/!/;

at 504602

#190211 17:13:44 server id 1 end_log_pos 13229 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebcb0d220016’)/!/;

at 504804

#190211 17:13:44 server id 1 end_log_pos 13431 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebaf2a350008’)/!/;

at 505006

#190211 17:13:44 server id 1 end_log_pos 13633 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1cab30006d’)/!/;

at 505208

#190211 17:13:44 server id 1 end_log_pos 13835 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf380e8003f’)/!/;

at 505410

#190211 17:13:44 server id 1 end_log_pos 14037 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec083cb10049’)/!/;

at 505612

#190211 17:13:44 server id 1 end_log_pos 14239 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8761e1a3c70161e21beb9400a9’)/!/;

at 505814

#190211 17:13:44 server id 1 end_log_pos 14441 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8266d4b0480167320680c63d5d’)/!/;

at 506016

#190211 17:13:44 server id 1 end_log_pos 14643 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf7403d0043’)/!/;

at 506218

#190211 17:13:44 server id 1 end_log_pos 14845 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf46da60041’)/!/;

at 506420

#190211 17:13:44 server id 1 end_log_pos 15047 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0cfb8c0051’)/!/;

at 506622

#190211 17:13:44 server id 1 end_log_pos 15249 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1a36e40065’)/!/;

at 506824

#190211 17:13:44 server id 1 end_log_pos 15451 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0f4e380057’)/!/;

at 507026

#190211 17:13:44 server id 1 end_log_pos 15653 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebe1180f0026’)/!/;

at 507228

#190211 17:13:44 server id 1 end_log_pos 15855 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0c394d004f’)/!/;

at 507430

#190211 17:13:44 server id 1 end_log_pos 16057 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec16dbf7005b’)/!/;

at 507632

#190211 17:13:44 server id 1 end_log_pos 16259 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1ae27b0067’)/!/;

at 507834

#190211 17:13:44 server id 1 end_log_pos 16461 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1903380061’)/!/;

at 508036

#190211 17:13:44 server id 1 end_log_pos 16663 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf2c824003d’)/!/;

at 508238

#190211 17:13:44 server id 1 end_log_pos 16865 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0ea80c0055’)/!/;

at 508440

#190211 17:13:44 server id 1 end_log_pos 17067 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebd3be4f001a’)/!/;

at 508642

#190211 17:13:44 server id 1 end_log_pos 17269 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1c13ce006b’)/!/;

at 508844

#190211 17:13:44 server id 1 end_log_pos 17471 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160eba12fb90002’)/!/;

at 509046

#190211 17:13:44 server id 1 end_log_pos 17673 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1852b5005f’)/!/;

at 509248

#190211 17:13:44 server id 1 end_log_pos 17875 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0b5db6004d’)/!/;

at 509450

#190211 17:13:44 server id 1 end_log_pos 18077 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘4028817068bdad320168bdc1bf4b0010’)/!/;

at 509652

#190211 17:13:44 server id 1 end_log_pos 18279 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebe5664c0029’)/!/;

at 509854

#190211 17:13:44 server id 1 end_log_pos 18481 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec09dc1c004b’)/!/;

at 510056

#190211 17:13:44 server id 1 end_log_pos 18683 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec1d5e27006f’)/!/;

at 510258

#190211 17:13:44 server id 1 end_log_pos 18885 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f826658c0c90166a6710dea3a68’)/!/;

at 510460

#190211 17:13:44 server id 1 end_log_pos 19087 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebb3491d000a’)/!/;

at 510662

#190211 17:13:44 server id 1 end_log_pos 19289 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebc8668f0012’)/!/;

at 510864

#190211 17:13:44 server id 1 end_log_pos 19491 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebdbaaf5001e’)/!/;

at 511066

#190211 17:13:44 server id 1 end_log_pos 19693 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebeaa8840031’)/!/;

at 511268

#190211 17:13:44 server id 1 end_log_pos 19895 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec2238480073’)/!/;

at 511470

#190211 17:13:44 server id 1 end_log_pos 20097 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160eb9e3a3b0000’)/!/;

at 511672

#190211 17:13:44 server id 1 end_log_pos 20299 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0761890047’)/!/;

at 511874

#190211 17:13:44 server id 1 end_log_pos 20501 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf00f330037’)/!/;

at 512076

#190211 17:13:44 server id 1 end_log_pos 20703 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf10f410039’)/!/;

at 512278

#190211 17:13:44 server id 1 end_log_pos 20905 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebf1e4b9003b’)/!/;

at 512480

#190211 17:13:44 server id 1 end_log_pos 21107 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebe6e0b0002b’)/!/;

at 512682

#190211 17:13:44 server id 1 end_log_pos 21309 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ec0623c90045’)/!/;

at 512884

#190211 17:13:44 server id 1 end_log_pos 21511 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebaa02ab0006’)/!/;

at 513086

#190211 17:13:44 server id 1 end_log_pos 21713 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160eba8204b0004’)/!/;

at 513288

#190211 17:13:44 server id 1 end_log_pos 21915 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebdf67610024’)/!/;

at 513490

#190211 17:13:44 server id 1 end_log_pos 22117 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_DEVICE (PERSON_UID, DEVICE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0160ebcd7d370018’)/!/;

at 513692

#190211 17:13:44 server id 1 end_log_pos 22317 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f826388060a0163b66e90a518e6’)/!/;

at 513892

#190211 17:13:44 server id 1 end_log_pos 22517 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f1b97510293’)/!/;

at 514092

#190211 17:13:44 server id 1 end_log_pos 22717 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610fde84d9029a’)/!/;

at 514292

#190211 17:13:44 server id 1 end_log_pos 22917 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f87632b338b01632bafba260019’)/!/;

at 514492

#190211 17:13:44 server id 1 end_log_pos 23117 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb0161dd313e861996’)/!/;

at 514692

#190211 17:13:44 server id 1 end_log_pos 23317 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f1569420290’)/!/;

at 514892

#190211 17:13:44 server id 1 end_log_pos 23517 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610fdcc9500298’)/!/;

at 515092

#190211 17:13:44 server id 1 end_log_pos 23717 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610fda05130297’)/!/;

at 515292

#190211 17:13:44 server id 1 end_log_pos 23917 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f87632b338b01632bac9c1d0015’)/!/;

at 515492

#190211 17:13:44 server id 1 end_log_pos 24117 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f3445b50296’)/!/;

at 515692

#190211 17:13:44 server id 1 end_log_pos 24317 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f87632b338b01632baed3760018’)/!/;

at 515892

#190211 17:13:44 server id 1 end_log_pos 24517 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f1a773e0291’)/!/;

at 516092

#190211 17:13:44 server id 1 end_log_pos 24717 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f826388060a0163b6b5f5341a95’)/!/;

at 516292

#190211 17:13:44 server id 1 end_log_pos 24917 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f826388060a0163b66e436718e5’)/!/;

at 516492

#190211 17:13:44 server id 1 end_log_pos 25117 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f1afd270292’)/!/;

at 516692

#190211 17:13:44 server id 1 end_log_pos 25317 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8761e1a3c70161fc2f1f320396’)/!/;

at 516892

#190211 17:13:44 server id 1 end_log_pos 25517 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f826388060a0163b6656d6b18e4’)/!/;

at 517092

#190211 17:13:44 server id 1 end_log_pos 25717 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘00000000000000000000000000000002’)/!/;

at 517292

#190211 17:13:44 server id 1 end_log_pos 25917 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8263b716950163bb76176709a7’)/!/;

at 517492

#190211 17:13:44 server id 1 end_log_pos 26117 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f1e1a690294’)/!/;

at 517692

#190211 17:13:44 server id 1 end_log_pos 26317 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f8260eb11bb01610f1f173f0295’)/!/;

at 517892

#190211 17:13:44 server id 1 end_log_pos 26517 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PERSON_ROUTE (PERSON_UID, ROUTE_UID) values (‘40288f8260eb11bb0161b8af46b30d26’, ‘40288f87632b338b01632bae80590017’)/!/;

at 518092

#190211 17:13:44 server id 1 end_log_pos 518119 Xid = 8106
COMMIT/!/;

at 518119

#190211 17:13:44 server id 1 end_log_pos 518189 Query thread_id=4 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
BEGIN/!/;

at 518189

#190211 17:13:44 server id 1 end_log_pos 407 Query thread_id=4 exec_time=0 error_code=0
SET TIMESTAMP=1549916024/!/;
insert into hrdata.PENDING_ACTION (ACTION, ACTION_DATE, CARD_NUMBER1, CARD_NUMBER2, CARD_TYPE_UID1, CARD_TYPE_UID2, CDEVICE_UID, PERSON_UID, ACTION_UID) values (‘DELETE_CARD’, ‘2019-02-12 05:13:00’, ‘87987897654654’, null, ‘40288f876296aa810162d89ca16b0873’, null, null, ‘40288f8260eb11bb0161b8af46b30d26’, ‘4028817068de30950168de31b0540003’)/!/;

at 518596

#190211 17:13:44 server id 1 end_log_pos 518623 Xid = 8213
COMMIT/!/;
DELIMITER ;

End of log file

ROLLBACK /* added by mysqlbinlog /;
/
!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;


#9

You only need 2 entities to replicate the many-to-many association behaviour. The lig are not useful without seeing the code, hence ypu need to create a replicating test case.