Link to home
Start Free TrialLog in
Avatar of kmapper
kmapper

asked on

Other Issue (See related Solution)

Ok, I got the point,

But the flush will fail on the employee since there is a NOT NULL constraint on the department id :(

Have an idea?

ASKER CERTIFIED SOLUTION
Avatar of Mr_It
Mr_It

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_It
Mr_It

I just tried this using the hibernate JPA implementation and it seems that this works just fine. The Department object is not loaded before the Employee is persisted.

In fact it does not even throw the EntityNotFoundException if the dept does not exists, but em.persist(emp) will fail due to a constraint violation...