How to implement DAO pattern in CMP

How do I use the DAO pattern when going for container managed persistence, because all the database access is defined by the CMP.
How to go about it ?

Hi,
The DAO pattern http://java.sun.com/blueprints/patterns/DAO.html
is used with Bean Managed Persitence(BMP). For CMP you should not write the SQL in the EJB code, but instead let the container generate the SQL and handle all the data access.
Another pattern that might help when modelling your EJBs is the Composite Entity pattern at
http://java.sun.com/blueprints/patterns/CompositeEntity.html
Also, the new J2EE BluePrints book has some tips and strategies in the EJB tier chapter at
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/index.html
hope that helps,
Sean

Similar Messages

  • Implementing DAO Pattern in ABAP

    This discussion implement DAO pattern asked the question of how to develop a DAO pattern in ABAP but i'd like to go a little deeper.
    The only answer given suggested the following design pattern:
    I don't have an coded example here, but isn't it sufficient for this pattern  to build an interface with some get- and set-methods? This interface can be implemented by several classes with different data retrieval logic. Then a static factory-method could do the job to decide during runtime which actual class is instantiated, returning the interface.
    Can anyone give an abstract description of this implementation relative to an SAP module (How would one approach this implementation in MM, PM, FICO, HR)
    Can anyone see any issues in this design?
    Can anyone provide an alternate design?
    Are we missing any steps?
    Together we can build a solid abap DAO everyone can use.

    I started to read about DAO pattern some days ago and found this great blog post:
    ABAP Unit Tests without database dependency - DAO concept
    I am starting to implement unit test in my developments and DAO pattern seems to be a clever choice.
    Regards,
    Felipe

  • How to implement command pattern into BC4J framework?

    How to implement command pattern into BC4J framework, Is BC4J just only suport AIDU(insert,update,delete,query) function? Could it support execute function like salary caculation in HR system or posting in GL(general ledger) system? May I create a java object named salaryCalc which use view objects to get the salary by employee and then write it to database?
    Thanks.

    BC4J makes it easy to support the command pattern, right out of the box.
    You can write a custom method on your application module class, then visit the application module wizard and see the "Client Methods" tab to select which custom methods should be exposed for invocation as task-specific commands by clients.
    BC4J is not only for Insert,Update,Delete style applications. It is a complete application framework that automates most of the typical things you need to do while building J2EE applications. You can have a read of my Simplifying J2EE and EJB Development Using BC4J whitepaper to read up on an overview of all the basic J2EE design patterns that the framework implements for you.
    Let us know if you have more specific questions on how to put the framework into practice.

  • Implement DAO pattern

    In my application I have some database tables with a persistency class. Some other objects are implemented by calling the service bus, some others are implemented by function modules.
    I want that the developer doesn't need to know where the object is coming from.
    Therefore I want to implement the DAO pattern (Data Access Object).
    I'm new on abap objects, so can somebody give me a working example or blog, or guidelines how to code this pattern?

    I don't have an coded example here, but isn't it sufficient for this pattern  to build an interface with some get- and set-methods? This interface can be implemented by several classes with different data retrieval logic. Then a static factory-method could do the job to decide during runtime which actual class is instantiated, returning the interface.

  • How to implement Strategy pattern in ABAP Objects?

    Hello,
    I have a problem where I need to implement different algorithms, depending on the type of input. Example: I have to calculate a Present Value, sometimes with payments in advance, sometimes payment in arrear.
    From documentation and to enhance my ABAP Objects skills, I would like to implement the strategy pattern. It sounds the right solution for the problem.
    Hence I need some help in implementing this pattern in OO. I have some basic OO skills, but still learning.
    Has somebody already implemented this pattern in ABAP OO and can give me some input. Or is there any documentation how to implement it?
    Thanks and regards,
    Tapio

    Keshav has already outlined required logic, so let me fulfill his answer with a snippet
    An Interface
    INTERFACE lif_payment.
      METHODS pay CHANGING c_val TYPE p.
    ENDINTERFACE.
    Payment implementations
    CLASS lcl_payment_1 DEFINITION.
      PUBLIC SECTION.
      INTERFACES lif_payment.
      ALIASES pay for lif_payment~pay.
    ENDCLASS.                 
    CLASS lcl_payment_2 DEFINITION.
      PUBLIC SECTION.
      INTERFACES lif_payment.
      ALIASES pay for lif_payment~pay.
    ENDCLASS.                   
    CLASS lcl_payment_1 IMPLEMENTATION.
      METHOD pay.
        "do something with c_val i.e.
        c_val = c_val - 10.
      ENDMETHOD.                   
    ENDCLASS.                  
    CLASS lcl_payment_2 IMPLEMENTATION.
      METHOD pay.
        "do something else with c_val i.e.
        c_val = c_val + 10.
      ENDMETHOD.  
    Main class which uses strategy pattern
    CLASS lcl_main DEFINITION.
      PUBLIC SECTION.
        "during main object creation you pass which payment you want to use for this object
        METHODS constructor IMPORTING ir_payment TYPE REF TO lif_payment.
        "later on you can change this dynamicaly
        METHODS set_payment IMPORTING ir_payment TYPE REF TO lif_payment.
        METHODS show_payment_val.
        METHODS pay.
      PRIVATE SECTION.
        DATA payment_value TYPE p.
        "reference to your interface whcih you will be working with
        "polimorphically
        DATA mr_payment TYPE REF TO lif_payment.
    ENDCLASS.                  
    CLASS lcl_main IMPLEMENTATION.
      METHOD constructor.
        IF ir_payment IS BOUND.
          me->mr_payment = ir_payment.
        ENDIF.
      ENDMETHOD.                  
      METHOD set_payment.
        IF ir_payment IS BOUND.
          me->mr_payment = ir_payment.
        ENDIF.
      ENDMETHOD.                  
      METHOD show_payment_val.
        WRITE /: 'Payment value is now ', me->payment_value.
      ENDMETHOD.                  
      "hide fact that you are using composition to access pay method
      METHOD pay.
        mr_payment->pay( CHANGING c_val = payment_value ).
      ENDMETHOD.                   ENDCLASS.                  
    Client application
    PARAMETERS pa_pay TYPE c. "1 - first payment, 2 - second
    DATA gr_main TYPE REF TO lcl_main.
    DATA gr_payment TYPE REF TO lif_payment.
    START-OF-SELECTION.
      "client application (which uses stategy pattern)
      CASE pa_pay.
        WHEN 1.
          "create first type of payment
          CREATE OBJECT gr_payment TYPE lcl_payment_1.
        WHEN 2.
          "create second type of payment
          CREATE OBJECT gr_payment TYPE lcl_payment_2.
      ENDCASE.
      "pass payment type to main object
      CREATE OBJECT gr_main
        EXPORTING
          ir_payment = gr_payment.
      gr_main->show_payment_val( ).
      "now client doesn't know which object it is working with
      gr_main->pay( ).
      gr_main->show_payment_val( ).
      "you can also use set_payment method to set payment type dynamically
      "client would see no change
      if pa_pay = 1.
        "now create different payment to set it dynamically
        CREATE OBJECT gr_payment TYPE lcl_payment_2.
        gr_main->set_payment( gr_payment ).
        gr_main->pay( ).
        gr_main->show_payment_val( ).
      endif.
    Regads
    Marcin

  • How to implement Observer Pattern?

    Hello guys,
    I have some problems with implementing the observer pattern. So i m making an sound application and i need to put a meter changing with the volume.
    I have already the meter designed and the volume is calculated.
    So i have a class called Application (is the main class) and this class have the graphic designer from the application, makes the audio capture and calculate the volume.
    And i have the MeterMic class and in this class i have the graphic Meter where i send this graphic meter to the application via JPanel.
    In MeterMic i have the variable "value" and this variable will make the changes in the bars of the meter and i want to equal the value to the volume from the application. I try referencing by the Application object but doesnt pass the value from the volume.
    So i would like to implement the Observer pattern.
    I need to observ the variable volume and than the volume have changes i want to send that change to variable value in MeterMic.
    My problem is: who is the observer and observ? And what i need to do to implement the pattern.
    My best,
    David

    Kayaman wrote:
    DavidHenriques wrote:
    So i just need to implement the observers interfaces and than implement the method update and notify in the classes.You should probably forget the Observer/Observable classes, they're Java 1.0 stuffDo you think they are usless just because they are old?
    so you don't have to or need to use them, even though the names sound appealing.I still like them because the Observable saves me from repetitively implementing (hopefully thread save) method for notifying the observers...
    It's basically the same thing, you just see a lot more talk about Events/Listeners than Observers/Observables these days.The good thing on Events/Listeners is that they are type save which is an importand feature.
    But I like to build them on top of Observer/Observable on the event source side.
    bye
    TPD

  • How to implement find methods in CMP?

    As OC4J does not support EJB-QL, we need to implement the find methods by ourselves. But how? Here is my thought.
    1) Still declare the find methods in EJB home, such as
    public Collection findBySponsor(String sponsorGuid);
    2) Do not add query part to ejb-jar.xml file;
    3) In the bean class, implement the find method using JDBC code.
    Does CMP allows explicit-implementation of finder methds?
    Does CMP allows explicit-call to JDBC code?
    Thanks,

    Henry -- Why go to that trouble? For the near term I would suggest that you just modify the generated
    orion-ejb-jar.xml descriptors which will include tags to allow you to either 1) enter a partial criteria or
    2) enter a complete SQL statement. This is much less work and when EJB-QL is available with the product,
    then you have to only add the EJB-QL to the ejb-jar.xml.
    Thanks -- Jeff

  • How to implement sql query in cmp bean?

    let's say that i want to join two tables and use grouping, counting and sorting expresion. it is no problem with sql query but what about cmp bean?
    of course i can make one bmp bean or session bean and run directly sql expresion, but then what is the point of using cmp beans?
    thanks
    winnicki

    If yout need post-query for filling descriptive colums (eg. department name in emploees) you should build a view object which includes the descriptive colums by joining the relevent tables

  • How to implement pattern matching in RFC input paramenter?

    Dear Friend.......
    I have a requirment for implement a pattern match for name field of vendor in one of RFC.........
    For ex..........
    Name field:-  A* -> give all list of name  starting with a.
    how can we implement this?
    Any way............Suggest me
    Regards
    Ricky

    Hi,
    I am not using any ABAP program for calling this RFC,I am using Webdynpro for this one.
    so how it possible to implemnet same things at there.
    Regards
    ricky

  • Help on DAO pattern

    Hello!
    I'm having a problem implementing the DAO pattern.
    Suppose that I have two database tables:
    emp(id, name, sex, deptid)
    dept(id, name)
    If I follow the DAO pattern, I use two DAO interfaces, one for each
    table, and "entity". EmployeeDAO, and DepartmentDAO.
    (I'm using an abstract factory to create storage-specific DAOS)
    These DAOs return instances of Employee, and Department, or lists of them. (ValueObjects).
    This is all great and works very well, but suppose I want to produce the following
    presentation on the web:
    deptname | male | female
    Dept A   | 10   | 20
    Dept B   | 15   | 30In essense, this is a request for all the departments.
    I would iterate through this list, and want to display how many
    males, and how many females there are in each department.
    Should this be in the DepartmentDAO, or in a separate DAO?
    Or should this be put in some BusinessDelegate?
    That is, DepartmentDelegate.countMales(dept);
    Or should I put a method in the ValueObject Department that in turn uses the DAO to count males?
    Or should I load the number of females into the valueobject when fetching it from the
    database in the first place?
    Or should I construct a specialized view of the department such as:
    class StupidViewOfDepartment
       private Department dept;
       private int males;
       private int females;
       public StupidViewOfDepartment(Department dept, int males, int females){
       public int numFemales();
          return females;
       public int numMales(){
          return males;
    }...having some class return a collection of this specialized view?
    In that case, which class would that be?
    A new DAO or the DepartmentDAO?
    All classical examples of DAO patterns that I can find, fails to adress
    other issues than just retreiving a single Employee, or a list of them.
    Can someone advise me on this?

    You said:
    My problem might be, that the data I'm asking for, is not distinct objects, business objects,
    but a "new type of object" consisting of this particular information, that is
    deptname, numMales, numFemales.
    EXACTLY! You are querying for data that is either aggregate, a combination of various other business objects or a very large set of known business objects. In any of these cases, you probably don't want to use a vanilla DAO. Write a dedicated search DAO. Depending on your OO purity level and time horizon, you could make VO's for the search request or the results returned.
    You said:
    I'd like to think of this as report functionality, or aggregate reports.
    I'm good at database programming, and I'm particularly good at optimization,
    so if I cannot do this the good-looking way, I can always resort to brutal techniques...ehum
    PERFECT! If you are great at database operations, and you know exactly how you want to optimize a given search, then give it its own DAO. The main problem with the object->relational boundary is that most cookie-cutter solutions (ala entity beans with CMP) cannot even remotely appropach the optimization level of a good database programmer. If you want to optimize a search in SQL or a stored procuedure, do that. Then have a dedicated search DAO use that funcitonality. (If you want to do it "right", make a search Factory object that will return various implementations, some may be vendor-specific or optimized, others might be generic; the Factory simply returns a search DAO interface, while specific implementations can concentrate on the task at hand. Swapping implementations with the same interface should be trivial).
    - Saish
    "My karma ran over your dogma." - Anon

  • DAO Pattern and the ServiceLocator

    I have been developing a lightweight framework for working with AIR and the SQL API. This framework has no dependencies on Cairngorm however it is built around a typical DAO implementation.
    While developing this I considered how it should be integrated with Cairngorm, which lead me to wonder if a simple DAO marker interface which could be retrieved from the ServiceLocator (and cast to the correct abstraction by a business delegate) would not be all that is needed to have a rather flexible service layer in Cairngorm?
    For example, consider the following pseudo code which is what I would imagine a business delegate to look like:
    class FooDelegate {
    protected fooDAO:IFooDAO;
    public FooDelegate(responder:IResponder) {
    fooDAO = ServiceLocator.getinstance().getDAO(Service.FOODAO) as IFooDAO;
    fooDAO.addResponder( responder );
    public getFoo() void {
    fooDAO.getFoo();
    public addFoo(foo:IFoo) {
    fooDAO.addFoo(foo);
    public deleteFoo(foo:IFoo) {
    fooDAO.deleteFoo(foo);
    As you can see the delegate would cast the dao to the correct abstraction and then just wrap the DAOs API (somewhat similar to an Assembler in LCDS).
    A custom DAO interface would extend the DAO marker interface so that the ServiceLocator could find it:
    interface IFooDAO extends IDAO
    getFoo() void;
    addFoo(foo:IFoo);
    deleteFoo(foo:IFoo);
    Service.mxml would define an instance of the dao as an abstraction and then call a factory to get the appropriate implementation:
    public fooDAO:IFooDAO = DAOFactory.getDAO("foo");
    I see much potential in this type of implementation as it would allow services to be swaped out with different implementations via a config or with an IoC implementation etc, thus allowing the services themselves to be completely transparent to client code.
    I wanted to see if anyone had any thoughts on this as well?
    Best,
    Eric

    Thanks, duffymo, that makes sense. However ... having read through numerous threads in which you voice your opinion of the DAO World According to Sun, I'd be interested to know your thoughts on the following ...
    Basically, I'm in the process of proposing an enterprise system architecture, which will use DAO as the primary persistence abstraction, and DAO + JPA in the particular case of persistence to a RDBMS. In doing so, I'd like to illustrate the various elements of the DAO pattern, a la the standard class diagram that relates BusinessObject / DataAccessObject / DataSource / TransferObject (http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html). With reference to this model, I know that you have a view on the concept of TransferObject (aka ValueObject?) - how would you depict the DAO pattern in its most generic form? Or is the concept of a generic DAO pattern compromised by the specific implementation that is used (in this case JPA)?

  • Questions about DAO pattern

    Hi,
    I am a junior programmer and I am trying to understand somewhat more about best practices and design patterns.
    I am looking for more information regarding the DAO pattern, not the easy examples you find everywhere on the internet, but actual implementations of real world examples.
    Questions:
    1) Does a DAO always map with a single table in the database?
    2) Does a DAO contain any validation logic or is all validation logic contained in the Business Object?
    3) In a database I have 2 tables: Person and Address. As far as I understand the DAO pattern, I now create a PersonDAO and an AddressDAO who will perform the CRUD operations for the Person and Address objects. PersonDAO only has access to the Person table and AddressDAO only has access to the Address table. This seems correct to me, but what if I must be able to look up all persons who live in the same city? What if I also want to look up persons via their telephone numbers? I could add a findPersonByCity and findPersonByTelephoneNumber method to the PersonDAO, but that would result in the PersonDAO also accessing the Address table in the database (even though there already is an AddressDAO). Is that permitted? And why?
    I hope someone can help me out.
    Thanks for your time!
    Jeroen

    That is exactly what I am trying to do. I am writing it all myself to get a better understanding of it.
    Please bear with me, because there are some things I dont understand in your previous answer.
    1) Each BO validates his corresponding DTO and exposes operations to persist that DTO. Each DTO will be persisted in the database via his corresponding DAO. So this would be:
    - in PersonBO
    public void save(PersonDTO personDTO) {
    this.validate(personDTO); // does not validate the nested address DTOs
    this.personDAO.save(personDTO); // does not save the nested address DTOs
    - in AddressBO
    public void save(AddressDTO addressDTO) {
    this.validate(addressDTO);
    this.addressDAO.save(addressDTO);
    Am I viewing it from the right side now?
    2) Imagine a form designed to insert a new person in the database, it contains all fields for the Person DTO and 2 Address DTOs.
    How would I do this using my Business Objects?
    This is how I see it:
    // fill the DTOs
    daoManager.beginTransaction();
    try {
    personBO.setDao(daoManager.getDao(PersonDAO.class));
    personBO.save(personDTO); // save 1
    addressBO.setDao(daoManager.getDao(AddressDAO.class));
    addressBO.save(personDTO.getAddress(1)); // save 2
    addressBO.save(personDTO.getAddress(2)); // save 3
    daoManager.commit();
    catch(Exception e) {
    daoManager.rollBack();
    If I insert the transaction management inside the DAOs, I can never rollback save 1 when save 2 or save 3 fail.
    It can be that I am viewing it all wrong, please correct me if that is the case.
    Thanks!
    Jeroen

  • Hibernate, DAO pattern and tree hierarchy

    Hi all,
    I use Hibernate for a short period of time and now I'm facing a complex problem . I try figure it out what is the best practice for the following scenario:
    I have the following classes: Department, Team, Position, all of them inherited from a Entity class even there is almost no difference between them. But I wanted different classes for different entities.
    I try to create a tree hierachy, each object is with all others in a bidirectional one-to-many relationship. For example a Department can have Teams and Positions as children and a Position can have Departments and Teams as children.
    I created the mapping files and I don't know how to create all necessary methods without duplicating the code.
    Questions:
    1. Do I need a DAO pattern implemented for this design?
    2. Can you recomend some documentation or ideas that will help me find out what is the best approach in this case?
    Thanks

    Write the DAO for the class that is the root of the tree. Sounds like it should be DepartmentDao.
    I don't know of much better documentation than the Hibernate docs. Check their forum, too.
    %

  • How I use DAO

    I built a struts application .It is working well.Now I want use DAOand .How I use?
    My struts application :
    Get the input form user and store it in file or datadase. Here I want to use DAO.
    There 6 files .
    They are
    1.inputname.jsp ----------->used for getting input from client.inputs are mail id and password.
    2.GetNameForm.java --------->It is Bean having setter and getter including 2 methods are like filehandler(),dbConnection()(here only implementations).
    dbConnection method just sample i did. From MSAccess database, get Age field and print it in tomcat prompt. Here only i have probs.*What probs that I need to use DAO.
    3.GreetingAction.java ------>It is servlet and I call FormBean Method
    By ((sample.GetNameForm)form).filehandler();
    ((sample.GetNameForm)form).dBConnection();
    String name=((sample.GetNameForm)form).getName();
    String pass=((sample.GetNameForm)form).getPass();
    Thus I called that methods.
    It is good one or Not.
    Note. Both java file under the package name is sample.
    4.greeting.jsp--------> It is output file which is used to expose the output that mail id and password what we gave.
    5.index.jsp---------->It is global forward used to forward client request to inputname.jsp.(It is not a matter to consider with out this file applkication working well.)
    5.struts-config.xml file here only direction controls and mapping items and brief links (we know that).
    package sample;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    public class GetNameForm extends org.apache.struts.action.ActionForm {
    private String name="";
    private String pass="";
    public GetNameForm() {
    // TODO: Write constructor body
    public void reset(ActionMapping actionMapping, HttpServletRequest request) {
    // TODO: Write method body
    // throw new UnsupportedOperationException("Method not implemented");
    this.name="";
    this.pass="";
    public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {
    // TODO: Write method body
    //throw new UnsupportedOperationException("Method not implemented");
    ActionErrors errors=new ActionErrors();
    if( getName() == null || getName().length() < 1 ) {
    errors.add("name",new ActionMessage("error.name.required"));
    // actionMapping.findForward("goInput");
    if( getPass() == null || getPass().length() < 1 ) {
    errors.add("pass",new ActionMessage("error.pass.required"));
    // actionMapping.findForward("goInput");
    return errors;
    public String getName()
    return this.name;
    public void setName(String name)
    this.name=(name==null?"Please Enter The Name":name);
    public String getPass()
    return this.pass;
    public void setPass(String pass)
    this.pass=(pass==null?"Please Enter The ID":pass);
    public void dBConnection()
    Statement st;
    Connection con;
    ResultSet rs;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(Exception e)
    try
    con=null;
    st=null;
    rs=null;
    con=DriverManager.getConnection("jdbc:odbc:MSACCESSDSN","","");
    st=con.createStatement();
    rs=st.executeQuery("Select * from emp ");
    while(rs.next())
              int a=rs.getInt("Age");
              System.out.println(a);
    catch(Exception e)
    public void filehandler() throws IOException
    String name=getName();
    String pass=getPass();
    //Store the Details of User and Password in File
    Writer output = null;
    try {
    //use buffering
    File testFile = new File("C:\\gandhi\\mail_det.txt");
    BufferedReader input = null;
    input = new BufferedReader( new FileReader(testFile) );
    StringBuffer Contents=new StringBuffer();
    String line=null;
    while (( line = input.readLine()) != null)
    {System.out.println("From the file value=" +line);
          java.util.StringTokenizer st = new java.util.StringTokenizer(line,"@");
          System.out.println("The file contains data:"+Contents.append(line+"\n"));
         /* System.out.println(st.nextToken("@"));
          while (st.hasMoreTokens()) {
                if( st.equals("name") ){
                name="";
                pass="";
    String str=Contents.toString();
    System.out.println("The file Contains"+str);
    output = new BufferedWriter( new FileWriter(testFile) );
    output.write(str+"\n"+name+"\t"+"........."+pass);
    finally {
    //flush and close both "output" and its underlying FileWriter
    if (output != null)
    output.close();
    This is my Bean How I use DAO replace of dBConnection()
    method.
    1.What is important of DAO pls explain me with small codings.
    2.How I use DAO in this coding?
    [Note: I use Exadel StrutsStudio.]
    Anyone have idea pls guide me.

    Well in a DAO pattern you usually have one DAO class for each table in the database so there is for instance one PersonDAO and one ItemDAO which have their respective create, read, update and delete methods. Each DAO also hides its implementation through an interface defining the DAO methods, furthermore there's a DAO factory determining what class to load at runtime. My advice is to start out simple and not too abstract, try looking at the following example - it involves EJBs but explains the pattern.
    http://www.informit.com/guides/printerfriendly.asp?g=java&seqNum=137&rl=1
    Also keep in mind that implementing the DAO pattern using frameworks such as Spring simplifies the process, as illustrated here
    http://www.java2s.com/Code/Java/Hibernate/SpringDaoDemo.htm
    I hope that helps.

  • DAO pattern and Java Persistence API

    Hi
    This is a question for anyone who might be familiar with the standard DAO design pattern and the Java Persistence API (JPA - part of EJB3). I'm new to this technology, so apologies for any terminology aberrations.
    I am developing the overall architecture for an enterprise system. I intend to use the DAO pattern as the conceptual basis for all data access - this data will reside in a number of forms (e.g. RDBMS, flat file). In the specific case of the RDBMS, I intend to use JPA. My understanding of JPA is that it does/can support the DAO concept, but I'm struggling to get my head around how the two ideas (can be made to) relate to each other.
    For example, the DAO pattern is all about how business objects, data access objects, data transfer objects, data sources, etc relate to each other; JPA is all about entities and persistence units/contexts relate to each other. Further, JPA uses ORM, which is not a DAO concept.
    So, to summarise - can DAO and JPA work together and if so how?
    Thanks
    P.S. Please let me know if you think this topic would be more visible in another forum (e.g. EJB).

    Thanks, duffymo, that makes sense. However ... having read through numerous threads in which you voice your opinion of the DAO World According to Sun, I'd be interested to know your thoughts on the following ...
    Basically, I'm in the process of proposing an enterprise system architecture, which will use DAO as the primary persistence abstraction, and DAO + JPA in the particular case of persistence to a RDBMS. In doing so, I'd like to illustrate the various elements of the DAO pattern, a la the standard class diagram that relates BusinessObject / DataAccessObject / DataSource / TransferObject (http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html). With reference to this model, I know that you have a view on the concept of TransferObject (aka ValueObject?) - how would you depict the DAO pattern in its most generic form? Or is the concept of a generic DAO pattern compromised by the specific implementation that is used (in this case JPA)?

Maybe you are looking for

  • Syncing problem with Iphone 4

    I have an Iphone 4 and purchased an audiobook through Itunes. I synced my phone last night but the book does not show up ANYWHERE on my phone. Help would be appreciated.

  • Integer_tbl in function and procedure

    Hi All, I have a function that is using ref cursor and integer table. FUNCTION gp_long (ids IN integer_tbl, p_start_date IN VARCHAR2, p_end_date IN VARCHAR2) RETURN gp_long_cur; I understand gp_long_cur is a ref cursor, but not able to understand ids

  • How to send BLOB in attachement in oracle 10g?

    Hi, Actuall we requried to send and email from Oracle 10g database having attachements big in size aprox 10 to 30 MB. Is there any Custom Procedure or standard procedure for this. We are using UTL_SMTP and UTL_MAIL (Only support RAW attachement upto

  • Another Newbie Mail Question

    We have a new iPad and I have it tethered (or whatever you call it) to my wife's MacBook Pro. I have two mail accounts set up in the iPad for each of use. Since iPad is synced to my wife's MBP it reads her Address Book and I cannot find any of my add

  • Wireless AP that will allow more than one security setup

    I have a customer that is looking to install a new AP and have it accessible by their employee's and visitors.  So is there an AP out there that will allow you to setup more than one SSID and have one of the SSID's with access to the local network/in