Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use EJB 3.1 in desktop applications?

Tags:

java

jpa

ejb-3.1

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 possible 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.

like image 896
Drew H Avatar asked Jan 30 '11 23:01

Drew H


2 Answers

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.

like image 155
James Avatar answered Sep 23 '22 20:09

James


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.

like image 40
Alex Pakka Avatar answered Sep 23 '22 20:09

Alex Pakka