DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Java
  4. Automating the Transaction Logic Layer for Hibernate / JPA Applications

Automating the Transaction Logic Layer for Hibernate / JPA Applications

James Sugrue user avatar by
James Sugrue
CORE ·
Nov. 11, 11 · Interview
Like (0)
Save
Tweet
Share
5.28K Views

Join the DZone community and get the full member experience.

Join For Free

5 rules replace 500 lines of code. That's the claim from Automated Business Logic for their transaction logic engine: an engine that aims to automate the transaction logic layer for applications that plug into Hibernate or JPA. In particular, this framework aims to address the shortcomings of Hibernate's current attribute validation. But really, can we 500 lines of code be replaced?

To ensure certain rules are adhered to, you'll typically need to write logic somewhere - in a service layer, or in your DAOs. But with this engine, by using annotations on your Java (or Groovy) code, you avoid all this complex code. The suggested approach is to add your business logic in a parallel package to your Domain Objects. Annotations in these logic classes identify the methods for business logic - and the logic can be specified in the annotation, or programatically in the method code section.

There's much more to Automated Business Logic - while the constraints are a powerful feature, the engine also helps with multi-table derivations and actions. Complex cases such as allocation can be easily automated.

The pluggable architecture approach taken by the product means that the Hibernate and JPA APIs are preserved - you won't need to refactor your code to get the benefits of the transaction logic engine into your application.

Here's an overview of how it all works:

When you think about it, the approach is great. How much time do you waste writing boilerplate code? If you had the time you'd probably write a framework to get out of the mundane nature of repeating code. It's all provided for you here. There are other benefits - less boring code, means less bugs/maintainance on that code. And, most importantly, you can deliver your product faster.

Initially when I heard about this, I thought that I'd be adding yet another code generation phased into your project. Not so, as it's driven by annotations, and your own logic. If you work with JPA or Hibernate a lot, this could be the solution you've been looking for.

For a more complete overview, check out the following video:

Transaction logic Hibernate application Business logic

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Build an Automated Testing Pipeline With GitLab CI/CD and Selenium Grid
  • Practical Example of Using CSS Layer
  • 3 Main Pillars in ReactJS
  • How To Best Use Java Records as DTOs in Spring Boot 3

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: