-1

I am creating a Java EE project that has over 40 database tables. Which persistence API is better to use for such a project: hibernate/jpa etc..

I could not find any post corresponding to this scenario even on google.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
nkvp
  • 342
  • 1
  • 8
  • 15

2 Answers2

5

You have lots of options, and your question is not easy to answer without knowing more about your specific requirements.

When you want to get "persistence" up and running fast, use JPA. JPA is optimal for you if you don't care about SQL or the relational model too much, but instead want to "persist" data and perform CRUD (OLTP). Some sample implementations:

When you want to control your SQL, use non-standard frameworks. These may be better suited when you want to have fine-grained control over the queries that are emitted by the framework, because you want to perform much more than "CRUD" (i.e. OLAP):

When you want to do it all on your own, use JDBC, directly (which is also a "persistence API" in a way)

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
  • but then do i have to generate 40 classes if i use JPA? wont it slow the system? – nkvp Feb 04 '12 at 18:24
  • @nkvp: Please be more specific about your use-case. What *do* you want to do and what *don't* you want to do. You don't *have* to generate 40 classes, but it's hard to say from the little information you gave, whether JPA is suited for you. Please update your question accordingly N.B: 40 tables / classes are a rather small database. There's probably no need to worry about performance. – Lukas Eder Feb 04 '12 at 18:26
  • it is a hospital management system(with doctor, patient, medicines e.t.c), that has a ejb based web service and has 2 clients, a jsp web application and a java standalone application – nkvp Feb 04 '12 at 18:29
  • @nkvp: With that information, all of the above frameworks will work nicely – Lukas Eder Feb 04 '12 at 18:30
  • ok...thank you so much...i have one more question on authentication, can u pls help me out if possible..the link is http://stackoverflow.com/questions/8864879/web-service-authentication-in-java-ee ... pls check the comment posted to the answer... – nkvp Feb 04 '12 at 18:35
  • it does'nt matter if you can't help me out... thank you so much... – nkvp Feb 04 '12 at 18:37
  • @nkvp: Well, that's another very open question. I can't help you there... – Lukas Eder Feb 04 '12 at 18:43
  • ok, anyway , which would you prefer? – nkvp Feb 04 '12 at 18:47
  • nice site: http://www.jooq.org/ – nkvp Feb 05 '12 at 02:08
  • @nkvp: I'm biased as I'm the creator of jOOQ... – Lukas Eder Feb 05 '12 at 11:35
3

JPA with whichever implementation you like: Hibernate, EclipseLink.

(JPA is a standard that has multiple implementations)

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • but what about the classes, do i have to generate all the 40 classes... wont it slow the system? – nkvp Feb 04 '12 at 18:25
  • ok...thank you so much...i have one more question on authentication, can u pls help me out if possible..the link is http://stackoverflow.com/questions/8864879/web-service-authentication-in-java-ee ... pls check the comment posted to the answer... – nkvp Feb 05 '12 at 02:06