Breeze with Java + Hibernate lets you develop JavaScript client applications using the same powerful idioms you find in Hibernate. You can

  • query with a rich query syntax
  • navigate the graph of related entities
  • track changes as you add/change/delete entities
  • perform client-side validation
  • save all changes in a single transaction
  • use your existing Hibernate entity model on the JavaScript client

Client and Server

Breeze JS is a pure JavaScript library for managing data on the client, much as Hibernate/JPA manages it on the server.

Breeze JS has an EntityManager that queries entities from the server, keeps them in cache, keeps track of the state of each entity, and saves the changes to the server when requested.

AngularJS / KO / Aurelia / etc.
Breeze JS
Java Server
Servlet / MVC / JAX-RS / etc.
Breeze Java
Hibernate / JPA

Breeze Java ( is a server-side library that works with Hibernate/JPA to manage persistence for Breeze client applications. It turns Breeze queries into Hibernate/JPA queries, and saves changes to the database using Hibernate/JPA.

The Breeze server is designed to be stateless. A Hibernate Session/JPA EntityManager is created to handle each query or save request, but then discarded. No long-running transactions, detached objects, or disconnected sessions are required. Entity state is kept on the client, not the server.

Breeze clients do not require a Breeze server; for example, BreezeJS will also work with existing RESTful APIs. The full power of Breeze comes with supporting the three types of client-server communication.

Client-Server Communication

Breeze client applications make three basic kinds of AJAX calls:

  1. Breeze metadata ‘GET’ requests
  2. Breeze query ‘GET’ requests
  3. Breeze save ‘POST’ requests

The breeze-hibernate library runs on the server and uses Hibernate to handle each of these requests.

Metadata Requests

The Breeze client requires metadata about the entity model in order to know the data types and relationships of the entities. The breeze-hibernate library uses the Hibernate metadata API to extract this information from the application’s Hibernate configuration. It creates a data structure that is serialized to JSON and returned to the Breeze client.

Query Requests

The Breeze client has a powerful query language that can send a variety of queries to the server. These queries are sent to the Java server in JSON format. The breeze-hibernate library converts these queries into Hibernate Criteria queries to query the database.

The query results, a collection of entities or graphs of entities, are serialized to JSON and returned to the Breeze client.

Save Requests

The Breeze client performs saves by sending an array of entities to the server as JSON in a POST request. The entities in the array are separate, i.e. not arranged in a graph. The breeze-hibernate library re-connnects the relationships between the entities, adds them to a Hibernate Session (in the appropriate order) as a save, update, or delete, and commits all the changes in a single transaction.

See the Getting Started page to start using Breeze.