Just one last remark from me: The JPA2 reference implementation is doing it right, at least with the MySQL driver. See my updated test case.