private void validateLobMappingSupport(XProperty property) { // HHH-9834 - Sanity check try { if ( property.isAnnotationPresent( ElementCollection.class ) ) { if ( property.isAnnotationPresent( Lob.class ) ) { if ( !property.getCollectionClass().isAssignableFrom( Map.class ) ) { throw new MappingException( "@ElementCollection combined with @Lob is only supported for Map collection types." ); } } } } catch ( MappingException e ) { throw new HibernateException( String.format( "Invalid mapping in [%s] for property [%s]", property.getDeclaringClass().getName(), property.getName() ), e ); } }
final Class<?> returnedClass = property.getCollectionClass();
Class returnedClass = property.getCollectionClass(); if ( java.util.Set.class.equals( returnedClass ) ) { if ( property.isAnnotationPresent( CollectionId.class ) ) {
private void validateLobMappingSupport(XProperty property) { // HHH-9834 - Sanity check try { if ( property.isAnnotationPresent( ElementCollection.class ) ) { if ( property.isAnnotationPresent( Lob.class ) ) { if ( !property.getCollectionClass().isAssignableFrom( Map.class ) ) { throw new MappingException( "@ElementCollection combined with @Lob is only supported for Map collection types." ); } } } } catch ( MappingException e ) { throw new HibernateException( String.format( "Invalid mapping in [%s] for property [%s]", property.getDeclaringClass().getName(), property.getName() ), e ); } }
final Class<?> returnedClass = property.getCollectionClass();
Class returnedClass = property.getCollectionClass(); if ( java.util.Set.class.equals( returnedClass ) ) { if ( property.isAnnotationPresent( CollectionId.class ) ) {
Class returnedClass = property.getCollectionClass(); if ( java.util.Set.class.equals( returnedClass ) ) { if ( property.isAnnotationPresent( CollectionId.class ) ) {
public void testCanBeASimpleType() { List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "field" ); XProperty p = getPropertyNamed_from( "fieldProperty", declaredProperties ); assertTrue( factory.equals( p.getType(), String.class ) ); assertTrue( factory.equals( p.getElementClass(), String.class ) ); assertTrue( factory.equals( p.getClassOrElementClass(), String.class ) ); assertNull( p.getCollectionClass() ); assertFalse( p.isArray() ); assertFalse( p.isCollection() ); }
public void testResolveInterfaceType() { List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" ); XProperty p = getPropertyNamed_from( "language", declaredProperties ); assertTrue( factory.equals( p.getType(), String.class ) ); assertTrue( factory.equals( p.getElementClass(), String.class ) ); assertTrue( factory.equals( p.getClassOrElementClass(), String.class ) ); assertNull( p.getCollectionClass() ); assertNull( p.getMapKey() ); assertFalse( p.isArray() ); assertFalse( p.isCollection() ); }
public void testCanBeAnArray() { List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" ); XProperty p = getPropertyNamed_from( "arrayProperty", declaredProperties ); assertTrue( factory.equals( p.getType(), String[].class ) ); assertTrue( factory.equals( p.getElementClass(), String.class ) ); assertTrue( factory.equals( p.getClassOrElementClass(), String.class ) ); assertNull( p.getCollectionClass() ); assertNull( p.getMapKey() ); assertTrue( p.isArray() ); assertFalse( p.isCollection() ); }
public void testCanBeAnArrayOfPrimitives() { List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" ); XProperty p = getPropertyNamed_from( "primitiveArrayProperty", declaredProperties ); assertTrue( factory.equals( p.getType(), int[].class ) ); assertTrue( factory.equals( p.getElementClass(), int.class ) ); assertTrue( factory.equals( p.getClassOrElementClass(), int.class ) ); assertNull( p.getCollectionClass() ); assertNull( p.getMapKey() ); assertTrue( p.isArray() ); assertFalse( p.isCollection() ); }
public void testCanBeACollection() { List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" ); XProperty p = getPropertyNamed_from( "collectionProperty", declaredProperties ); assertTrue( factory.equals( p.getType(), Map.class ) ); assertTrue( factory.equals( p.getElementClass(), String.class ) ); assertTrue( factory.equals( p.getClassOrElementClass(), Map.class ) ); assertTrue( factory.equals( p.getMapKey(), Double.class ) ); assertEquals( Map.class, p.getCollectionClass() ); assertFalse( p.isArray() ); assertTrue( p.isCollection() ); }