I made my DAOTest extends AbstractTransactionalDataSourceSpringContextTests. and try to persist 2 object with same unique key.
Quote:
<hibernate-mapping>
<class name="sample.domain.School" table="SCHOOL">
<id name="id" column="SCHOOL_ID" length="32">
<generator class="uuid"/>
</id>
<property name="name"/>
<property name="registerNumber" unique="true" not-null="true"/>
</class>
</hibernate-mapping>
However, the exception does not throw after I invoked the
Quote:
saveOrUpdate(school1)
saveOrUpdate(school2)
but if I flush the session or excute a query, the exception will be thrown out. Does it mean hibernate will not check the constraint when the instance is only saved to session, that job actually left to database?