简体   繁体   中英

Can i implement my own JPA?

I'm new to JPA, and i understands that JPA is an interface that Hibernate and eclipse link are implementing.. can i implement it myself? or use JPA without Hibernate or eclipse link ?

all the tutorials and examples I've seen regards one of the implementations, but as for this answer: What is a JPA implementation?

If you want your application to be portable, use only JPA.

how can I use only JPA ? do someone know for such a tutorial to write my own PersistenceProvider(i thinks that's what i need to do..)

Thank you.

You should not build your own JPA implementation, but use the JPA API and rely on an implementation such as Hibernate or EclipseLink. As long as you'll use classes/interfaces in the javax.persistence namespace (or package if you prefer), you'll be strictly using JPA.

The only reason to implement JPA is that you are the provider-manufacturer of an enterprise-level ORM such as Hibernate or iBatis.

JPA is a standard wrapper for the existing ORM products, it is an option available to you to use it as a wrapper for your ORM. It can't be used (as far as I know) appart from an ORM.

That in the case that your decision is to use an ORM for your database access. You must consider every option: does JDBC stand-alone suit you for your job? Would an object abstraction layer bring anything to your application? Is there any legacy condition that you must consider (for example, tons of code in PL/SQL that hide the tables from you) that would make you discard an ORM?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM