File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes trying to understand javax.persistence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "trying to understand javax.persistence" Watch "trying to understand javax.persistence" New topic

trying to understand javax.persistence

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Im reading struts 2 in action and trying to model my login / authentication after the portfolio login presented in the book. Unfortunately while the book uses mysql the web site I am working off of is using web services to retrieve information.

I basically have 3 questions.

1. Is javax.persistence appropriate for web services and preserving entity data or should I be using something else?

2. In struts 2.1.8 does anyone know which jar the javax is in? I am looking at Struts2InAction.war and there are no javax jars so it must be in another jar. I have tried adding spring.jar and Struts2-oval-plugin- to my project and I still get the dreaded "import javax.persistence cannot be resolved"

3. Im afraid I dont understand why carrying around say 4 variables in a session per user will have any less over head than having a pojo object carried around for each user. What is the advantage?

Mark Garland
Ranch Hand

Joined: Nov 11, 2006
Posts: 226
Hi E Robb,

I'm reading the same book, although I don't think I'm as far as you are yet.

AFAIK (and I'm willing to be corrected here), javax.persistence is for the Java Persistence API - this is the API that can be used for storing entities in a Database. It's an API that has been derived for providers to then supply implementations to (e.g. Hibernate or TopLinks), and you can use it to get a consistent API regardless of the provider, for storing your Entities in a database.

However, if you are using WebServices, then this is the wrong API. Perhaps something like AXIS2/JAX-RPC/JAX-WS might be more useful if you are trying to get information from WebServices instead?

Hope that helps,


28/06/06 - SCJP - 69%, 05/06/07 - SCWCD - 92%, 28/02/08 - IBM DB2 v9 Fundamentals (Exam 730) - 87%, 18/11/08 - IBM DB2 v9 DBA (Exam 731) - 89%, 26/02/11 - SCBCD - 88%
I agree. Here's the link:
subject: trying to understand javax.persistence
It's not a secret anymore!