public EcInfo(Attribute attr, Attribute idAttr) { attr.attache = this; ElementCollection ec = attr.field.getAnnotation(ElementCollection.class); targetClass = ec.targetClass(); Class<?> type = attr.field.getType(); if (type.isArray()) {
@Test public void testNoChildren() throws Exception { reader = getReader( Entity2.class, "field1", "element-collection.orm1.xml" ); assertAnnotationPresent( ElementCollection.class ); assertAnnotationNotPresent( OrderBy.class ); assertAnnotationNotPresent( OrderColumn.class ); assertAnnotationNotPresent( MapKey.class ); assertAnnotationNotPresent( MapKeyClass.class ); assertAnnotationNotPresent( MapKeyTemporal.class ); assertAnnotationNotPresent( MapKeyEnumerated.class ); assertAnnotationNotPresent( MapKeyColumn.class ); assertAnnotationNotPresent( MapKeyJoinColumns.class ); assertAnnotationNotPresent( MapKeyJoinColumn.class ); assertAnnotationNotPresent( Column.class ); assertAnnotationNotPresent( Temporal.class ); assertAnnotationNotPresent( Enumerated.class ); assertAnnotationNotPresent( Lob.class ); assertAnnotationNotPresent( AttributeOverride.class ); assertAnnotationNotPresent( AttributeOverrides.class ); assertAnnotationNotPresent( AssociationOverride.class ); assertAnnotationNotPresent( AssociationOverrides.class ); assertAnnotationNotPresent( CollectionTable.class ); assertAnnotationNotPresent( Access.class ); ElementCollection relAnno = reader.getAnnotation( ElementCollection.class ); assertEquals( FetchType.LAZY, relAnno.fetch() ); assertEquals( void.class, relAnno.targetClass() ); }
ElementCollection relAnno = reader.getAnnotation( ElementCollection.class ); assertEquals( FetchType.EAGER, relAnno.fetch() ); assertEquals( Entity3.class, relAnno.targetClass() ); assertEquals( AccessType.PROPERTY, reader.getAnnotation( Access.class )
final Class<?> targetElement = elementCollectionAnn.targetClass(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( targetElement )
private void introspectElementCollection(ElementCollection eltCollection) { Class targetClass = eltCollection.targetClass(); if (! void.class.equals(targetClass)) setTargetClass(targetClass); setFetch(eltCollection.fetch()); }
Map mapper = (Map) objects.get(key).get(f.getName()); if (mapper == null) continue; Class targetClass = ec.targetClass(); Class mapKeyClass = mkc.value(); Map<Object, Object> fieldValue = new HashMap();
public EcInfo(final Attribute attr, final Attribute idAttr) { attr.attache = this; final ElementCollection ec = attr.field.getAnnotation(ElementCollection.class); targetClass = ec.targetClass(); final Class<?> type = attr.field.getType(); if (type.isArray()) {
private void readElementCollection(DeployBeanPropertyAssocMany<?> prop, ElementCollection elementCollection) { if (!elementCollection.targetClass().equals(void.class)) { prop.setTargetType(elementCollection.targetClass());
this.targetClass = "void".equals(elementCollection.targetClass()) ? null : elementCollection.targetClass().getName(); this.fetchType = elementCollection.fetch();
this.targetClass = "void".equals(elementCollection.targetClass()) ? null : elementCollection.targetClass().getName(); this.fetchType = elementCollection.fetch();
this.targetClass = "void".equals(elementCollection.targetClass()) ? null : elementCollection.targetClass().getName(); this.fetchType = elementCollection.fetch();
/** * Parse @ElementCollection. */ private void parseElementCollection(FieldMetaData fmd, ElementCollection anno) { // TODO: throw exception if the runtime env is OpenJpa 1.x if (fmd.getDeclaredTypeCode() != JavaTypes.COLLECTION && fmd.getDeclaredTypeCode() != JavaTypes.MAP) throw new MetaDataException(_loc.get("bad-meta-anno", fmd, "ElementCollection")); if (anno.targetClass() != void.class) fmd.getElement().setDeclaredType(anno.targetClass()); fmd.setInDefaultFetchGroup(anno.fetch() == FetchType.EAGER); fmd.setElementCollection(true); ValueMetaData elem = fmd.getElement(); boolean isEnum = elem.getDeclaredType().isEnum(); if (!isEnum && JavaTypes.maybePC(elem)) { elem.setEmbedded(true); if (elem.getEmbeddedMetaData() == null) elem.addEmbeddedMetaData(getAccessCode(elem.getDeclaredType())); } }
/** * Parse @ElementCollection. */ private void parseElementCollection(FieldMetaData fmd, ElementCollection anno) { // TODO: throw exception if the runtime env is OpenJpa 1.x if (fmd.getDeclaredTypeCode() != JavaTypes.COLLECTION && fmd.getDeclaredTypeCode() != JavaTypes.MAP) throw new MetaDataException(_loc.get("bad-meta-anno", fmd, "ElementCollection")); if (anno.targetClass() != void.class) fmd.getElement().setDeclaredType(anno.targetClass()); fmd.setInDefaultFetchGroup(anno.fetch() == FetchType.EAGER); fmd.setElementCollection(true); ValueMetaData elem = fmd.getElement(); boolean isEnum = elem.getDeclaredType().isEnum(); if (!isEnum && JavaTypes.maybePC(elem)) { elem.setEmbedded(true); if (elem.getEmbeddedMetaData() == null) elem.addEmbeddedMetaData(getAccessCode(elem.getDeclaredType())); } }
/** * Parse @ElementCollection. */ private void parseElementCollection(FieldMetaData fmd, ElementCollection anno) { // TODO: throw exception if the runtime env is OpenJpa 1.x if (fmd.getDeclaredTypeCode() != JavaTypes.COLLECTION && fmd.getDeclaredTypeCode() != JavaTypes.MAP) throw new MetaDataException(_loc.get("bad-meta-anno", fmd, "ElementCollection")); if (anno.targetClass() != void.class) fmd.getElement().setDeclaredType(anno.targetClass()); fmd.setInDefaultFetchGroup(anno.fetch() == FetchType.EAGER); fmd.setElementCollection(true); ValueMetaData elem = fmd.getElement(); boolean isEnum = elem.getDeclaredType().isEnum(); if (!isEnum && JavaTypes.maybePC(elem)) { elem.setEmbedded(true); if (elem.getEmbeddedMetaData() == null) elem.addEmbeddedMetaData(getAccessCode(elem.getDeclaredType())); } }
/** * Parse @ElementCollection. */ private void parseElementCollection(FieldMetaData fmd, ElementCollection anno) { // TODO: throw exception if the runtime env is OpenJpa 1.x if (fmd.getDeclaredTypeCode() != JavaTypes.COLLECTION && fmd.getDeclaredTypeCode() != JavaTypes.MAP) throw new MetaDataException(_loc.get("bad-meta-anno", fmd, "ElementCollection")); if (anno.targetClass() != void.class) fmd.getElement().setDeclaredType(anno.targetClass()); fmd.setInDefaultFetchGroup(anno.fetch() == FetchType.EAGER); fmd.setElementCollection(true); ValueMetaData elem = fmd.getElement(); boolean isEnum = elem.getDeclaredType().isEnum(); if (!isEnum && JavaTypes.maybePC(elem)) { elem.setEmbedded(true); if (elem.getEmbeddedMetaData() == null) elem.addEmbeddedMetaData(getAccessCode(elem.getDeclaredType())); } }
mappedBy = ""; final Class<?> targetElement = elementCollectionAnn != null ? elementCollectionAnn.targetClass() : collectionOfElementsAnn.targetElement(); collectionBinder.setTargetEntity(
private void readElementCollection(DeployBeanPropertyAssocMany<?> prop, ElementCollection elementCollection) { if (!elementCollection.targetClass().equals(void.class)) { prop.setTargetType(elementCollection.targetClass());
final Class<?> targetElement = elementCollectionAnn.targetClass(); collectionBinder.setTargetEntity( mappings.getReflectionManager().toXClass( targetElement )
final Class<?> targetElement = elementCollectionAnn.targetClass(); collectionBinder.setTargetEntity( mappings.getReflectionManager().toXClass( targetElement )
final Class<?> targetElement = elementCollectionAnn.targetClass(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( targetElement )