Ever since the Java Persistence API was announced there has been a lot of talk, both good and bad, about this specification. Many people have pointed out that a criteria API and something like hibernate filters are currently missing. However these features might be considered “exotic” and I can largely live without them. However a few weeks back I started working on my first JPA project and quickly encountered some missing features that where not exotic at all.
First of all Lists do not preserve ordering. Next time you retrieve your ordered list it will be returned in an unspecified order. This means that if you have to implement an application in which a user can move items up or down in a list, you will have to manage indexing yourself. How’s that for “transparent persistence”. Persisting the order of the List is something that is being considered for inclusion in a subsequent version of the specification.
JPA does not support unidirectional OneToMany relations well
Say you have an Order that contains a collection of OrderLineItems’s and you do not want the OrderLineItem to hold a reference to your Order. In JPA You cannot accomplish this without introducing a jointable.
For both these issues there are vendor specific extensions that help you work around these limitations. But I can’t help but feel flabbergasted that this isn’t supported.
Does anyone know of any more glaring omissions in this spec ?