本文整理汇总了Java中org.hibernate.mapping.Property.isInsertable方法的典型用法代码示例。如果您正苦于以下问题:Java Property.isInsertable方法的具体用法?Java Property.isInsertable怎么用?Java Property.isInsertable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.mapping.Property
的用法示例。
在下文中一共展示了Property.isInsertable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildStandardProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
@Deprecated
public static StandardProperty buildStandardProperty(Property property, boolean lazyAvailable) {
final Type type = property.getValue().getType();
// we need to dirty check collections, since they can cause an owner
// version number increment
// we need to dirty check many-to-ones with not-found="ignore" in order
// to update the cache (not the database), since in this case a null
// entity reference can lose information
boolean alwaysDirtyCheck = type.isAssociationType() &&
( (AssociationType) type ).isAlwaysDirtyChecked();
return new StandardProperty(
property.getName(),
type,
lazyAvailable && property.isLazy(),
property.isInsertable(),
property.isUpdateable(),
property.getValueGenerationStrategy(),
property.isOptional(),
alwaysDirtyCheck || property.isUpdateable(),
property.isOptimisticLocked(),
property.getCascadeStyle(),
property.getValue().getFetchMode()
);
}
示例2: buildVersionProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
/**
* Generates a VersionProperty representation for an entity mapping given its
* version mapping Property.
*
* @param property The version mapping Property.
* @param lazyAvailable Is property lazy loading currently available.
* @return The appropriate VersionProperty definition.
*/
public static VersionProperty buildVersionProperty(Property property, boolean lazyAvailable) {
String mappedUnsavedValue = ( (KeyValue) property.getValue() ).getNullValue();
VersionValue unsavedValue = UnsavedValueFactory.getUnsavedVersionValue(
mappedUnsavedValue,
getGetter( property ),
(VersionType) property.getType(),
getConstructor( property.getPersistentClass() )
);
boolean lazy = lazyAvailable && property.isLazy();
return new VersionProperty(
property.getName(),
property.getNodeName(),
property.getValue().getType(),
lazy,
property.isInsertable(),
property.isUpdateable(),
property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS,
property.getGeneration() == PropertyGeneration.ALWAYS,
property.isOptional(),
property.isUpdateable() && !lazy,
property.isOptimisticLocked(),
property.getCascadeStyle(),
unsavedValue
);
}
示例3: buildStandardProperty
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
/**
* Generate a "standard" (i.e., non-identifier and non-version) based on the given
* mapped property.
*
* @param property The mapped property.
* @param lazyAvailable Is property lazy loading currently available.
* @return The appropriate StandardProperty definition.
*/
public static StandardProperty buildStandardProperty(Property property, boolean lazyAvailable) {
final Type type = property.getValue().getType();
// we need to dirty check collections, since they can cause an owner
// version number increment
// we need to dirty check many-to-ones with not-found="ignore" in order
// to update the cache (not the database), since in this case a null
// entity reference can lose information
boolean alwaysDirtyCheck = type.isAssociationType() &&
( (AssociationType) type ).isAlwaysDirtyChecked();
return new StandardProperty(
property.getName(),
property.getNodeName(),
type,
lazyAvailable && property.isLazy(),
property.isInsertable(),
property.isUpdateable(),
property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS,
property.getGeneration() == PropertyGeneration.ALWAYS,
property.isOptional(),
alwaysDirtyCheck || property.isUpdateable(),
property.isOptimisticLocked(),
property.getCascadeStyle(),
property.getValue().getFetchMode()
);
}
示例4: extractColumnValues
import org.hibernate.mapping.Property; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public String extractColumnValues(){
StringBuffer sb = new StringBuffer();
//add the pk column and value
sb.append(extractPrimaryKeyColumn() + " = " + extractPrimaryKeyValue() + " | ");
//loop through all the other properties and get what you need
for (String p: properties){
Property pr = pc.getProperty(p);
//make sure that this is not a collection and not a one to one as these values are not part of the table
if (!pr.getType().isCollectionType() && !(pr.getType() instanceof OneToOneType)) {
//make sure that the values are persistent values and not a forumla value
if (pr.isInsertable() || pr.isUpdateable()) {
int scale = 2;
//get the getter for the entity
Getter getter = pr.getGetter(entity.getClass());
//get column value
Object columnValue = getter.get(entity);
//get column name
for (Iterator it3 = pr.getColumnIterator(); it3.hasNext();) {
Column column = (Column)it3.next();
sb.append(column.getName());
scale = column.getScale();
}
sb.append(" = ");
//check what kind of type of value this is, it if it an association then get the forign key value from the associated entity
if (columnValue != null) {
if (!pr.getType().isAssociationType()) {
//if bigD set Scale
if (columnValue instanceof BigDecimal) {
columnValue = ((BigDecimal)columnValue).setScale(scale,BigDecimal.ROUND_HALF_DOWN);
} else if (columnValue instanceof java.util.Date) {
SimpleDateFormat sdf = null;
if(columnValue instanceof java.sql.Timestamp){
sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
}else{
sdf = new SimpleDateFormat(DATE_FORMAT);
}
columnValue = sdf.format(columnValue);
} else if (pr.getType().getName().equalsIgnoreCase("org.springframework.orm.hibernate3.support.ClobStringType")){
columnValue = "Clob Value";
}
sb.append(columnValue);
} else {
//since it's an association we know that column value is an object
String associatedEntityName = pr.getType().getName();
//associatedEntityName = ((EntityType)pr.getType()).getAssociatedEntityName ();
PersistentClass localPC = extractPersistentClass(associatedEntityName);
String fkValue = extractPrimaryKeyValue(localPC,columnValue);
sb.append(fkValue);
}
}
sb.append(" | ");
}
}
}
return sb.toString();
}