[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c...
]
Daljeet Singh Sarna commented on HHH-1829:
------------------------------------------
I tried using the patch you provided.
But I found that it would still fail and then further debugging I found adding following
lines to "src/org/hibernate/persister/entity/AbstractEntityPersister.java" will
fix the issue.
you have suggested one change in the method below. but it seems that
"join.addJoin(" inside for loop - > if look also requires update.
protected JoinFragment createJoin(String name, boolean innerJoin, boolean
includeSubclasses) {
//final String[] idCols = StringHelper.qualify( name, getIdentifierColumnNames() );
//all joins join to the pk of the driving table
final String[] idCols = getPropertyRefColumnNames() != null &&
getPropertyRefColumnNames().length > 0 &&
getPropertyRefColumnNames()[0] != null ?
StringHelper.qualify( name, getPropertyRefColumnNames() ) :
StringHelper.qualify( name, getIdentifierColumnNames() ); //all joins join to the pk
of the driving table
final JoinFragment join = getFactory().getDialect().createOuterJoinFragment();
final int tableSpan = getSubclassTableSpan();
for ( int j = 1; j < tableSpan; j++ ) { //notice that we skip the first table; it is
the driving table!
final boolean joinIsIncluded = isClassOrSuperclassTable( j ) ||
( includeSubclasses && !isSubclassTableSequentialSelect( j ) &&
!isSubclassTableLazy( j ) );
if ( joinIsIncluded ) {
join.addJoin( getSubclassTableName( j ),
generateTableAlias( name, j ),
(getPropertyRefColumnNames() != null
&& getPropertyRefColumnNames().length > 0
&& getPropertyRefColumnNames()[0] != null )
? new String[]{idCols[j-1]}
: idCols,
//idCols,
getSubclassTableKeyColumns( j ),
innerJoin && isClassOrSuperclassTable( j ) && !isInverseTable( j )
&& !isNullableTable( j ) ?
JoinFragment.INNER_JOIN : //we can inner join to superclass tables (the row MUST be
there)
JoinFragment.LEFT_OUTER_JOIN //we can never inner join to subclass tables
);
}
}
return join;
}
Allow join on any property using property-ref
---------------------------------------------
Key: HHH-1829
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
Project: Hibernate3
Type: New Feature
Components: core
Versions: 3.2.0 cr1, 3.2.0.cr2
Reporter: Maarten Winkels
Assignee: Steve Ebersole
Fix For: 3.2.3
Attachments: AbstractJoinTest.java, JoinNoPropertyRefTest.java,
JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml,
hhh-1829.patch
Currently joining tables for one class (uing the <join...> tag) is only supported
for the id property. The property-ref is allowed on the <key..> tag inside the
<join..> tag, but this is ignored.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira