Hi Brian,
So many open variables in your scenario, but let me begin with a few
suggestions...  I'm sure others will pipe in with suggestions as well...

o  Ensure that you are using OpenJPA's entity class enhancement processing.
Either at build time, or at run time.  Do not rely on the subclassing
support that can be the "fall back" process for monitoring entity usage.
Using the entity class enhancement processing [1]  will ensure the best
performing and most functional experience with OpenJPA.

o  Use OpenJPA's Level 2 Cache [2] capabilities to minimize the number of
trips to the database.  Especially for the read-only or read-mostly data.
The WebSphere JPA solution uses OpenJPA under the covers, and they have
experienced fantastic SpecJEnterprise benchmark numbers [3] using OpenJPA's
caching capabilities.  You mention DB2, so if there's an outside chance you
would also be using WebSphere, here's an additional read-only object cache
[4] that will provide additional performance benefit.

o  You don't mention what level of OpenJPA you are looking to use.  I would
suggest either OpenJPA 2.0.x or 2.1.x [5].  Both of these service streams
support the latest JPA 2.0 specification, along with many other performance
and functional improvements over the previous releases.

o  Is your database schema fixed (due to past releases) or is it flexible?
If it's fixed, then I would suggest creating the Entity templates from the
defined database schema using reverse mapping [6].  This will give you a
very good start on the Entities required to interact with your database.
You can always tweak them as necessary to add additional data logic, but the
meat of the code is done.

o  And, concerning your comment about using the DB2 IDENTITY COLUMN.  This
is what you would get if you use
@GeneratedValue(strategy=GenerationType.IDENTITY) with a DB2 database as
your configured datasource.  GenerationType.SEQUENCE also uses database
facilities for the Sequence processing.  A bit more information can be found
here [7].

Hope this helps get you started!

Kevin

[1]
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
[2]
http://openjpa.apache.org/builds/2.0.1/apache-openjpa-2.0.1/docs/manual/manual.html#ref_guide_caching
[3]  http://www.spec.org/jEnterprise2010/results/jEnterprise2010.html
[4]
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.jpafep.multiplatform.doc/info/ae/ae/tejb_jpaobjectcache.html
[5]  http://openjpa.apache.org/downloads.html
[6]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_reverse
[7]
http://openjpa.apache.org/builds/2.0.1/apache-openjpa-2.0.1/docs/manual/manual.html#jpa_overview_meta_gen

On Mon, Oct 4, 2010 at 12:46 PM, Brian Fed <[email protected]> wrote:

> I am newbie to JPA and OpenJPA and have couple of questions on the best
> practices in using JPA and OpenJPA and any performance tips while using
> JPA/OpenJPA.
>
> Here is our application requirement. Basically ours is web based j2ee
> application that uses JSF,Spring,OpenJPA and DB2 database. We'll dealing
> with lot of data and that means at a single point of time we'll
> working(adding, updating, deleting using UI) with min. 100,000+ records in
> the database. For example, 20-30 users simultaneously will be using our web
> based application and its UI for inserting 100,000 records into the
> database, editing 100,000 records in the database, querying the 400,000
> records in the database tables etc. These are just few of our application
> requirements to demonstrate the volume of data will be dealing at a single
> point of time.
>
> Based on aforementioned application requirements, I need inputs from you,
> the JPA experts,
>
> A. what are the best practices while using JPA and OpenJPA?
>
> B. what are the various JPA/OpenJPA tips for building the high performance
> JPA based applications?
> C. for example, for performance reasons is it good to use, for a table
> defined in DB2, we have using DB2 IDENTITY COLUMN for
> primary keys and rather than using
> in JPA @GeneratedValue(strategy=GenerationType.IDENTITY) instead of
> @GeneratedValue(strategy=GenerationType.SEQUENCE) or
> @GeneratedValue(strategy=GenerationType.TABLE) ?
>
>
> Thank you in advance for yout time and reply.
>

Reply via email to