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:
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This seems almost logical.
- 2.
It might be an excellent exercise for the reader to revisit this code and write it such that it's more efficient.
- 3.
We’ll be revisiting this topic in more detail in Chapter 4.
- 4.
We’re going to be revisiting transactions quite a bit in Chapter 4.
- 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.
Of course, you could also just use the raw JPA interface. However, it’s much more limited than the Hibernate API.
- 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.
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.
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.
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
Rights 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
DOI: https://doi.org/10.1007/978-1-4302-6518-4_3
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-6517-7
Online ISBN: 978-1-4302-6518-4
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)