1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors; 23 24 import javax.persistence.ManyToOne; 25 26 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor; 27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject; 28 29 import oracle.toplink.essentials.mappings.OneToOneMapping; 30 31 37 public class ManyToOneAccessor extends ObjectAccessor { 38 41 public ManyToOneAccessor(MetadataAccessibleObject accessibleObject, ClassAccessor classAccessor) { 42 super(accessibleObject, classAccessor); 43 44 ManyToOne manyToOne = getAnnotation(ManyToOne.class); 45 46 if (manyToOne != null) { 47 setFetchType(manyToOne.fetch()); 48 setIsOptional(manyToOne.optional()); 49 setCascadeTypes(manyToOne.cascade()); 50 setTargetEntity(manyToOne.targetEntity()); 51 } 52 } 53 54 57 public boolean isManyToOne() { 58 return true; 59 } 60 61 66 public void process() { 67 setReferenceClass(m_targetEntity, getLogger().MANY_TO_ONE_MAPPING_REFERENCE_CLASS); 68 69 OneToOneMapping mapping = initOneToOneMapping(); 71 72 processOwningMappingKeys(mapping); 74 75 m_descriptor.addMapping(mapping); 77 } 78 } 79 | Popular Tags |