jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
694 stars 124 forks source link

JmixEntityManager breaks bean validation during new entity merge #3530

Open dtaimanov opened 3 months ago

dtaimanov commented 3 months ago

Environment

Jmix version: 2.3.1

Bug Description

See the forum topic. io.jmix.eclipselink.impl.JmixEntityManager#findOrCreate creates and persists a new entity with not initialized fields. It breaks bean validation.

Steps To Reproduce

  1. Download the project from forum topic.
  2. Run in debug mode and put a breakpoint at BlankView.kt:41 [entityManager.merge(create)]
  3. Press the empty button on Blank View
  4. Press F8 in debugger to step over next line AR: The ConstraintViolationException will be seen in debugger and the transaction will be rolled back.
gorbunkov commented 3 months ago

em.persist() works as expected and it must be used for saving new entities.