Java Persistence 2.2 Maintenance release statement
The Java Persistence 2.2 specification enhances the Java Persistence API with support for repeating annotations; injection into attribute converters; support
for mapping of the java.time.LocalDate, java.time.LocalTime, java.time.
LocalDateTime, java.time.OffsetTime, and ava.time.OffsetDateTime types; and methods to retrieve the results of Query and TypedQuery as streams.
Definition of ORM
The technique of bridging the gap between the object model and the relational model is known as object-relational mapping, often referred to as O-R mapping or simply ORM.
why object-relational mapping?
Main challenge of ORM
the challenge in object-relational mapping is not so much the complexity of a single mapping but that there are so many possible mappings.
Samples for non mapping issues
The Java Persistence API consists of four areas
ORM is older than Java itself
It may come as a surprise to learn that object-relational mapping solutions have been around for a long time; longer even than the Java language itself.
Two popular persistence APis at early days
The two most popular proprietary persistence APIs were TopLink in the commercial space and Hibernate in the open source community.
major advantage and disadvantage of data mappers
The biggest advantage of using a data mapping strategy like MyBatis is that the application has complete control over the SQL that is sent to the database. Stored procedures and all of the SQL features available from the driver are all fair game, and the overhead added by the framework is smaller than when using a full-blown ORM framework.
the major disadvantage of being able to write custom SQL is that it has to be maintained. Any changes made to the object model can have repercussions on the data model and possibly cause significant SQL churn during development. A minimalist framework also opens the door for the developer to create new features as the application requirements grow, eventually leading to a reinvention of the ORM wheel.
What was Java Data Objects (JDO)?
Java Data Objects (JDO) was inspired and supported primarily by the object-oriented database (OODB) vendors and never really got adopted by the mainstream programming community. It required vendors to enhance the bytecode of domain objects to produce class files that were binary-compatible across all vendors, and every compliant vendor’s products had to be capable of producing and consuming them. JDO also had a query language that was decidedly object-oriented in nature, which did not sit well with relational database users, who were in an overwhelming majority.
Few supported the specification, so JDO was talked about, but rarely used.
Sun announced that JDO would be reduced to specification maintenance mode and that JPA would draw from both JDO and the persistence vendors
and become the single supported standard going forward.
why not even just standardize on an open source product like Hibernate?
Binding a standard to an open source project like ibernate would be problematic for the standard and probably even worse for the Hibernate project.
Standardization might not be valued by the consultant or the five-person software shop, to a corporation it is huge. Software technologies are a big investment for most corporate IT departments, and risk must be measured when large sums of money are involved.
Besides portability, the value of standardizing a technology is manifested in all sorts of other areas as well. Education, design patterns, and industry communication are just some of the many benefits that tandards bring to the table.
The Java Persistence API
EJB 3.0 and JPA 1.0
released in 2006, ended up being divided into three distinct pieces and split across three separate documents.
JPA 2.0
The next release, JPA 2.0, went final in 2009.
New features included:
* Additional mapping capabilities
* Flexible ways to determine the way the provider accessed the entity state
* Extensions to the Java Persistence Query Language (JPQL)
* Probably the most significant feature was the Java Criteria API, a programmatic way to create dynamic queries.
JPA 2.1
The release of JPA 2.1 was in 2013.
The JPA 2.1 specification added:
* Mapping converters
* Stored procedure support
* Unsynchronized persistence contexts for improved conversational operations.
* It also added the ability to create entity graphs and pass them to queries, amounting to what are commonly known as fetch group constraints on the returned object set.
JPA 2.2
JPA 2.2 maintenance release was published by Oracle in June 2017.