本文整理汇总了Java中org.hibernate.mapping.Property.setName方法的典型用法代码示例。如果您正苦于以下问题:Java Property.setName方法的具体用法?Java Property.setName怎么用?Java Property.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.mapping.Property
的用法示例。
在下文中一共展示了Property.setName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shallowCopy
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
/**
* 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;
}
示例2: generateIdProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateIdProperty() {
SimpleValue value = new SimpleValue();
value.setTypeName( "long" );
Property property = new Property();
property.setName( "id" );
property.setNodeName( "@id" );
property.setValue( value );
return property;
}
示例3: generateTextProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateTextProperty() {
SimpleValue value = new SimpleValue();
value.setTypeName( "string" );
Property property = new Property();
property.setName( "text" );
property.setNodeName( "." );
property.setValue( value );
return property;
}
示例4: generateAccountIdProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateAccountIdProperty() {
SimpleValue value = new SimpleValue();
value.setTypeName( "long" );
Property property = new Property();
property.setName( "number" );
property.setNodeName( "account/@num" );
property.setValue( value );
return property;
}
示例5: generateNameProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
private Property generateNameProperty() {
SimpleValue value = new SimpleValue();
value.setTypeName( "string" );
Property property = new Property();
property.setName( "name" );
property.setNodeName( "name" );
property.setValue( value );
return property;
}
示例6: bindCompositeId
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
public static void bindCompositeId(Element node, Component component,
PersistentClass persistentClass, String propertyName, Mappings mappings,
java.util.Map inheritedMetas) throws MappingException {
component.setKey( true );
String path = StringHelper.qualify(
persistentClass.getEntityName(),
propertyName == null ? "id" : propertyName );
bindComponent(
node,
component,
persistentClass.getClassName(),
propertyName,
path,
false,
node.attribute( "class" ) == null
&& propertyName == null,
mappings,
inheritedMetas,
false
);
if ( "true".equals( node.attributeValue("mapped") ) ) {
if ( propertyName!=null ) {
throw new MappingException("cannot combine mapped=\"true\" with specified name");
}
Component mapper = new Component( mappings, persistentClass );
bindComponent(
node,
mapper,
persistentClass.getClassName(),
null,
path,
false,
true,
mappings,
inheritedMetas,
true
);
persistentClass.setIdentifierMapper(mapper);
Property property = new Property();
property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
property.setNodeName("id");
property.setUpdateable(false);
property.setInsertable(false);
property.setValue(mapper);
property.setPropertyAccessorName( "embedded" );
persistentClass.addProperty(property);
}
}
示例7: makeProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
public Property makeProperty() {
validateMake();
LOG.debugf( "Building property %s", name );
Property prop = new Property();
prop.setName( name );
prop.setNodeName( name );
prop.setValue( value );
prop.setLazy( lazy );
prop.setCascade( cascade );
prop.setPropertyAccessorName( accessType.getType() );
if ( property != null ) {
prop.setValueGenerationStrategy( determineValueGenerationStrategy( property ) );
}
NaturalId naturalId = property != null ? property.getAnnotation( NaturalId.class ) : null;
if ( naturalId != null ) {
if ( ! entityBinder.isRootEntity() ) {
throw new AnnotationException( "@NaturalId only valid on root entity (or its @MappedSuperclasses)" );
}
if ( ! naturalId.mutable() ) {
updatable = false;
}
prop.setNaturalIdentifier( true );
}
// HHH-4635 -- needed for dialect-specific property ordering
Lob lob = property != null ? property.getAnnotation( Lob.class ) : null;
prop.setLob( lob != null );
prop.setInsertable( insertable );
prop.setUpdateable( updatable );
// this is already handled for collections in CollectionBinder...
if ( Collection.class.isInstance( value ) ) {
prop.setOptimisticLocked( ( (Collection) value ).isOptimisticLocked() );
}
else {
final OptimisticLock lockAnn = property != null
? property.getAnnotation( OptimisticLock.class )
: null;
if ( lockAnn != null ) {
//TODO this should go to the core as a mapping validation checking
if ( lockAnn.excluded() && (
property.isAnnotationPresent( javax.persistence.Version.class )
|| property.isAnnotationPresent( Id.class )
|| property.isAnnotationPresent( EmbeddedId.class ) ) ) {
throw new AnnotationException(
"@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
+ StringHelper.qualify( holder.getPath(), name )
);
}
}
final boolean isOwnedValue = !isToOneValue( value ) || insertable; // && updatable as well???
final boolean includeInOptimisticLockChecks = ( lockAnn != null )
? ! lockAnn.excluded()
: isOwnedValue;
prop.setOptimisticLocked( includeInOptimisticLockChecks );
}
LOG.tracev( "Cascading {0} with {1}", name, cascade );
this.mappingProperty = prop;
return prop;
}
示例8: bindCompositeId
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
public static void bindCompositeId(Element node, Component component,
PersistentClass persistentClass, String propertyName, Mappings mappings,
java.util.Map inheritedMetas) throws MappingException {
component.setKey( true );
String path = StringHelper.qualify(
persistentClass.getEntityName(),
propertyName == null ? "id" : propertyName );
bindComponent(
node,
component,
persistentClass.getClassName(),
propertyName,
path,
false,
node.attribute( "class" ) == null
&& propertyName == null,
mappings,
inheritedMetas,
false
);
if ( "true".equals( node.attributeValue("mapped") ) ) {
if ( propertyName!=null ) {
throw new MappingException("cannot combine mapped=\"true\" with specified name");
}
Component mapper = new Component(persistentClass);
bindComponent(
node,
mapper,
persistentClass.getClassName(),
null,
path,
false,
true,
mappings,
inheritedMetas,
true
);
persistentClass.setIdentifierMapper(mapper);
Property property = new Property();
property.setName("_identifierMapper");
property.setNodeName("id");
property.setUpdateable(false);
property.setInsertable(false);
property.setValue(mapper);
property.setPropertyAccessorName( "embedded" );
persistentClass.addProperty(property);
}
}