Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you run hibernate without a database set up?

I am currently working on an application that uses hibernate as its ORM; however, there is currently no database set up on my machine and I was wanting to start running some tests without one. I figure since hibernate is object/code based that there must be a way to simulate the DB functionality.

If there isn't a way to do it through hibernate, how can this be achieved in the general case (simulation of database)? Obviously, it wont need to handle large amounts of data, just testing functionality.

like image 840
alh Avatar asked Sep 18 '13 11:09

alh


People also ask

Does Hibernate require server?

Hibernate does not require an application server to operate. Manipulates Complex associations of objects of your database. Minimizes database access with smart fetching strategies. Provides simple querying of data.

How does Hibernate connect to database?

It represents the classname of a custom ConnectionProvider which provides JDBC connections to Hibernate. It is used to set the JDBC transaction isolation level. It enables auto-commit for JDBC pooled connections.

Can we use Hibernate instead of JDBC?

JDBC is database dependent i.e. one needs to write different codes for different database. Whereas Hibernate is database independent and same code can work for many databases with minor changes.

Does Hibernate use MySQL?

Hibernate will then use MySQL's autoincremented database column to generate the primary key values.


2 Answers

Just use an embedded DB like Derby

Maybe you could also try to use an ODBC-JDBC bridge and connect to an Excel or Access file, on Windows.

like image 158
SJuan76 Avatar answered Oct 19 '22 23:10

SJuan76


Hibernate is an object-relational mapping tool (ORM). You can't use it without objects and a relational database. Excluding either one makes no sense.

There are plenty of open source, free relational databases to choose from:

  1. MySQL
  2. PostgreSQL
  3. Hypersonic
  4. Derby
  5. MariaDB
  6. SQLite

You're only limited by your ability to download and install one.

like image 31
duffymo Avatar answered Oct 20 '22 01:10

duffymo