Large Result Sets and CMP

Discussions

EJB programming & troubleshooting: Large Result Sets and CMP

  1. Large Result Sets and CMP (2 messages)

    Hello:

    I am using CMP to persist my objects in the database. I am using JBOSS 3.0.0 and Oracle. I have a session facade, to wrap my CMP entity beans with. I return value objects back to my client.

    My question is, how do I return large result sets to the client application. Basically how do I apply the DAO pattern with CMP beans. I can understand using them with BMP, but dont know how I can so the same with CMP. The functionality I want to give to the client app. is something like previous page and next page which will return one page at a time of a give size of value objects back to the client.

    Thanks for the help.
    Vivek

    Threaded Messages (2)

  2. Large Result Sets and CMP[ Go to top ]

    Try using a vector of results. And pass the vector object to client as an parameter....I know that this is a simple approach but try using this.
  3. Large Result Sets and CMP[ Go to top ]

    Actually, it is "preferrable" to use a Collection as the return value, and then return something like an ArrayList. Since ArrayLists have optional synchronization, they are more efficient than a Vector. Just my $.02s

    As a side note, entity beans are not the most efficient beans for the purpose of "selecting" a large group of records. Due to lifecycle behavior, it would be more efficient (perform better) if you use a session bean to accomplish this task. I've discovered the best way to use the findByXXX (not primary key) method is for the purpose of selecting a group of records with "the intent to update those records." For examples, select all area codes of 619 and change them to 858. The reason, is because entity beans are set on getting a primary key for each record. Making updates on a record is most efficient when you have that value (rather than the characteristic you are looking for...like findByCity(String city). The entity would actually find all records that met the criteria and get their pk. It would then use the pk to locate the record to make the update. This is fast and the advantage of using an entity for an initial "Select". Otherwise...go with the session bean to improve performance :)

    Hope this helps,
    Natalie
    nlevi@educationaledge.net