dao « dao « Java Database Q&A





1. J2EE - DAO DVO    stackoverflow.com

I have seen two ways of implementing DAO-DVO design. 1) DVO are objects and DAOs are instantiated using factories i.e DAOs are also objects 2) DVOs are again objects but in this case, ...

2. How can I write DAOs for resources with extensible properties?    stackoverflow.com

I'm trying to write an embedded (NOT web, not enterprise) content management system in Java, with a focus on organization and ease of use and scalability to 100,000 or so items. ...

3. JDBC DAO - any good reference implementation?    stackoverflow.com

Can anyone point me to a well written DAO using JDBC, that covers all the exceptions a DAO should handle. I looked at some samples at java.sun.com, their blue prints but there ...

4. How to cache information in a DAO in a threadsafe manner    stackoverflow.com

I often need to implement DAO's for some reference data that doesn't change very often. I sometimes cache this in collection field on the DAO - so that it is only ...

5. How are Data Access Objects usually designed?    stackoverflow.com

How are DAOs usually designed for the typical business application ? Does one class or pattern dialogue with the data source or do you simply have a separate DAO for each ...

6. recommendations for firestorm dao replacement    stackoverflow.com

I have taken over some code that has been using the Firestorm DAO code generator from CodeFutures. I believe that the license for this is going to be up ...

7. Maintaining a pool of DAO Class instances vs doing new operator    stackoverflow.com

