Questions tagged [genericdao]

48 questions
1
vote
2 answers

Best Spring API for developing GenericDao

I see lot of implementation technique about spring jpa(jpatemplate,japdaosupport spring-data-jpa ,native way entitymanager,HibernateSupport,ect ),which one is best technique for developing Generic DAO ,that should be clean resource allocation…
Arun
  • 1,087
  • 17
  • 36
1
vote
4 answers

Java DAO factory dynamic returned object type

I'm trying to write simple DAO that will create entity objects based on their type stored in String field. How to return type that is changed dynamicly? Method findById() of UserDAO class should return User class object. Same method for ProductDAO…
Matthias
  • 439
  • 1
  • 5
  • 15
1
vote
2 answers

Common lib for EntityManager CDI

I have a common generic DAO in common lib. I want in each module which uses this DAO to initialize with its own persistence UNIT public abstract class GenericDao implements IGenericDao { @PersistenceContext(unitName = "XXXX") private EntityManager…
cyril
  • 655
  • 4
  • 19
1
vote
2 answers

Slick 3.1.x Generic DAO for JdbcProfile error "value id is not a member of ..."

I'm trying to create a Slick 3.1.1 Generic DAO for my slick code-generated model. However, I'm facing one last compilation error that can't find how to fix. The whole project is available in GitHub play-authenticate-usage-scala and the relevant…
SkyWalker
  • 11,704
  • 14
  • 65
  • 144
1
vote
3 answers

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 =…
Freewind
  • 177,284
  • 143
  • 381
  • 649
1
vote
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…
1
vote
1 answer

Hibernate genericDao projection

I'm using Hibernate 4.2.7.Final with Google genericDAO 1.2.0. I'm interested in how can I write a search with group by? For example: select a, sum(b) from table group by a with Search search = new Search(); search.addFieldGroupBy("a"); //this does…
KatieAmber
  • 77
  • 12
1
vote
1 answer

JPA Generic DAO

I'm trying to implement a Generic DAO, using JPA, but I get a problem with this method: public List findAllByProperties( Map properties ) { CriteriaQuery queryByProperties = createQueryByProperties( properties ); …
1
vote
1 answer

Design pattern for Generic Dao, service layer in Spring without use of Hibernate

I have visited too many site and also question on stackoverflow for reference but i can't found exactly answer about below. I want to design an architecture for Generic DAO Pattern without using of hibernate. Currently I having trouble in …
Kamlesh Kanazariya
  • 1,079
  • 2
  • 11
  • 29
1
vote
4 answers

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…
cometta
  • 32,613
  • 72
  • 206
  • 316
1
vote
1 answer

How to use factory design pattern with GenericDAO?

I want to apply a generic design pattern for my DAO layer, such that I can switch between third-party ORM easily (Hibernate, JPA, etc.). Apparently we have some common methods for all DAOs like: public void create(T entity); public void update(T…
Java Player
  • 6,050
  • 26
  • 99
  • 154
1
vote
2 answers

What's the best way to calling a Stored Procedure using Hibernate in a Generic DAO?

I'm using MySql and my query to call is like: call SPGetChart (idNumber, nameChart);
Helio Bentzen
  • 485
  • 2
  • 9
  • 23
1
vote
2 answers

How generic DAO can return same type for all different DAO implementations?

I'm creating generic DAO for my DataNucleus JDO DAOs. Generic DAO will do get, update, delete, create operations and some other generic operations, so those implementations can be just extended in more specific DAOs. Is it possible to somehow extend…
newbie
  • 22,918
  • 75
  • 190
  • 297
1
vote
4 answers

Is it possible to write a simple generic DAO in Java without using reflection?

I am developing a toy data access mechanism in Java 6 (and above). Each model class should have a findById static method that should instantiate an object from the row with the specified id. I have come up with the approach displayed below. Is my…
prekageo
  • 348
  • 3
  • 15
1
vote
2 answers

Generic DAO and nested properties support

I am trying to perform a DB access through a DAO object, and I have bumped into the case where I need to query a field in another Entity. Considering two entities (EntityA and EntityB) that are connected in entity A through the foreign key…
nuno
  • 1,693
  • 1
  • 16
  • 47