annotation « Transaction « JPA Q&A





1. Hibernate using transaction annotation requires a flush after most if not all queries    stackoverflow.com

So we're using an annotation to specify that a class requires a transaction like this:

@TransactionAttribute (TransactionAttributeType.REQUIRED)
public class Foo() {
...
}
In the bits of code in that class that actually make changes to ...

2. How to handle exceptions raised by @Transactional annotation    stackoverflow.com

How to handle exceptions raised by @Transactional annotation. In a case where TransactionSystemException includes a ConstraintViolationException due to not null constraint violation for an entity annotated with @Entity. I am using ...

3. Can I set optimistic-lock="true|false" using annotations ?    forum.hibernate.org

I've been getting spurious OptimisticLockException / StaleObjectStateException and finally, after much digging, I found that hibernate actually bumps the version number of the parent object if one of its collections is modified. For almost all of my collections this is not desirable, and I'd be happy to turn this feature off completely if possible. I notice that if I use an ...

4. Can I set optimistic-lock="true|false" using annotations ?    forum.hibernate.org

I've been getting spurious OptimisticLockException / StaleObjectStateException and finally, after much digging, I found that hibernate actually bumps the version number of the parent object if one of its collections is modified. For almost all of my collections this is not desirable, and I'd be happy to turn this feature off completely if possible. I notice that if I use an ...

5. Configure optimistic locking using annotations    forum.hibernate.org

When using timestamp versioning you can tell Hibernate where to retrieve the timestamp value from - database or JVM - by optionally adding the @org.hibernate.annotations.Source annotation to the property. Possible values for the value attribute of the annotation are org.hibernate.annotations.SourceType.VM and org.hibernate.annotations.SourceType.DB. The default is SourceType.DB which is also used in case there is no @Source annotation at all.

6. transaction annotations inline--need documentation/examples    forum.hibernate.org

hello, I'm trying to conquer an issue where despite having some code that relies on the transaction annotations (@TransactionAttribute, for example) in the actual source to identify/manage code I want to be able to commit en masse or not at all, I am seeing partial commits when the code fails midpoint and causes a rollback. I've been looking for good examples ...