Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Hibernate is an open-source object-relational mapping tool. We are using hibernate in OpenMRS to perform the majority of the low-level dirty work of communicating with the database. You can read more about hibernate at their website.

Using SQL directly

The following code shows how to inject raw SQL and fetch a string from the database.

String pwd = (String)session.createSQLQuery("select password from users where username = ?")
  .addScalar("password", Hibernate.STRING)
  .setString(0, "admin")
  .uniqueResult();

(see hibernate documentation for more details)

  • No labels