Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java persistence in database [closed]

What is the simplest way to use database persistence in Java? I know, many frameworks exists around the Internet, but it could be fun to learn how to develop a persistence layer by myself and its design patterns. Where to start? Books, websites, how-tos, code-examples, etc.

like image 493
sgy Avatar asked Jul 14 '26 15:07

sgy


2 Answers

Start by looking at features and source code of pre-existing ones. Here are a couple (just to name a few in alphabetical order)

  • DbUtils: A very simple wrapper for JDBC. Maybe start looking here for ideas!
  • EBean: Similar to JPA itself
  • Hibernate: The de-facto standard that heavily influenced Java's JPA specifications
  • iciql: A friendly fork of JaQu
  • JaQu: H2's own domain specific language for querying databases
  • JDBI: Exposes relational database access in idiommatic Java
  • JDO: Apache Java Data Objects
  • jOOQ: Modelling SQL as a domain specific language directly in Java
  • MyBatis: "the world's most popular SQL mapping framework." [sic] (formerly iBatis)
  • QueryDSL: A SQL-like fluent API with many different backends (not just SQL)
  • Quaere: Similar to QueryDSL

And soon, you can edit this answer and add your own framework!

like image 72
Lukas Eder Avatar answered Jul 16 '26 04:07

Lukas Eder


it could be fun to learn how to develop a persistence layer by myself

Noooo! Don't be silly.

Use JDO or JPA. The first one is a generic object persistence API, the other one is aimed at RDBMS-es only.

They have various implementations, e.g. for JPA there is EclipseLink (formerly Oracle TopLink), which is also the reference implementation for JPA 2, and Hibernate, which is also very popular.

You really, really don't want to make your own. If you want to work in this area, then contribute to one of the existing projects instead.

like image 43
Jaka Jančar Avatar answered Jul 16 '26 04:07

Jaka Jančar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!