Summary
Mapping objects to relational databases is of critical importance to persistence applications. Dealing with the impedance mismatch requires a sophisticated suite of metadata. The Java Persistence API not only provides this metadata, but also facilitates easy and convenient development.
In this chapter we went through the process of mapping entity state that included simple Java types, large objects, enumerated types, and temporal types. We also used the metadata to do meet-in-the-middle mapping to specific table names and columns.
We went over how identifiers are generated and described four different strategies of generation. We saw the different strategies in action and differentiated them from each other.
We then reviewed some of the relationship concepts and applied them to object-relational mapping metadata. We used join columns and join tables to map single-valued and collection-valued associations and went over some examples of using different kinds of Collection types.
In the next chapter we will discuss using entity managers and persistence contexts in more advanced ways than we did previously, delving into the practices and nuances of injecting and using them in Java EE and Java SE environments.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2006 Mike Keith and Merrick Schincariol
About this chapter
Cite this chapter
(2006). Object-Relational Mapping. In: Pro EJB 3. Apress. https://doi.org/10.1007/978-1-4302-0168-7_4
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0168-7_4
Publisher Name: Apress
Print ISBN: 978-1-59059-645-6
Online ISBN: 978-1-4302-0168-7
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)