@Override public String getReferencedEntityName() { return ( (ToOne) value ).getReferencedEntityName(); }
public static String getReferencedEntityName(Value value) { if ( value instanceof ToOne ) { return ( (ToOne) value ).getReferencedEntityName(); } else if ( value instanceof OneToMany ) { return ( (OneToMany) value ).getReferencedEntityName(); } else if ( value instanceof Collection ) { return getReferencedEntityName( ( (Collection) value ).getElement() ); } return null; }
private void generateSecondPass(String entityName, Component component) { Iterator properties = component.getPropertyIterator(); while ( properties.hasNext() ) { final Property property = (Property) properties.next(); if ( property.getValue() instanceof ToOne ) { final PropertyAuditingData propertyData = getIdPersistentPropertyAuditingData( property ); final String referencedEntityName = ( (ToOne) property.getValue() ).getReferencedEntityName(); final String prefix = mainGenerator.getVerEntCfg().getOriginalIdPropName() + "." + propertyData.getName(); final IdMapper relMapper; if ( mainGenerator.getEntitiesConfigurations().containsKey( referencedEntityName ) ) { relMapper = mainGenerator.getEntitiesConfigurations().get( referencedEntityName ).getIdMapper(); } else if ( mainGenerator.getNotAuditedEntitiesConfigurations().containsKey( referencedEntityName ) ) { relMapper = mainGenerator.getNotAuditedEntitiesConfigurations().get( referencedEntityName ).getIdMapper(); } else { throw new MappingException( "Unable to locate entity configuration for [" + referencedEntityName + "]" ); } final IdMapper prefixedMapper = relMapper.prefixMappedProperties( prefix + "." ); mainGenerator.getEntitiesConfigurations().get( entityName ).addToOneRelation( prefix, referencedEntityName, prefixedMapper, true, false ); } } }
final ToOne toOne = (ToOne) value; final PersistentClass referencedPc = context.getMetadataCollector() .getEntityBinding( toOne.getReferencedEntityName() ); if ( toOne.getReferencedPropertyName() != null ) { try {
public String getReferencedEntityName() { return ( (ToOne) value ).getReferencedEntityName(); }
String entityName, boolean insertable) { final String referencedEntityName = ( (ToOne) value ).getReferencedEntityName();
String entityName, boolean insertable) { final String referencedEntityName = ( (ToOne) value ).getReferencedEntityName();
PersistentClass referencedPc = context.getMetadataCollector().getEntityBinding( toOne.getReferencedEntityName() ); if ( toOne.getReferencedPropertyName() != null ) { try {
@Override public String getReferencedEntityName() { return ( (ToOne) value ).getReferencedEntityName(); }
private Object acceptToOne(ToOne value) { return value.getReferencedEntityName(); // should get the cfg and lookup the persistenclass. }
@Override public String getReferencedEntityName() { return ( (ToOne) value ).getReferencedEntityName(); }
private Object acceptToOne(ToOne value) { return value.getReferencedEntityName(); // should get the cfg and lookup the persistenclass. }
@Override public String getReferencedEntityName() { return ( (ToOne) value ).getReferencedEntityName(); }
private Object acceptToOne(ToOne value) { return value.getReferencedEntityName(); // should get the cfg and lookup the persistenclass. }
private Object acceptToOne(ToOne value) { return value.getReferencedEntityName(); // should get the cfg and lookup the persistenclass. }
private String getReferencedEntityName(Value element) { if ( element instanceof OneToMany ) { return ( (OneToMany) element ).getReferencedEntityName(); } else if ( element instanceof ToOne ) { return ( (ToOne) element ).getReferencedEntityName(); } else { return null; } }
PersistentClass referencedPc = mappings.getClass( toOne.getReferencedEntityName() ); if ( toOne.getReferencedPropertyName() != null ) { try {
public static String getReferencedEntityName(Value value) { if ( value instanceof ToOne ) { return ( (ToOne) value ).getReferencedEntityName(); } else if ( value instanceof OneToMany ) { return ( (OneToMany) value ).getReferencedEntityName(); } else if ( value instanceof Collection ) { return getReferencedEntityName( ( (Collection) value ).getElement() ); } return null; }
private String findMappedByProperty(Collection collection, String ownerEntityName, List<String> columnNames, Iterator propertyIterator) { while (propertyIterator.hasNext()) { Property property = (Property) propertyIterator.next(); if (property.getValue() instanceof Component) { String name = findMappedByProperty(collection, ownerEntityName, columnNames, ((Component) property.getValue()).getPropertyIterator()); if (name != null) { return property.getName() + "." + name; } } else if (property.getValue() instanceof ToOne) { ToOne toOne = (ToOne) property.getValue(); if (ownerEntityName.equals(toOne.getReferencedEntityName()) && matches(columnNames, collection.getKey().getColumnIterator())) { return property.getName(); } } } return null; }
private EntityTypeDescriptor<J> resolveEntityDescriptor( ElementClassification elementClassification, Collection mappingBinding, RuntimeModelCreationContext creationContext) { final String elementEntityName; if ( elementClassification == ElementClassification.MANY_TO_MANY ) { elementEntityName = ( (ToOne) mappingBinding.getElement() ).getReferencedEntityName(); } else if ( elementClassification == ElementClassification.ONE_TO_MANY ) { elementEntityName = ( (OneToMany) mappingBinding.getElement() ).getReferencedEntityName(); } else { throw new HibernateException( String.format( Locale.ROOT, "Unexpected collection element classification [%s] for an entity-valued element", elementClassification.name() ) ); } return creationContext.getInFlightRuntimeModel().findEntityDescriptor( elementEntityName ); }