Is it possible to use EJB 3.1 in desktop applications?
Is this possible? Does anyone ever do this? I feel like I can lay out my application better if I use what I'm used to in web applications. Would it possib开发者_开发知识库le to use this and dependency injection?
If this is not possible or a viable solution can anyone point me to a couple of example projects using JPA and EntityManger to query databases. Thanks.
You can use the JPA part of EJB 3.1 in Java SE or any Java environment. Most EJB 3 implementations of SessionBeans and such are normally coupled with an application server.
Spring offers dependency injection in any environment and supports JPA.
I guess, it is possible, but the stack is still heavy (both, in terms of resources and, more importantly, maintenance, installation etc.) I wouldn't do it, I would prefer MyBatis. Alternatively, use Hibernate, if you want to stay with JPA-like query language.
There is nothing wrong with using the concept of dependency injection, and Spring is widely used in many desktop apps.
精彩评论