Package org.eclipse.persistence.mappings

Examples of org.eclipse.persistence.mappings.OneToManyMapping


              mapping.setIsReadOnly(true);
              mapping.setMappedBy(getMappedBy());
           } else {
               // Create a 1-M mapping and process common collection mapping
               // metadata first followed by specific metadata.
               OneToManyMapping mapping = new OneToManyMapping();
               process(mapping);
             
               Map<DatabaseField, DatabaseField> keys = ownerMapping.getSourceToTargetKeyFields();
               for (DatabaseField fkField : keys.keySet()) {
                   DatabaseField pkField = keys.get(fkField);
                   
                   // If we are within a table per class strategy we have to update
                   // the primary key field to point to our own database table.
                   // The extra table check is if the mapping is actually defined
                   // on our java class (meaning we have the right table at this
                   // point and can avoid the cloning)
                   if (getDescriptor().usesTablePerClassInheritanceStrategy() && ! pkField.getTable().equals(getDescriptor().getPrimaryTable())) {
                       // We need to update the pk field to be to our table.
                       pkField = pkField.clone();
                       pkField.setTable(getDescriptor().getPrimaryTable());
                   }
               
                   mapping.addTargetForeignKeyField(fkField, pkField);
               }
              
               mapping.setMappedBy(getMappedBy());
           }
       } else {
           // If improper mapping encountered, throw an exception.
           throw ValidationException.invalidMapping(getJavaClass(), getReferenceClass());
       }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.mappings.OneToManyMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.