I've been asked to support a Java EE application. The data model was poorly-designed and will not support several necessary use cases; so I'm developing a new data model using EclipseLink (the old one was built on iBATIS). Mind you, I'm no EclipseLink guru, and still have many questions about the best ways to utilize it.
For example, the current application has different entities for different types of requests-- let's say, CakeRequest, PieRequest, DonutRequest, etc. My first thought was to create a base Request type, then extend that with PieRequest, which can have fields specific to it, such as crustType and hasCoolWhip. Certainly, EclipseLink can do that.
However, I also need the ability to list all Requests, starting with the most recent. I'm not sure what the best way to handle this would be. In order to sort requests together, I need to be able to put all request types in a single collection, which defeats the purpose of polymorphism.
It could be that there are EclipseLink features which would help me out here, features that I'm unaware of; or perhaps Java itself could provide the answer. Does anyone have any suggestions? Thanks very much!