Hibernate - Creating Data Access Objects (DAOs)

Hibernate - Creating Data Access Objects (DAOs)

Data Access Objects – What are they?

Data Access Objects (or DAOs for short) are used as a direct line of connection and communication with our database. DAOs are used when the actual CRUD (CRUD = Create, Read, Update, Delete) operations are needed and invoked in our Java code. These data access objects also represent the "data layer" of our application.

These objects are still just plain old Java objects that incorporate the use of some Hibernate annotations to give them the functionality we need from them. Again, that functionality being the communication with the database.

Also, believe it or not, the concept of creating a file specifically for accessing the database is a design pattern. It's called the Data Access Object Pattern and you can read more about it from this nice short Wiki article.

What Hibernate Annotations Should We Use?

Okay, so now that you're somewhat familiar with DAOs, it's time to learn how to integrate these plain old Java objects with our Hibernate framework (so they actually do the work we need them to do).

There are two main annotations that you need to be familiar with:

  • @Repository
  • @Transactional

To learn more, visit our show notes page via http://howtoprogramwithjava.com/session52

Jaksot(112)

EP 64: CSS 101 Tutorial

EP 64: CSS 101 Tutorial

Cascading Style Sheets are a bit of a tricky beast in HTML. Given this fact, I wanted to dedicate an entire section to just this topic. Let's start with the basics, shall we? What are Cascading Styl...

17 Marras 201444min

EP 63: HTML Styles 101

EP 63: HTML Styles 101

In this HTML tutorial I would like to introduce two concepts to you: DOCTYPE Styles The DOCTYPE Currently as of the date this was published, web browsers are (mostly) supporting HTML 5. HTML has...

4 Marras 201448min

EP 62: Introduction to HTML

EP 62: Introduction to HTML

I'm so ridiculously excited to be introducing a whole new aspect of programming. Over the next few months I will be posting new articles on the topics of HTML, Javascript and jQuery. These are all tec...

29 Loka 201434min

HTML, CSS and JavaScript - Oh My!

HTML, CSS and JavaScript - Oh My!

The presentation layer is one of the three main layers in object-oriented programming. The three main layers include: Presentation Layer Business Layer Data Layer Now, these three layers are typical...

20 Loka 201440min

Hibernate Group By

Hibernate Group By

In our last Hibernate lesson, you learned how to fix duplicate data from hibernate queries. In this lesson we're going to focus on some of theaggregate functions that can be used with Hibernate, and ...

10 Loka 201443min

Fixing Duplicate Data from Hibernate Queries

Fixing Duplicate Data from Hibernate Queries

How to Fix Duplicate Data from Hibernate Queries This problem was the bane of my existence when I first started using Hibernate because I had no idea where the problem was coming from. If you're exe...

15 Syys 201431min

Hibernate Persistence Life Cycle

Hibernate Persistence Life Cycle

Now it's time to dive into the nitty gritty of Hibernate's mysterious inner workings. I'm by no means an expert in Hibernate, but I do use it almost every day for my own projects, so I do know a thin...

5 Syys 201442min

Fetch Type Lazy Vs Eager

Fetch Type Lazy Vs Eager

What the heck is a Fetch Type? Great question! Hibernate is a very handy framework for removing your need to fully understand SQL, but it will force you to understand things such as joins. Joining t...

27 Elo 201429min

Suosittua kategoriassa Liike-elämä ja talous

sijotuskasti
mimmit-sijoittaa
rss-rahapodi
herrasmieshakkerit
ostan-asuntoja-podcast
rss-sisalto-kuntoon
psykopodiaa-podcast
rss-rahamania
inderespodi
rss-startup-ministerio
taloudellinen-mielenrauha
sijoituspodi
lakicast
rss-h-asselmoilanen
rss-lahtijat
rss-uppoava-vn-laiva
rss-myynnilla-on-asiaa-kert-kenner
sijoitusovi-podcast
bakkari-tarinoita-tapahtumien-takahuoneista
rss-seuraava-potilas