Search Blog

Search duranek.blogspot.com

Sunday, January 22, 2012

Declarative Transaction Management

Programmatic vs. Declarative


Spring offers two ways of handling transactions: programmatic and declarative. If you are familiar with EJB transaction handling, this corresponds to bean-managed and container-managed transaction management.

Programmatic means you have transaction management code surrounding your business code. That gives you extreme flexibility, but is difficult to maintain and, well, boilerplate.

Declarative means you separate transaction management from the business code. You only use annotations or XML based configuration.

We say that:
programmatic management is more flexible during development time but less flexible during application life
declarative management is less flexible during development time but more flexible during application life

No comments: