Questions tagged [genericdao]
48 questions
49
votes
5 answers
Single DAO & generic CRUD methods (JPA/Hibernate + Spring)
Following my previous question, DAO and Service layers (JPA/Hibernate + Spring), I decided to use just a single DAO for my data layer (at least at the beginning) in an application using JPA/Hibernate, Spring and Wicket. The use of generic CRUD…

John Manak
- 13,328
- 29
- 78
- 119
28
votes
2 answers
How do I implement a DAO manager using JDBC and connection pools?
My problem is as follows. I need a class that works as a single point to a database connection in a web system, so to avoid having one user with two open connections. I need it to be as optimal as possible and it should manage every transaction in…

Carlos Vergara
- 3,592
- 4
- 31
- 56
14
votes
1 answer
How to retrieve common values (IpAddress, TenantId) in GenericDao?
We are using the Play! framework for HTTP sessions.
tenantId and ipAddress are columns that are common across multiple tables.
When the user is logged in, we are storing the tenantId in HttpContextSession
Whenever we require the ip address of the…

Kathiresa
- 421
- 2
- 6
- 15
9
votes
2 answers
Abstract DAO pattern and Spring's "Proxy cannot be cast to ..." problem!
I know this is very often asked , but I cannot find a working solution :
This is my AbstractDAO :
public interface AbstractDao
{
public T get(Serializable id);
//other CRUD operations
}
And this is my JPA's implementation:
public abstract…

smallufo
- 11,516
- 20
- 73
- 111
9
votes
5 answers
Spring MVC: Generic DAO and Service classes
I am writting web in Spring MVC. I wrote all DAOs using Generic DAO. Now I would like to rewrite my Service classes. How can I write "Generic Service"?
There are my DAOs:
/* ################################# DAO ################################…

martin
- 1,707
- 6
- 34
- 62
8
votes
7 answers
generic DAO in java
I am trying to develop generic DAO in java. I have tried the following. Is this
a good way to implement generic DAO? I don't want to use hibernate. I am trying to make it as generic as possible so that I don't have to repeat the same code over and…

akshay
- 111
- 1
- 2
- 4
7
votes
1 answer
Injecting generic Beans with CDI/Weld
I just come from my tiny nice JavaSE/Guice world and am currently discovering the path of "carried by the container"-EE6. After having some trouble with Glassfish3.1, I just switched to JBoss and am now facing a problem that shouldnt be one.
As…

dwegener
- 482
- 5
- 15
7
votes
1 answer
Generic DAO pattern implementation Design
I am working on a GWT+Hibernate project. It consists of various module out of which I will name two - Company and Login. For each module, I have created an RPC service so that the project doesn't end up with one God-like service that does…

bhootjb
- 1,501
- 1
- 21
- 33
5
votes
4 answers
What is the best practice for service-dao pattern?
let's think about a simple User insert operation. My Spring related classes to do this job are UserController, UserService, UserServiceImpl, UserDAO, UserDAOImpl.
At controller side i call userService.insert(new User()) and in userService.insert()…

user1153321
- 347
- 6
- 18
2
votes
1 answer
Spring data repository and DAO Java Generics
Reading about using Java Generics in DAO layer, I have a doubt applying this in spring data repositories. I mean, with spring data repositories, you have something like this:
public interface OrderRepository extends…

fernando1979
- 1,727
- 2
- 20
- 26
2
votes
0 answers
Any alternatives to Google's Generic DAO?
For some time, I was using Google's Generic DAO paired with Hibernate. But now Google's Generic DAO no longer developed & I decided to find an alternative.
Advise an alternative, pls! Except Spring.

Alexiuscrow
- 776
- 2
- 15
- 34
2
votes
2 answers
Pros and Cons of DAO dependent on DAOFactory
Recently I came across code where DAO has an instance of DAOFactory. And DAOFactory has Connection. DAO uses Connection of DAOFactory for its operations. Basically DAO was dependent on DAOFactory. This is the code:
DAOFactory.java:
public…

srh
- 1,661
- 4
- 30
- 57
2
votes
2 answers
What is the pros and cons of using Generic DAO and Generic Service Pattern in Spring MVC with Hibernate
I have a thought to implement Generic DAO and Generic Service in my new project. I have seen lot of examples in the web.
Before start I want to know the pros and cons of using this design pattern.
Can any one tell Is it advisable to use this…

Neelakandan Sivathanu
- 55
- 2
- 10
2
votes
2 answers
getCurrentSession() vs openSession()
I'm trying to use generic-dao (http://code.google.com/p/hibernate-generic-dao/ ). However, in my HibernateBaseDAO the getSession() method is implemented as sessionFactory.getCurrentSession(). This leads to an error for any entity update…

obh
- 334
- 4
- 10
2
votes
3 answers
Spring Generic Dao class name
I have configured a custom generic service DAO for my spring / hibernate project - the idea being that I can reuse it easily from my controllers.
It essentially looks like this:
public class DefaultService {
private Class e;
public String…

Toby
- 1,651
- 2
- 18
- 31