Question « DAO « JPA Q&A





1. hibernate dao design question    stackoverflow.com

Im looking to create a generic DAO to handle CRUD in my hibernate app. My entities have most associations as LAZY fetching. But I find in order to have ...

2. ORM and DAO - design question    stackoverflow.com

I'm currently working on the project where this discussion came and I wanted to ask others what do they think about this. The DAO pattern is (according to wikipedia): "In computer software, ...

3. Design question for creating a DAO using Hibernate    coderanch.com

public class DAO { private static DAO daObject; Session session; SessionFactory sessionFactory; Transaction tx; private DAO() { sessionFactory = new Configuration().configure().buildSessionFactory(); session = sessionFactory.openSession(); tx = session.beginTransaction(); } public static DAO createInstance(){ if ( daObject == null) { daObject = new DAO(); } return daObject; } public void insertDatainDB(){ // then i use the session and tx in all my methods ...

4. Newb DAO & Service questions/advice    forum.hibernate.org

Hi all, I'm implementing a test app in Hibernate and have set up some things like so. I have a web command that calls a service, which then calls a dao, which in turn, deals with my Hibernate layer - I'm assuming from what I've read in many places, this is somewhat standard. Doing reads via this approach is working great. ...

5. Generic DAO question    forum.hibernate.org

I've been reading through forum posts regarding granularity of DAOs and I've decided that for my application, I'll have granular DAOs for complex queries, but I also want a generic DAO for general-purpose loading and saving of object subgraphs. Now to my question: I want one of my generic DAO methods to load an object (by ID) and all of its ...

6. Patterns Question: Are DAOs / class optimal?    forum.hibernate.org

This is a theoretical question rather than a question of use with Hibernate. In "normal" coding, you might have a DAO with methods for a Product class, say such as getById, getByCategory etc etc. Since tools such as Hibernate allow you to pass the class and a criteria query for example would allow you to pass a property or properties to ...

7. Question about using DAO objects    forum.hibernate.org

I m new to all this so i have the following question. Lets say i have a domain model with POJOS and DAO objects for each of this pojos that do all the data access work using hibernate. I want to ask if it would be bad practice to use a DAO object inside the getter of a collection preperty of ...

8. DAO/sf.getCurrentSession() threadsafety question    forum.hibernate.org

Beginner Joined: Wed Sep 17, 2003 10:43 am Posts: 48 After changing myconfig as Code: thread i get the following exception. Everything works fine when i switch back to default. Any Ideas? 00:07:14,505 ERROR [LogInterceptor] EJBException in method: public abstract java.io.Serializable gr.abiss.extradrive.domain.business.interfaces.CityManagerLocal.save(java.util.Map) throws javax.ejb.EJBException, causedBy: org.hibernate.HibernateException: load is not valid without active transaction at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:268) at $Proxy96.load(Unknown Source) at gr.abiss.extradrive.domain.dao.CityDAO.copyProperties(CityDAO.java:128) ...

9. newbie question:what is the best way to implement a DAO Laye    forum.hibernate.org

Hi The best way is you develop the DAOs with the help of Eclipse3.2 . Hibernate plugins are copy the eclipse pluginn folder first you select u r project and run hibernate and select hibernate code generation in that u select u select exporters and chech the DAO code(.java) and the then apply it will generate automatically





10. DOA or not DAO this is the question?    forum.hibernate.org

Hey, One of the greatest things in hibernate that you dont need to deal with DB. you are wotrking with object, like without the need to be aware to the DB, but this is not exactly true. For exmaple : I have User with OneToOne to City. In simple java code if i want to delete city all i need to ...