Disable verification of existence of associated entities

I have noticed that Hibernate, every time I insert an entity that has other entities associated with it, does a find to confirm that the element exists, and I see that this can be useful in some cases, but in others I see it as a bit unnecessary. I wanted to know, is there a configuration to disable these searches?

You say insert so I assume you use EntityManager#persist. This should only happen if you enable CascadeType.PERSIST or CascadeType.ALL on an association that refers to a detached entity. If you don’t want that behavior, use EntityManager#getReference to obtain a managed reference to the target entity or disable the cascade.

What happens to me is that with entities that I only have cascadetype detach and refresh when I persist the main entity, should I remove those cascadetypes as well? I should also say that the object I am passing is only the id of the associate entities, the rest of the objects are in the database.

At this point, your comments are confusing me more than they help. Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

Sorry, I got confused, I did a debug and they are queries to obtain a proxy, and not for the data, I didn’t know they were calls to obtain a proxy