genericdao

generic dao architecture discuss-best prastice

i thinking of doing this architecture genericdao +interface ---> servicelayer+interface---> view layer my dao will only have generic methods, my service layers will have real logic for instance service layer method string executeThis= "select c from com.abc.test.User where username =:username"; Map tempMap = new HashMap(); tempMap...

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 dont want to use hibernate.I am trying to make it as generic as possible so that i dont have to repeate the same code again and again. public abstract class AbstractDAO<T> { protected ResultSet findbyId(String tab...

Up to date, JPA compliant GenericDAO Implementation

I read this article: http://www.ibm.com/developerworks/java/library/j-genericdao.html several times and believe I understand what it is saying. However, it is 4 years old and I have a JPA compliant Java application to contend with. In addition, I see that there is a JPATemplate in Spring that has some good functionality, but the Spri...

How to write a common get_by_id() method for all kinds of models in Sqlalchemy?

I'm using pylons with sqlalchemy. I have several models, and found myself wrote such code again and again: question = Session.query(Question).filter_by(id=question_id).one() answer = Session.query(Answer).fileter_by(id=answer_id).one() ... user = Session.query(User).filter_by(id=user_id).one() Since the models are all extend class Bas...

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<T> { public T get(Serializable id); //other CRUD operations } And this is my JPA's implementation: public abstract class AbstractDaoJpaImpl<T> implements AbstractDao<T> , Serializable { protected Entit...

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 methods was proposed, but I'm not very sure how to implement this using JPA. Could you please g...