• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA Drawbacks

 
Mimmo Ludovico
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In some test on Java I found that as correct answer for

"Which statement identifies a risk of adopting JPA?"

the correct answer is

"JPA’s query language relies on a container to manage the persistence layer."

Why it coukd be a drawback?
 
Campbell Ritchie
Sheriff
Posts: 51368
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please always tell us where such questions come from. And remind us what JPA means.
 
Mimmo Ludovico
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

thanks for the fast answer. I fuon the quesiton here:

http://www.coderanch.com/t/639200/Mock-Exam-Errata/certification/Errors-SelfTest-Engine-Demo
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15628
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can see why that could be considered a risk compared to using plain JDBC: to use JPA, you need a container or library that implements JPA, because JPA is not implemented in the standard JDK. You'd for example need to include Hibernate or some other implementation of JPA into your project.

However, in my opinion using JPA is still much better than using plain JDBC. With plain JDBC, you'll have to write a lot of low-level code by hand to convert from objects to SQL statements and back. In any non-trivial application, it will be much more work to use plain JDBC than JPA, and using JDBC will become a maintenance nightmare. Using JDBC vs using JPA is like programming in assembly language vs programming in a higher-level language.
 
Mimmo Ludovico
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed I agree with you, but I don't understand why the test give that answer and identify it like a drawback
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15628
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having to include external libraries, such as Hibernate, can be considered a risk - if there's a bug in Hibernate or whatever other JPA implementation you use, then that could affect your project. The more code and libraries you put into a project, the bigger the chance is that there's a bug somewhere that might affect the project. (But the risk is limited, and for example Hibernate is used by many thousands of companies around the world - if there would be some major bug in it, somebody most likely would have discovered it already).
 
Mimmo Ludovico
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I understood it. But the following could be consider risk?

A. JPA only works with well-known data models.
B. JPA may be able to model every table as a class.


I need to choice only one answer. I need to choice the best
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic