Hi Brian, Your original note listed all of these open source projects, including Spring. So, I couldn't tell that you were also a WebSphere customer. I can give a few details below given that new piece of information...
Kevin On Mon, Oct 4, 2010 at 11:58 PM, brian.fed7 <[email protected]> wrote: > > > Kevin Sutter wrote: > > > > 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. > > > I think if we are using IBM WAS v7.0 then we do not need to worry about JPA > class enhancement because it was told here > http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html > that IBM WAS will automatically take care of Entities enhancement at > runtime. Please correct me if my understanding is wrong. > > Correct. If you are using JPA within WebSphere and using container-managed persistence (another "best practice"), then your entities will automatically get enhanced as they are loaded into the Container environment. This is the case for both the EJB and Web Container scenarios. > > Kevin Sutter wrote: > > > > 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. > > > Since ours is development application we have the luxury of using latest > stable OpenJPA v2.1.x binary > > Excellent. As an FYI, the OpenJPA 2.0.x service stream ships with the WebSphere OSGi/JPA 2.0 Feature Pack that sits on top of WAS v7.0. As a WAS v7 customer, this FeP is available for a free download, in case you are interested. More information can be found here: http://www-01.ibm.com/software/webservers/appserv/was/featurepacks/osgi/ > > Kevin Sutter wrote: > > > > 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. > > > If I understand your point correctly, I think we can use JPA wizards inside > RAD IDE that can automatically generate Java Entities from an existing > database rather than manually creating/modifying Java Entities if there is > a > change in Database Entities and we do not need to use OpenJPA's reverse > mapping utilities > > http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_reverse > . > Please correct me if my understanding is wrong. > > Well... That's true, you could use the RAD tooling for doing this. But, RAD is built on the Eclipse Dali for their JPA support. This is a good thing, for most items... But, in the case of generating Entity code based on a schema, the OpenJPA reverse mapping facilities are better. We have a found gotchas with the Dali Entity generation code, so I would suggest using the OpenJPA reverse mapping tooling instead. > > Kevin Sutter wrote: > > > > 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]. > > > This link > > http://openjpa.apache.org/builds/2.0.1/apache-openjpa-2.0.1/docs/manual/manual.html#jpa_overview_meta_gen > does not say which one is > better for performance reasons and based on my application requirements. I > suppose DB2 IDENTITY COLUMNS and > @GeneratedValue(strategy=GenerationType.IDENTITY) are better than any other > sequence generation strategies for our application requirements. Any > thoughts on this point? > I would venture to say that the IDENTITY generation strategy is slightly better performing than SEQUENCE, at least in the case of DB2 since they can natively support IDENTITY generation. Some databases don't support IDENTITY columns, so we have to mock up the processing. If you are using DB2, then I would probably stick with IDENTITY. Good luck, Kevin > > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/JPA-OpenJPA-Best-Practices-Performance-Tips-tp5600136p5601850.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >
