-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Been playing around with hibernate. An HQL delete query is not the way to do things; it's better to manipulate the objects and let Hibernate do everything for you.
- Loading branch information
Showing
6 changed files
with
47 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.schmal.dao; | ||
|
||
import com.schmal.domain.Category; | ||
import com.yammer.dropwizard.hibernate.AbstractDAO; | ||
import java.util.List; | ||
import org.hibernate.SessionFactory; | ||
|
||
public class CategoryDAO extends AbstractDAO<Category> | ||
{ | ||
public CategoryDAO(SessionFactory factory) | ||
{ | ||
super(factory); | ||
} | ||
|
||
public List<Category> save(List<Category> categories) | ||
{ | ||
for (Category category : categories) | ||
{ | ||
persist(category); | ||
} | ||
|
||
return categories; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters