Package io.dropwizard.hibernate
Annotation Interface UnitOfWork
@Target(METHOD)
@Retention(RUNTIME)
@Documented
@Repeatable(UnitsOfWork.class)
public @interface UnitOfWork
When annotating a Jersey resource method, wraps the method in a Hibernate session.
To be used outside Jersey, one need to create a proxy of the component with the annotated method.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionorg.hibernate.CacheMode
TheCacheMode
for the session.org.hibernate.FlushMode
TheFlushMode
for the session.boolean
Iftrue
, the Hibernate session will default to loading read-only entities.boolean
Iftrue
, a transaction will be automatically started before the resource method is invoked, committed if the method returned, and rolled back if an exception was thrown.The name of a hibernate bundle (session factory) that specifies a datasource against which a transaction will be opened.
-
Element Details
-
readOnly
boolean readOnlyIftrue
, the Hibernate session will default to loading read-only entities.- See Also:
-
Session.setDefaultReadOnly(boolean)
- Default:
- false
-
transactional
boolean transactionalIftrue
, a transaction will be automatically started before the resource method is invoked, committed if the method returned, and rolled back if an exception was thrown.- Default:
- true
-
cacheMode
org.hibernate.CacheMode cacheModeTheCacheMode
for the session.- See Also:
-
CacheMode
Session.setCacheMode(CacheMode)
- Default:
- NORMAL
-
flushMode
org.hibernate.FlushMode flushModeTheFlushMode
for the session.- See Also:
-
FlushMode
org.hibernate.Session#setFlushMode(org.hibernate.FlushMode)
- Default:
- AUTO
-
value
String valueThe name of a hibernate bundle (session factory) that specifies a datasource against which a transaction will be opened.- Default:
- "hibernate"
-