Category Archives: Hibernate

Criteria Query – predicate

The following code will return one result based on 2 criteria:

  1. process entity attribute to be equal with process parameter
  2. state entity attribute to be equal with state parameter from function

Entity has these two attributes of type ENUM: process and state.

DB Table consist in a map between process and allowed states. Method findByType will return the correct entry based on one process and one state:

 

Criteria Query – find by id

Example of DAO implementation for Hibernate Criteria Query -> Find By Id

 

Model class has attribute: id