You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Dick (JIRA)" <ji...@apache.org> on 2008/04/20 21:00:21 UTC
[jira] Closed: (OPENJPA-456) Missed to validate the column name
length for Join Column
[ https://issues.apache.org/jira/browse/OPENJPA-456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick closed OPENJPA-456.
--------------------------------
Resolution: Fixed
Fix Version/s: 1.1.0
Closing old issue which was integrated with revision 603633 on 12-12-2008
> Missed to validate the column name length for Join Column
> ---------------------------------------------------------
>
> Key: OPENJPA-456
> URL: https://issues.apache.org/jira/browse/OPENJPA-456
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 1.1.0
> Reporter: Teresa Kan
> Assignee: Michael Dick
> Fix For: 1.1.0, 1.2.0
>
> Attachments: OPENJPA-456.patch, openjpa_456_2.patch
>
>
> In the PersistenceMappingDefault.populateJoinColumn() method, it missed the call to validate the column length. Consequencely the column length that was longer than DB2's max column length resulted an invalid column length exception .
> The fix wil be:
> public void populateJoinColumn(FieldMapping fm, Table local, Table foreign,
> Column col, Object target, int pos, int cols) {
> // only use spec defaults with column targets
> if (!(target instanceof Column))
> return;
> // if this is a bidi relation, prefix with inverse field name, else
> // prefix with owning entity name
> FieldMapping[] inverses = fm.getInverseMappings();
> String name;
> if (inverses.length > 0)
> name = inverses[0].getName();
> else
> name = fm.getDefiningMapping().getTypeAlias();
> // suffix with '_' + target column
> name += "_" + ((Column) target).getName();
> name = dict.getValidColumnName(name, foreign); ===> add this call before set the name to the column.
> col.setName(name);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.