Reputation: 13767
I'm just writing a small java application and I would like to be able to persist the data model in a database. So I was wondering if I could use JPA for this. I used JPA some time ago, but as far as I remembered it required an application server. So I'm wondering can I just JPA to persists my classes w/o using an application server.
Upvotes: 6
Views: 3273
Reputation: 64632
Yes, you can use JPA without an application server. Here's a tutorial which may help you: TopLink JPA: How to use JPA with Java SE
Upvotes: 2
Reputation: 67760
JPA is, umm, "traditionally" associated with application servers because JPA is part of the Java EE spec. However, that doesn't mean individual implementations of JPA can't work outside of an app server.
I've personally done this with Hibernate, which is perhaps the most popular JPA implementation. The Hibernate documentation gives you some tips about how to run Hibernate in a standalone application.
Upvotes: 2
Reputation: 15577
No J2EE server present in this tutorial http://www.datanucleus.org/products/accessplatform/guides/jpa/tutorial.html
Upvotes: 0
Reputation: 2206
You're probably better off using Hibernate standalone; it's a bit easier to manage without the extra JPA layer on top. There isn't that much difference anyway.
Upvotes: 0
Reputation: 47373
Yes, you can use JPA
without any application server. Look at section 2.4 in this tutorial for Hibernate.
Upvotes: 2