Issue Details (XML | Word | Printable)

Key: OPENJPA-266
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Catalina Wei
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenJPA

Add Extensibility: Change "private" field/method to "protected" or "public" in OpenJPA classes to be extendable

Created: 26/Jun/07 12:04 AM   Updated: 07/Aug/07 10:23 PM
Return to search
Component/s: jdbc
Affects Version/s: 1.0.0
Fix Version/s: 1.0.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works DBDictionaryFactory.patch 2007-07-31 05:11 PM Catalina Wei 6 kB
Text File Licensed for inclusion in ASF works OpenJPA-266.patch 2007-07-23 10:01 PM Catalina Wei 4 kB
Text File Licensed for inclusion in ASF works OPENJPA-266.patch.txt 2007-06-29 02:31 PM Michael Dick 5 kB

Resolution Date: 07/Aug/07 10:23 PM


 Description  « Hide
In order to extend existing OpenJPA classes, for example OperationOrderUpdateManager, private field or method needed to change to protected or public.
This kind of modification is not adding any functionality but making OpenJPA classes subclassable.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Catalina Wei added a comment - 26/Jun/07 08:14 PM
The changes in the attached patch enable extensibility only.

Catalina

Catalina Wei added a comment - 26/Jun/07 08:18 PM
This patch has passed TCK with Derby

Catalina

Kevin Sutter added a comment - 26/Jun/07 09:06 PM
Although Catalina's patch passed the TCK, there were a couple of "extra contributions" that probably shouldn't have been part of the patch. Catalina will re-work the patch and re-post shortly. Thanks for your patience!

Catalina Wei added a comment - 26/Jun/07 10:08 PM
changes are mostly in "private" to "protected".

Michael Dick added a comment - 29/Jun/07 02:31 PM
Attaching updated patch. I committed the changes to PreparedStatementImpl earlier this week. This patch contains the rest of the changes Catalina proposed.

Catalina Wei added a comment - 23/Jul/07 10:01 PM
Allow vendor "extended" DB Dictionaray plugins.
For example,
public Class MyDB2Dictionary
    extends org.apache.openjpa.jdbc.sql.DB2Dictionary { ...}

By changing default plugin values by :
JDBCConfigurationImpl.dbdictionaryPlugin.setAlias("db2", "test.MyDB2Dictionary")

will instantiate test.MyDB2Dictionary

Michael Dick added a comment - 24/Jul/07 02:49 PM
The last change regarding DBDictionaries looks like it's a good start, but I have a few questions / issues.

The changes seem to be intended to enable other vendors to repackage OpenJPA with their own set of DBDictionaries. This is a good thing, but the code only allows DB2, Oracle and SQLServer to be extended. This should be expanded and generalized to allow any DBDictionary to be overridden.

The fix also requires the user to get a configuration object and cast it to our implementation class. This should be changed to use the JDBCConfiguration interface.

If this is intended for use by other vendors, why don't we just provide the ability for the DBDictionaryFactory class to be extended? If the DBDictionaryFactory class was configurable (like SQLFactory for example), then vendors could prefer their own set of classes without messing around with JDBCConfigurationImpl.


Patrick Linskey added a comment - 24/Jul/07 04:30 PM
Agreed. Additionally, it is already trivial for vendors to repackage OpenJPA with different dbdictionaries. All you need to do is create a ProductDerivation that changes the aliases listed in the JDBCConfigurationImpl.dbdictionaryPlugin.

See JDBCPersistenceProductDerivation for an example of a product derivation that changes alias settings.

Catalina Wei added a comment - 31/Jul/07 05:11 PM
use dbdictionaryPlugin value to load vendor specific DBDictionary.