Home » Eclipse Projects » EclipseLink » desktop Swing application with EclipseLink
desktop Swing application with EclipseLink [message #727803] |
Wed, 21 September 2011 21:12  |
Eclipse User |
|
|
|
I've started learning jpa and EclipseLink only few days ago, and till now i've succeeded to understand the basics of the API, but still don't feel able to build a serious application that can stand for long.
The problem is that i didn't find any articles that gives enough informations about some good practices/design patterns, that match the kind of applications i'm trying to build. I've found some articles talking about jpa in standalone applications, but still were dealing with clients and servers and using sessions, something that confuses me.
So just to make my self clear, the application i'm about to develop doesn't need any client or server or any kind of network communication, it's a mono-user Swing application, on which i intend to use EclipseLink with the Derby Embedded database. The application isn't a small one, it will have to deal with roughly 30 entities ...
I was thinking about creating one EntityManager at the start of the application, and to perform all my transactions through it until the application shutdowns, but after some researchs i figured out that such a solution may have performance issues ... creating an EntityManager and closing it on each transaction doesn't seem to be a good idea neither.
I need some indications that can put me in the right way, so any kind of help (tips, links ...) will be very appreciated.
Thanks
|
|
|
Re: desktop Swing application with EclipseLink [message #727861 is a reply to message #727803] |
Thu, 22 September 2011 01:22   |
Eclipse User |
|
|
|
I've written a fairly large Swing application (40 concurrent users, 100 entities) on top of an Informix database. The biggest thing with entity manager here, is how to user expects the application to behaves. I found that one EM per window (JFrame) is the most logical setup. (And one EntityManagerFactor per application.)
This means that you load entities once for each window. Modifications stay withing the window until they are saved.
Because you have multiple EMF's, you need to disable the second level cache.
Tom
On 2011-09-22 03:12, Marc wrote:
> I've started learning jpa and EclipseLink only few days ago, and till now i've succeeded to understand the basics of the API, but still don't feel able to build a serious application that can stand for long.
>
> The problem is that i didn't find any articles that gives enough informations about some good practices/design patterns, that match the kind of applications i'm trying to build. I've found some articles talking about jpa in standalone applications, but still were dealing with clients and servers and using sessions, something that confuses me.
>
> So just to make my self clear, the application i'm about to develop doesn't need any client or server or any kind of network communication, it's a mono-user Swing application, on which i intend to use EclipseLink with the Derby Embedded database. The application isn't a small one, it will have to deal with roughly 30 entities ...
>
> I was thinking about creating one EntityManager at the start of the application, and to perform all my transactions through it until the application shutdowns, but after some researchs i figured out that such a solution may have performance issues ... creating an EntityManager and closing it on each transaction doesn't seem to be a good idea neither.
>
> I need some indications that can put me in the right way, so any kind of help (tips, links ...) will be very appreciated.
>
> Thanks
|
|
| | | | | | | | | | | | |
Re: desktop Swing application with EclipseLink [message #728349 is a reply to message #728175] |
Fri, 23 September 2011 00:48   |
Eclipse User |
|
|
|
> @Gordon Thanks for the contribution
> Quote:
>> In a networked environment if the application would benefit from caching to alleviate demand on the database cache co-ordination is still an option with a desktop application, although you may need to consider total network traffic. (ie co-ordinate more static data but use @Cacheable false for volatile data.)
>
> I didn't understand much of this, could you explain more please. Knowing that i have no network traffic, do you think i should take more time to learn about coordination before starting to code?
Cache co-ordination are ways to still use the cache by, for example, only allowing certain low frequently modified entities to be cached. This requires not blunt usage of the cache, but coordinated use. A more advanced approach would be distributed caching, where caches are synced between Swing clients separately from the database. A interesting intermediate step would be to purge the cache in every client of all copies of an entity, if one client commits a change to that entity. Does Eclipselink have support for this, Gordon?
Tom
|
|
| | | | |
Re: (no subject) [message #729340 is a reply to message #729021] |
Sun, 25 September 2011 19:35  |
Eclipse User |
|
|
|
I gotta stop answering my self :d. Concerning the @cache and the @Cacheable both are for L2 Cache not for L1, hope this will help someone :).
|
|
|
Re: (no subject) [message #729341 is a reply to message #729021] |
Sun, 25 September 2011 19:35  |
Eclipse User |
|
|
|
I gotta stop answering my self :d. Concerning the @cache and the @Cacheable both are for L2 Cache not for L1, hope this will help someone :).
|
|
|
Goto Forum:
Current Time: Tue Jul 22 18:23:14 EDT 2025
Powered by FUDForum. Page generated in 0.05905 seconds
|