FAQ‎ > ‎

Technical FAQ's

These are very technical questions that we have been asked, they will only make sense if you're quite familiar with Java, JPA and Hibernate.

Why not use standard JPA callback methods instead of ABL's @Action methods?

JPA defines three callback mechanisms: internal callbacks, external callbacks, and listeners.

Internal callback methods cannot call EntityManager or Query methods and should not access any other entity objects. This is obviously a very serious restriction, which makes internal callbacks much less powerful than ABL's @Action methods.

That leaves external callbacks and listeners. In both cases, you need to define a separate class to implement them, which seems to defeat the argument that it would be simpler.

ABL defines a @Constraint annotation. Is this related to JSR-303 constraints?

No, this is different than JSR-303, which is mostly concerned with single-attribute validation. ABL's @Constraint deals with multi-attribute and even multi-table validations. JSR-303 does allow for class-level constraints, but they require you to create your own validation class, which is clunky and more difficult to manage.

Are Hibernate Formulas appropriate for Business Logic?

Hibernate formulas enable you to declare SQL expressions to derive attribute values.  While these may suffice for specific situations, they fall short of a general solution:
  • Performance
They only deal with transient data (so no pruning and adjustment possibilities)
  • Functional Issues
    1. They do not handle chained aggregates
    2. They are only materialized on initial retrieval, so are not responsive to subsequent transaction activity
    3. They can only refer to stored data (e.g, not a formula)
  • Extensibility
Hibernate formulas are limited to SQL.  By contrast, Business Logic is specified in via Java or Groovy, which provides a smooth migration into extending the set of rule types.  Automated Business Logic Extensibility support provides several key services for copying and allocation, enabling you to solve complex problems without code.  These are delivered with source, you can use them as illustrations of how to provide your own re-usable services.



Comments