Hi,

I'm testing the way @Where annotation works, and I found the following
scenario:

If we have an entity annotated like this:

@Where(clause = "deleted = false")

@SQLDelete(sql = "UPDATE tag set deleted = true where id = ?")

If the entity was previously deleted and I try to load it in a new
Persistence Context:

assertNull(entityManager.find(Tag.class, "Misc"));

The entity is fetched successfully, and the assert fails.

The only way to make it work is if I override the load query using the
@Loader annotation:

@Loader(namedQuery = "findTagById")
@NamedQuery(name = "findTagById", query = "select t from Tag t where
t.id = ? and t.deleted = false")

Is this the expected behavior or is it a bug?

Vlad
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to