Stackoverflow error on merge

Hello,

We have an entity which refers other entities with OneToOne and OneToMany relationships. Of late we are getting java.lang.StackOverflowError on merge.

Brief stack of error is as

Caused by: java.lang.StackOverflowError
	at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:80) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.getJdbcService(StatementPreparerImpl.java:205) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.access$100(StatementPreparerImpl.java:30) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]

Any pointers on this would be helpful.

Thanks in Advance.

Best
Sumit