Hello,
We have developed a simple container to use with EclipseLink and wanted to share it with community. Any input from you will be appreciated, as we would like it to be as optimal as possible.
It seems that EclipseLink is terribly underrated, compared to Hibernate. It comes with much better session management architecture and, when properly used, is much faster than Hibernate, yet extremely simple to configure.
Our container now supports filtering and sorting by Vaddin Container API and additionally by Expression objects. It caches it’s element’s indexes to improve performance, as well as optimizes object fetching to maximize probability of EclipseLink’s cache hits.
Moreover, it reads class meta data from EclipseLink engine, so persistence can be configured in whatever way you want (EclipseLink lets you do it by annotations, XML configuration, class descriptors, or any mix of above).
An idea occurred to me: could the item class be a template parameter instead of a settable property? I mean that instead of:
container = new AbstractEclipseLinkContainer() ...
container.setItemClass(Comment.class);
You would say:
container = new AbstractEclipseLinkContainer<Comment>() ...
API would be a little cleaner that way, but if the item class needs to be changed for a previously created instance you can’t use a template parameter.
Unfortunately to prepare statements to database we need to be able to get the .class object representing the type we want to retrieve from database. It is also needed to read EclipseLink’s persistence meta data and configure things like public key field name or cache size “auto-magically”.
But … if you can point us to a method of getting the class object from generic type argument it would be no problem. We have tried to find one in another project but it seemed impossible.
BTW there is a constructor declared that can take class object as its argument so this container could be created in one line of code
container = new AbstractEclipseLinkContainer(Comment.class) ...
We have also added couple more methods since Michal write his post but we will upload new version … probably with some example usage later this week when we finish couple more things we have in mind.
In that case your API is perfectly fine. There is a
really contrived way to get the Class instance of a type parameter, but it’s a lot simpler and clearer to just pass it in a constructor or setter.
Package with some additional stuff like servlet witch automatically configures access to database, singleton session broker, some i18n tools etc. available at the address from the first link.
I really hope that now when it is usable almost out-of-the-box someone will actually use it … if You do and have some constructive criticism let us know.
Is this addon still being developed and if so are there any updates. I am using EclipseLink as my ORM implementation and think this container addon is very useful, do you have any get started tutorials