Skip to main content

Building a Simple Application

  • Chapter
  • First Online:
Beginning Hibernate

Abstract

In this chapter, we're going to create the shell of an application, which will allow us to demonstrate a number of concepts common for systems that use Hibernate. We'll be covering:

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    This seems almost logical.

  2. 2.

    It might be an excellent exercise for the reader to revisit this code and write it such that it's more efficient.

  3. 3.

    We’ll be revisiting this topic in more detail in Chapter 4.

  4. 4.

    We’re going to be revisiting transactions quite a bit in Chapter 4.

  5. 5.

    Note that Hibernate has validation facilities that make this sort of thing very easy to do; the way this is described here is rather unglamorous.

  6. 6.

    Of course, you could also just use the raw JPA interface. However, it’s much more limited than the Hibernate API.

  7. 7.

    How could we address it? Not very easily, that’s how. We could try to add semantic roles to each attribute–for example, we could mark Drew Lombardo as an observer, and J. C. Smell as a subject. If we used a subject where an observer was expected, then we could programmatically indicate an error condition. However, that doesn't help if Drew is an observer and a subject–which is likely to be a normal case.

  8. 8.

    One possibility for checking for side effects might be clearing the entire dataset (as we did in the RankingTest code, by closing the SessionFactory down every test), then clearing the data we expected to write and looking for any extraneous data. There are certainly other possibilities, but all of these are out of our scope here.

  9. 9.

    Pretty much everyone who knows SQL moderately well has probably been fuming about how we’re pulling data from the database. That’s okay–the way it's being done here is pretty lame.

  10. 10.

    Even with an embedded database, though, it can be faster; an embedded database can use internal access to the data to which our application code normally has no access, even before we consider the possibility of efficient queries through the use of indexes.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Joseph B. Ottinger

About this chapter

Cite this chapter

Ottinger, J.B., Minter, D., Linwood, J. (2014). Building a Simple Application. In: Beginning Hibernate. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-6518-4_3

Download citation

Publish with us

Policies and ethics