In this case, how does hibernate handle the updates/inserts which are done outside a transaction?
An exception will be thrown if you try to flush any change outside of a JPA/Hibernate transaction. Only queries are permitted outside of a JPA/Hibernate transaction.