CHAPTER 6Mapping with Annotations

In Chapter 5, we discussed the need to create mappings between the database model and the object model. Mappings can be created as separate XML files, or as Java 5 annotations inline with the source code for your POJOs. In this chapter, we discuss the use of annotations, and in the next chapter, we will discuss the use of XML files.

Java 5 Features

Java 5 was introduced in late 2004 as a major new release of the language. Annotations are not supported by versions of Java prior to this, so while core Hibernate 3 is compatible with earlier versions, you will not be able to take advantage of the features described in this chapter unless your development, compilation, and runtime tools support at least version 5 ...

Get Beginning Hibernate: From Novice to Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.