private boolean hasAnyMutableNaturalIdProps() { final Iterator itr = rootEntityDescriptor.getDeclaredPropertyIterator(); while ( itr.hasNext() ) { final Property prop = (Property) itr.next(); if ( prop.isNaturalIdentifier() && prop.isUpdateable() ) { return true; } } return false; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
if ( prop.isNaturalIdentifier() ) { naturalIdNumbers.add( i ); if ( prop.isUpdateable() ) {
/** * create a property copy reusing the same value */ public static Property shallowCopy(Property property) { Property clone = new Property(); clone.setCascade( property.getCascade() ); clone.setInsertable( property.isInsertable() ); clone.setLazy( property.isLazy() ); clone.setName( property.getName() ); clone.setNaturalIdentifier( property.isNaturalIdentifier() ); clone.setOptimisticLocked( property.isOptimisticLocked() ); clone.setOptional( property.isOptional() ); clone.setPersistentClass( property.getPersistentClass() ); clone.setPropertyAccessorName( property.getPropertyAccessorName() ); clone.setSelectable( property.isSelectable() ); clone.setUpdateable( property.isUpdateable() ); clone.setValue( property.getValue() ); return clone; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
private boolean hasAnyMutableNaturalIdProps() { final Iterator itr = rootEntityDescriptor.getDeclaredPropertyIterator(); while ( itr.hasNext() ) { final Property prop = (Property) itr.next(); if ( prop.isNaturalIdentifier() && prop.isUpdateable() ) { return true; } } return false; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
private boolean usePropertyInEquals(Property property) { boolean hasEqualsMetaAttribute = c2j.hasMetaAttribute(property, "use-in-equals"); boolean useInEquals = c2j.getMetaAsBool( property, "use-in-equals" ); if(property.isNaturalIdentifier()) { if(hasEqualsMetaAttribute && !useInEquals) { return false; } else { return true; } } return useInEquals; }
private boolean usePropertyInEquals(Property property) { boolean hasEqualsMetaAttribute = c2j.hasMetaAttribute(property, "use-in-equals"); boolean useInEquals = c2j.getMetaAsBool( property, "use-in-equals" ); if(property.isNaturalIdentifier()) { if(hasEqualsMetaAttribute && !useInEquals) { return false; } else { return true; } } return useInEquals; }
/** * @param clazz persistent class. * @return "String name, int number, ..." for a property list, usable for method declarations. * <p/> * TODO: handle this in a template ? */ public String asNaturalIdParameterList(PersistentClass clazz) { Iterator<?> fields = clazz.getRootClass().getPropertyIterator(); StringBuffer buf = new StringBuffer(); while ( fields.hasNext() ) { Property field = (Property) fields.next(); if ( field.isNaturalIdentifier() ) { buf.append( getJavaTypeName( field, false ) ) .append( " " ) .append( field.getName() ) .append( ", " ); } } return buf.substring( 0, buf.length() - 2 ); }
/** * create a property copy reusing the same value */ public static Property shallowCopy(Property property) { Property clone = new Property(); clone.setCascade( property.getCascade() ); clone.setInsertable( property.isInsertable() ); clone.setLazy( property.isLazy() ); clone.setName( property.getName() ); clone.setNodeName( property.getNodeName() ); clone.setNaturalIdentifier( property.isNaturalIdentifier() ); clone.setOptimisticLocked( property.isOptimisticLocked() ); clone.setOptional( property.isOptional() ); clone.setPersistentClass( property.getPersistentClass() ); clone.setPropertyAccessorName( property.getPropertyAccessorName() ); clone.setSelectable( property.isSelectable() ); clone.setUpdateable( property.isUpdateable() ); clone.setValue( property.getValue() ); return clone; }
/** * @param clazz persistent class. * @return "String name, int number, ..." for a property list, usable for method declarations. * <p/> * TODO: handle this in a template ? */ public String asNaturalIdParameterList(PersistentClass clazz) { Iterator<?> fields = clazz.getRootClass().getPropertyIterator(); StringBuffer buf = new StringBuffer(); while ( fields.hasNext() ) { Property field = (Property) fields.next(); if ( field.isNaturalIdentifier() ) { buf.append( getJavaTypeName( field, false ) ) .append( " " ) .append( field.getName() ) .append( ", " ); } } return buf.substring( 0, buf.length() - 2 ); }
@Override public void finishInitialization(RuntimeModelCreationContext creationContext, RootClass mappingType) { if ( mappingType.hasNaturalId() ) { final List<NonIdPersistentAttribute> attributes = new ArrayList<>(); for ( Property property : mappingType.getDeclaredProperties() ) { if ( property.isNaturalIdentifier() ) { final NonIdPersistentAttribute<?, ?> runtimeAttribute = rootEntityDescriptor.findPersistentAttribute( property.getName() ); if ( !SingularPersistentAttribute.class.isInstance( runtimeAttribute ) ) { throw new HibernateException( "Attempt to define non-singular attribute [" + property.getName() + "] as part of the entity's natural-id : " + rootEntityDescriptor.getEntityName() ); } attributes.add( runtimeAttribute ); } } ( (NaturalIdDescriptorImpl) naturalIdentifierDescriptor ).injectAttributes( attributes ); } }
if ( prop.isNaturalIdentifier() ) { naturalIdNumbers.add( i ); if ( prop.isUpdateable() ) {
public Property shallowCopy() { Property clone = new Property( context ); clone.setCascade( getCascade() ); clone.setInsertable( isInsertable() ); clone.setLazy( isLazy() ); clone.setName( getName() ); clone.setNaturalIdentifier( isNaturalIdentifier() ); clone.setOptimisticLocked( isOptimisticLocked() ); clone.setOptional( isOptional() ); clone.setPersistentClass( (PersistentClass) getEntity() ); clone.setPropertyAccessorName( getPropertyAccessorName() ); clone.setSelectable( isSelectable() ); clone.setUpdateable( isUpdateable() ); clone.setValue( getValue() ); return clone; } }
/** * create a property copy reusing the same value */ public static Property shallowCopy(Property property) { Property clone = new Property(); clone.setCascade( property.getCascade() ); clone.setInsertable( property.isInsertable() ); clone.setLazy( property.isLazy() ); clone.setName( property.getName() ); clone.setNaturalIdentifier( property.isNaturalIdentifier() ); clone.setOptimisticLocked( property.isOptimisticLocked() ); clone.setOptional( property.isOptional() ); clone.setPersistentClass( property.getPersistentClass() ); clone.setPropertyAccessorName( property.getPropertyAccessorName() ); clone.setSelectable( property.isSelectable() ); clone.setUpdateable( property.isUpdateable() ); clone.setValue( property.getValue() ); return clone; }
/** * create a property copy reusing the same value */ public static Property shallowCopy(Property property) { Property clone = new Property(); clone.setCascade( property.getCascade() ); clone.setInsertable( property.isInsertable() ); clone.setLazy( property.isLazy() ); clone.setName( property.getName() ); clone.setNodeName( property.getNodeName() ); clone.setNaturalIdentifier( property.isNaturalIdentifier() ); clone.setOptimisticLocked( property.isOptimisticLocked() ); clone.setOptional( property.isOptional() ); clone.setPersistentClass( property.getPersistentClass() ); clone.setPropertyAccessorName( property.getPropertyAccessorName() ); clone.setSelectable( property.isSelectable() ); clone.setUpdateable( property.isUpdateable() ); clone.setValue( property.getValue() ); return clone; }
/** * create a property copy reusing the same value */ public static Property shallowCopy(Property property) { Property clone = new Property(); clone.setCascade( property.getCascade() ); clone.setInsertable( property.isInsertable() ); clone.setLazy( property.isLazy() ); clone.setName( property.getName() ); clone.setNodeName( property.getNodeName() ); clone.setNaturalIdentifier( property.isNaturalIdentifier() ); clone.setOptimisticLocked( property.isOptimisticLocked() ); clone.setOptional( property.isOptional() ); clone.setPersistentClass( property.getPersistentClass() ); clone.setPropertyAccessorName( property.getPropertyAccessorName() ); clone.setSelectable( property.isSelectable() ); clone.setUpdateable( property.isUpdateable() ); clone.setValue( property.getValue() ); return clone; }