HHH-7919 : Miscellaneous bugfixes

This commit is contained in:
Strong Liu 2013-07-15 19:35:47 +08:00
parent cc6d271f31
commit 082e6b7e18
5 changed files with 8 additions and 8 deletions

View File

@ -92,6 +92,11 @@ else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY ) ) {
// need to wait until the ID or attribute source can be resolved.
indexSource = null;
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_CLASS ) ) {
// can be anything
throw new NotYetImplementedException( "@MapKeyClass is not supported yet." );
}
//TODO the map attribute may contains both {@code MAP_KEY_COLUMN} and {@code MAP_KEY_CLASS}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_COLUMN ) ) {
final Binder.DefaultNamingStrategy defaultNamingStrategy = new Binder.DefaultNamingStrategy() {
@Override
@ -109,10 +114,6 @@ else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_TEMPORAL ) )
// basic
throw new NotYetImplementedException( "@MapKeyTemporal is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_CLASS ) ) {
// can be anything
throw new NotYetImplementedException( "@MapKeyClass is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_JOIN_COLUMN ) ) {
// association
throw new NotYetImplementedException( "@MapKeyJoinColumn is not supported yet." );

View File

@ -488,7 +488,7 @@ private void createMappedAttribute(Member member, AccessType accessType) {
getLocalBindingContext()
);
Class<?> collectionIndexType = null;
if ( Map.class.isAssignableFrom( attributeType ) ) {
if ( Map.class.isAssignableFrom( attributeType ) && !resolvedMember.getType().getTypeParameters().isEmpty()) {
collectionIndexType = resolvedMember.getType().getTypeParameters().get( 0 ).getErasedType();
}
MappedAttribute.Nature attributeNature = determineAttributeNature(

View File

@ -272,7 +272,7 @@ name, target, toArray( annotationValueList )
}
static String buildSafeClassName(String className, String defaultPackageName) {
if ( className.indexOf( '.' ) < 0 && StringHelper.isNotEmpty( defaultPackageName ) ) {
if ( className!= null && className.indexOf( '.' ) < 0 && StringHelper.isNotEmpty( defaultPackageName ) ) {
className = StringHelper.qualify( defaultPackageName, className );
}
return className;

View File

@ -50,7 +50,7 @@ protected PropertyElement getPropertyElement() {
protected void processExtra() {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.classValue(
"targetEntity", oneToMany.getTargetEntity(), annotationValueList, indexBuilder.getServiceRegistry()
"targetEntity", MockHelper.buildSafeClassName( oneToMany.getTargetEntity(), getDefaults().getPackageName() ), annotationValueList, indexBuilder.getServiceRegistry()
);
MockHelper.enumValue( "fetch", FETCH_TYPE, oneToMany.getFetch(), annotationValueList );
MockHelper.stringValue( "mappedBy", oneToMany.getMappedBy(), annotationValueList );

View File

@ -23,7 +23,6 @@
<column name="fld_id"/>
<generated-value strategy="TABLE" generator="generator"/>
</id>
<basic name="unknownProperty"/>
<many-to-one name="manufacturer" fetch="LAZY">
<join-column name="manufacturer_pk"/>
</many-to-one>