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)

Hibernate @ManyToMany Unidirectional and Bidirectional

Hibernate @ManyToMany Unidirectional and Bidirectional

Hibernate @ManyToMany Unidirectional The Many-to-Many relationship can be best described by example. The example we're going to use is that of the relationship between an Author and a Book. Author...

22 Elo 201453min

Hibernate @OneToOne Unidirectional / Bidirectional

Hibernate @OneToOne Unidirectional / Bidirectional

One-to-One Unidirectional Relationship Since you've already learned about the ins and outs of how unidirectional one-to-many and bidirectional one-to-many relationships work, it's time to learn about...

8 Elo 201436min

Hibernate @OneToMany Bidirectional Relationship

Hibernate @OneToMany Bidirectional Relationship

Since we've already learned about the unidirectional @ManyToOne relationship, we can now move on to talking about what a bidirectional relationship is like, when using Hibernate. The term "bidirection...

28 Heinä 201434min

Mapping Relationships with Hibernate

Mapping Relationships with Hibernate

In the past we have learned about database relationships, specifically the One-to-Many as well as the Many-to-Many and One-to-One and that was all good, great and grand… But now I want to talk about ...

23 Heinä 201455min

Hibernate's most important annotation - @Entity

Hibernate's most important annotation - @Entity

What You'll Learn The focus of this podcast / blog post is to teach you how to create the connection between your Java objects and the SQL Database tables. Remember, the whole point of the Hibernate ...

8 Heinä 201459min

Hibernate Persistence for Beginners

Hibernate Persistence for Beginners

What is a Persistence Framework? As the name implies, it has something to do with persisting things... this means that we're still talking about databases. But what is it that we are persisting with ...

3 Heinä 20141h 1min

The SQL Subquery

The SQL Subquery

The SQL Subquery Now that you've learned about SQL Joins, aggregate functionsand the group by keyword, it's time we moved on to our final topic in our SQL tutorial series. Today you'll be learning ...

25 Kesä 201448min

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