we have been trying to benchmark our application performance in multiple way for sometime now. I always believed that object creation in java using Class.newInstance() was not slow (at least after ...

8. Java DAO caching    stackoverflow.com

I'm developing a medium Java app, and i'm facing a small problem due to my lack of experience. I've a custom DAO, which gets "Article" objects from the Database. I've the Article ...

9. JavaEE6 DAO: Should it be @Stateless or @ApplicationScoped?    stackoverflow.com

I'm currently creating an EJB3 Data Access Class to handle all database operations in my Java EE 6-application. Now, since Java EE 6 provides the new ApplicationScoped-Annotation, I wonder what state ...





10. Java web application DAO writing authenticated UserID and IP Address to DB    stackoverflow.com

I'd like to write to my Oracle DB the user ID and IP address of the logged in user (web app) whenever I perform SQL UPDATEs and INSERTs. Such as

public static ...

11. Dao methods, manipulating single/multiple objects and closing resources    stackoverflow.com

The usual advice is to close JDBC ressources once they're no longer needed. This could be done in a catch and finally. However, what if a DAO method only manipulates one ...

12. Use of DAO as a Command    stackoverflow.com

I need an advice w.r.t. one of the design approach we are considering. We are implementing a Java web service provider which acts on data in relational database. Our propose classes ...

13. Java Remove repeated try, catch, finally boilerplate from DAO    stackoverflow.com

I have a DAO class with many methods that have a lot of repeated code along the lines of: -

public void method1(...) {
  Connection conn = null;
  try {
 ...

14. Example of an XML DAO    stackoverflow.com

I'm unsure of how I could write a DAO to write information to XML files. I know how to use Sax and JDOM but what I'd like to know is how ...

15. Correct handling of return data    stackoverflow.com

I have a question related to correct handling of returns of the DAO library I'm writing for one project. This library probably is going to be used by another people and ...

16. Most effective way to reflect inheritance relationship in DAOs?    stackoverflow.com

Working on a business application using MVC structure and a Business Object / DAO pair architecture. For any normal business object, the CRUD functions are fairly straightforward. But what's ...





17. Use a DAO for reading CSV files?    stackoverflow.com

Is it an acceptable practise to use a DAO pattern to access CSV files? I'm asking because I'd usually have a utility method to read a CSV. Having a DAO would sort ...

18. Java Framework for Database operations    stackoverflow.com

At my work place, we use DAO pattern to hancle any sort of database operation. It hides bulky statements from programmer. Programmers need to write sql query and logic to handle ...

19. DAO generator for java    stackoverflow.com

I'm searching for free and simple DAO generator for java (it needs to create entities/bens from db tables/views and generate basic CRUD code). Currently, I`m using DAO4J which lacks some functionality ...

20. How can I improve my DAO? - Java EE    stackoverflow.com

I want to access my applicant database that's why I created a DAO class for it. I think I have lots of code smells because I keep on repeating some code. So ...

21. how to apply dependency injection in an inventory management system    stackoverflow.com

i want to implement a sales aand inventory management system, am confused ...

22. How to design a DAO class?    stackoverflow.com

What should be the best way to design a DAO class ? Approach#1: Design DAO class as an object.

class Customer {
//customer class
}

class CustomerDAO {
  public void saveCustomer(Customer customer) {
  //code
 ...

23. Can not instainate type Foo    stackoverflow.com

I would like build up a dummy dao class with help of List where the Advert is entity class, but when I try to create an instance with this code:

public AdvertDaoImpl() ...

24. org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback;    stackoverflow.com

org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [ select id from employeerole where username = kiran and pin is NULL]; The index 1 is out of range.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is ...

25. What is the best approach to write a data access object (DAO)?    stackoverflow.com

I was trying to write a user authentication system in Java. So I wrote some DAO class. First I did write a class named Persistence which is abstract. It is responsible ...

26. Not specifying which list implementation    stackoverflow.com

I have a doubt considering changing this :

List<String> elements = new ArrayList<String>();

 elements = elementDao.findElementsById(elementId);
to
List<String> elements;

elements = elementDao.findElementsById(elementId);
(I'm using DAO with Hibernate) Can this cause any errors or exceptions (the fact ...

27. Multiple DAO's vs One DAO with configuration file    stackoverflow.com

I'm currently in the process of creating a data access layer for an application. This application will initially connect to an Oracle database but will later also connect to a DB2 ...

28. NullPointerException when using DAO class    stackoverflow.com

I tried out DAO Pattern after reading http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html but I get NullPointerException when I run the servlet DAOFactory

package dao;
import java.sql.SQLException;
public abstract class DAOFactory {
// List of DAO types supported by the ...

29. Populating a List of Objects having One to many Relationship    stackoverflow.com

I have a few Objects that are related as such: A Document has one WorkflowInstance and each WorkflowInstance has many WorkflowInstanceDetails

public class Document implements Serializable {
  private static final long ...

30. Specify Ordering to a DAO Method    stackoverflow.com

Suppose I have the following DAO interface:

public interface CountryData {
    /**
     * Get All Countries.
     *
     ...

31. Using DAO with JDBC    stackoverflow.com

I have an architecture that looks like this: (client: android, server: web services axis2)

Presentation layer (Android activities and controllers):
    LoginActivity.java

WebServices Layer:
    Services.java

Domain Layer:
    ...

32. org.springframework.dao.InvalidDataAccessResourceU sgaeException    forum.springsource.org

Hi, I have added a new domain class to my existing grails project. When I click on link I am getting below error message. Error 500: org.springframework.dao.InvalidDataAccessResourceU sgaeException: could not execute ...

33. DAO factory and database performance    coderanch.com

hi all: if DAO factory frame work is used in a multi- threaded J2EE project, when is it appropriate to cach a single object and return it over and over again, vs. retruning a brand new object. for example: //cached object public class DAOFactory { privte EmployeeDAO MyEmployeeDAO = new EmplyeeDAO(); public EmplyeeDAO getEmplyeeDAO(); { return MyEmployeeDAO;} } vs. //new object ...

34. DAO Code Generator    coderanch.com

35. New to DAO    coderanch.com

36. Should a DAO contain another DAO?    coderanch.com

Let's say I have a business object with the following structure: class BusObj { BusObj2 busObjChild; } Is it considered bad design to do this: class BusObjDAO { public BusObj getBusObj(long id) { BusObj busObj = new BusObj(); //establish connection BusObj2DAO busObj2DAO = new BusObj2DAO(); BusObj2 busObj2 = BusObj2DAO.getBusObj2(id, connection); return busObj; } } or should I have some kind of ...

37. Need Help on DAO    coderanch.com

Hi all, I am in fond of learning DAO and trying to implement it in my project. I don't know where to start. Before that I'll just brief my expertise level. I know Core Java and I had done 4 to 5 projects in JSP and Servlets. If I want to learn DAO, what are the things I have to learn ...

38. having problem with a stored procedure used called by a DAO    coderanch.com

hi guys this question is actually about MSSQL but I wasn't sure where to post it I have a stored procedure in which I need to get all the classes which are taking place in a particular month for eg If I pass August 2006 it should get me all the classes which for eg start and end at these dates ...

39. DAO to Instance variables    coderanch.com

Originally posted by Puthriah Sarma: Is it OK to have instance variables in DAOs? Is my current design efficient? Appreciate expert opinion and thanks in advance. It totally depends !! It depends on how you are organising your code.I will not prefer to use any variable as instance variable, which deals with database. Using connection,statement or resultset as instance variable means ...

40. DB interaction in a DAO and Abstract Factory implementation    coderanch.com

Howdy fellow Java software engineers, This is not really a question concerning some kind of problem, but this is mainly an attempt to explore opinions and views regarding best practices. Currently I'm working on a project in which I have choosen to implement the DAO design pattern, including a DAO Abstract Factory to facilitate the opportunity for datasource replacement (which, for ...

41. DAO class design    coderanch.com

Hello ranch members, I have the following scenario and would like suggestions on the best possible design for it. TableA (id_A, blah1, blah2) TableB (id_B, id_A) I am using MySQL and id_A and id_B are primary keys for the respective tables. I am generating values for keys using AUTO_INCREMENT in MySQL. I have a single DAO class and want to insert ...

42. Nested Insert/Updates in DAOs    coderanch.com

Hi everyone hows it going? We have an application that generates dynamic reports. It could also generate different report templates. For every type of report, there are sections, for every section there are items, for every times there are sub-items and other fields. So a create/update report template method in our business object class looks like this: public void createReportTemplate(ReportData data){ ...

43. Anybody used the sequalite DAO framework?    coderanch.com

Hi, I have a small SWING based desktop application and I am looking for some persistence framework which is kind of small. I found this open source framework sequalite.sourceforge.net while doing a google search. Looks quite straight forward. Anybody used the sequalite DAO framework? Looks very tiny not sure how good is it? Please share your experiences. thanks, Supriya

44. How to use httpsession with dao factory    coderanch.com

Hi. I'm trying to build a simple login page and registration page. People login through the login page. I use a DAO Factory to check the database to see if their username and password is in there. I'm having problems setting up the httpsession. I had it working with the Httpsession but now I have problems. I also want the person ...

45. DAO (Data Access Object) as a Singleton - will objects created get garbage collected?    coderanch.com

We recently started using the DAO pattern to create classes used to retreive data from Oracle. We have a DAOFactory which is called to get a particular DAO class, which is really just an interface for an ORImpl class that accesses the database and gets the data. We created all of the ORImpl classes as singletons, with the private constructor, static ...

46. Master DAO or many DAOs ?    coderanch.com

Hi. In my application, I have domain objects like : Book, Author, Publisher (I'm using Hibernate).... I created interfaces like BookDAO, AuthorDAO and then implement them using HibernateDaoSupport. But while I'm coding my DAO's, a question came into my mind : Is it good to many DAOs (like my case) or to create a master DAO called for example : BookStoreDAO ...

47. DAO    coderanch.com

49. How automatically DAO methods get called upon    coderanch.com

If you elaborate the question more clearly, you would likely generate more useful response. Your last sentence "I want to know upon calling a DAO interface from the servlets (Correct me if i am wrong) how the DAO implementation class would be get called upon ? " is a bit too vague. Af far this sounds like that you wanted to ...

50. How to write DAO    coderanch.com

51. Separate DAO Classes    coderanch.com

Hello all Members, In my application, Can i Write all query related stuff in Separate DAO class ? Can I make Separate DAO class for each table in Database ? Can I write one separate method for a each query that i fired in my program? Can you tell me In this way, professional development occur? Please guide me in this ...

52. help required regarding DAO class    coderanch.com

53. how do I implement this Dao from my webpages?    coderanch.com

please can somebody help me with my code...I want to develop a web app...that uses dao to encapsulate all the methods and connections so that the all calls are to to dao and not to database....so far its been okay but when I tried to make it into a singleton object, it threw errors ..precisely 3 errors...I want to know why...and ...

54. DAO Design Question    coderanch.com

Hi Guys I'm busy working on a simple two-tier app - Swing on the front-end and a JavaDB database on the back-end. I have designed it to use DTO and DAO classes for each table in the database. Since the app isn't designed to work with thousands of records at a time, I want to load all data in a table ...

55. Improve performance in DAO    coderanch.com

56. Is it Okay if a DAO class is made as Singleton    coderanch.com

Assume that we have methods such as insert , update , select and delete inside my DAO class . So please tell me if i make this DAO class as Singleton . In my opinion this saves a lot of memory .please guide . But as per my knowledge as DAO methods contains reference to connection object , so there would ...

57. Confusion about DAO in Three-Tier Architecture!    java-forums.org

Hello all! Dear Members my question is related to Software-engineering approach about DAO (Data Access Object) in three tier architecture. Am a student and as for the final project of my course I had to develop a three tier web based application.. the approach I choose for my project was I divided my classes into three layers as required by the ...

58. DAO for Account Summary    forums.oracle.com

59. DAO Generator    forums.oracle.com

60. How to stored procedure using DAO    forums.oracle.com

61. DAO    forums.oracle.com

Hi all I am building a small application using strurs1.2.9 , netbeans 5.5.1 and postgresql as my data base. I am using DAO for my database connection . I have written all the dao class files and when i try to run it gives a error NullPointerException. When the same code is run on the different machine it is running fine. ...

62. DAO's    forums.oracle.com

63. What is and how can one write a DAO?    forums.oracle.com

64. do several "dao" can execute in order?    forums.oracle.com

65. DAO design dilemma    forums.oracle.com

Im not sure its the right topic to post it but Ill try I have to create a relatively simple app that manages personnel reviews and has very simple structure already implemented in legacy DB. Person Review N:N Person Person Review - N:1 Various Review Choices/enumerations (tech skills, lead skills, etc) Im having doubts on implementing DAOs and ...

66. Need help toinsert values in DB from Dao Test case    forums.oracle.com

public void insertPromo(Promo promo) { //promoInsert.insertDetails(promo, getNextId("x_promo_ui")); promoInsert.insertDetails(promo); } private class PromoInsert extends SqlUpdate { public PromoInsert() { super(getDataSource(), SQL_INSERT_PROMO_DETAIL); declareParameter(new SqlParameter("x_promo_ui.x_bus_org", Types{color:#ff0000}.INTEGER)); {color:#000000}*// but in my DB this field is defined as NUMBER but thrs no Types.NUMBER available.* declareParameter(new SqlParameter("x_promo_ui.x_promo_name", Types.VARCHAR)); declareParameter(new SqlParameter("x_promo_ui.x_promo_desc", Types.VARCHAR)); declareParameter(new SqlParameter("x_promo_ui.x_promo_reqd_flag", Types.VARCHAR)); declareParameter(new SqlParameter("x_promo_ui.x_promo_channel", Types.VARCHAR)); declareParameter(new SqlParameter("x_promo_ui.x_promo_benefit", Types.VARCHAR)); compile(); } public int insertDetails(Promo promo) throws ...

67. DAO and session Facade    forums.oracle.com

Hi I came across an design pattern where they call the DAO from Session facade. The purpose of session facade is to minimise the number of network calls. Even though there are no network calls involved why do they go for session facade to call the DAO. Wont a DAOFActory will help them doin this. Even if the requirement is to ...

68. DAO???    forums.oracle.com

69. DAO factory    forums.oracle.com

70. Controller, dao help with learning    forums.oracle.com

71. Difference between JDO and DAO?    forums.oracle.com

72. DAO depends on DAO but different implementation    forums.oracle.com

hi everybody! i have a problem in my application design .... I use DAO-Pattern to access objects which are persisted. my DAOs offers some common CRUD-operations. the bussiness-logic (session-handling, transaction-logic) is enculapsed in command-pattern. for the reason that the session-handling and transaction-logic depends on the underlying DAO implementation (transaction-handling hibernate is different to jdbc) there is a implementation dependency between DAOs ...

73. Singleton DAO and performance issues.    forums.oracle.com

74. Suggetions require on DAO implementation    forums.oracle.com

Well, you're naming them as OracleDatasources so they're not portable accross different databases. Secondly you're configuring the connections in code. A better way would have a connection pool set up, so you could configure it with an xml file/property file, ask the connection pool for a data source and use that. It would eliminate your database specific code as well. But ...

75. DAO use    forums.oracle.com

what is the use of DAO classes in web based applications Here's my take on it - DAO or Data Access Object is basically a class that acts as an itemidiary between 2 different parts of a program. This way neither side has to worry about who they are dealing with. Think of a mortgage broker as a DAO. They worry ...

76. Xdoclets for DAOs    forums.oracle.com

77. How to retrieve content from DAO Class and process in Controller Class?    forums.oracle.com

What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a ...