当前位置: 首页>>代码示例>>Java>>正文


Java Persistent类代码示例

本文整理汇总了Java中javax.jdo.annotations.Persistent的典型用法代码示例。如果您正苦于以下问题:Java Persistent类的具体用法?Java Persistent怎么用?Java Persistent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Persistent类属于javax.jdo.annotations包,在下文中一共展示了Persistent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDefaultFetchGroupMetadata

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
private void addDefaultFetchGroupMetadata(FieldMetadata fmd, Class<?> definition) {
    java.lang.reflect.Field field = FieldUtils.getField(definition, fmd.getName(), true);

    if (field == null) {
        LOGGER.warn("Unable to retrieve field {} from class {}. Putting the field in the default fetch group by default.",
                fmd.getName(), definition.getName());
        fmd.setDefaultFetchGroup(true);
    } else {
        Persistent persistentAnnotation = ReflectionsUtil.getAnnotationSelfOrAccessor(field, Persistent.class);

        // set to true, unless there is a JDO annotation that specifies otherwise
        if (persistentAnnotation == null || StringUtils.isBlank(persistentAnnotation.defaultFetchGroup())) {
            fmd.setDefaultFetchGroup(true);
        }
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:17,代码来源:EntityMetadataBuilderImpl.java

示例2: getEstado

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Obtiene el estado de una comanda
 * @return estado IEstadoComanda
 */
@Hidden
@Title(prepend = "Comanda ")
@Persistent(extensions = {
		@Extension(vendorName = "datanucleus", key = "mapping-strategy", value = "per-implementation"),
		@Extension(vendorName = "datanucleus", key = "implementation-classes", value = "dom.comanda.estado.NoConfirmada"
				+ ",dom.comanda.estado.EnEspera"
				+ ",dom.comanda.estado.EnPreparacion"
				+ ",dom.comanda.estado.Preparada") }, columns = {
		@Column(name = "idNoConfirmada"), @Column(name = "idEnEspera"),
		@Column(name = "idEnPreparacion"), @Column(name = "idPreparada") }, dependent = "true")
@MemberOrder(sequence = "2")
@Column(allowsNull = "false")
public IEstadoComanda getEstado() {
	return estado;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:20,代码来源:Comanda.java

示例3: addManyToManyMetadata

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
private void addManyToManyMetadata(FieldMetadata fmd, RelationshipHolder holder, EntityDto entity, FieldDto field,
                                   Class<?> definition) {
    // If tables and column names have been specified in annotations, do not set their metadata
    // Join metadata must be present at exactly one side of the M:N relation when using Sets
    // When using Lists join metadata must be present at two sides of M:N relation
    if (!holder.isOwningSide() || holder.isListManyToMany()) {
        java.lang.reflect.Field fieldDefinition = FieldUtils.getDeclaredField(definition, field.getBasic().getName(),
                true);

        Join join = fieldDefinition.getAnnotation(Join.class);
        Persistent persistent = fieldDefinition.getAnnotation(Persistent.class);
        Element element = fieldDefinition.getAnnotation(Element.class);

        JoinMetadata jmd = null;

        if (join == null) {
            jmd = fmd.newJoinMetadata();
        }

        setTableNameMetadata(fmd, persistent, entity, field, holder, EntityType.STANDARD);
        setElementMetadata(fmd, element, holder, entity);

        if (join == null || StringUtils.isEmpty(join.column())) {
            setJoinMetadata(jmd, fmd, ClassName.getSimpleName(entity.getClassName()).toUpperCase() + ID_SUFFIX);
            ForeignKeyMetadata fkmd = getOrCreateFkMetadata(jmd);
            fkmd.setName(KeyNames.foreignKeyName(entity.getName(), entity.getId(), field.getBasic().getName(),
                    EntityType.STANDARD));
        }
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:31,代码来源:EntityMetadataBuilderImpl.java

示例4: setTableNameMetadata

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
private void setTableNameMetadata(FieldMetadata fmd, Persistent persistent, EntityDto entity, FieldDto field,
                                  RelationshipHolder holder, EntityType entityType) {
    if (persistent != null && StringUtils.isNotEmpty(persistent.table()) && entityType != EntityType.STANDARD) {
        fmd.setTable(entityType.getTableName(persistent.table()));
    } else if (persistent == null || StringUtils.isEmpty(persistent.table())) {
        fmd.setTable(getJoinTableName(entity.getModule(), entity.getNamespace(), field.getBasic().getName(),
                holder.getRelatedField()));
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:10,代码来源:EntityMetadataBuilderImpl.java

示例5: getIdGeneratorStrategy

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
private IdGeneratorStrategy getIdGeneratorStrategy(FieldMetadata fmd, Class<?> definition) {
    java.lang.reflect.Field field = FieldUtils.getField(definition, fmd.getName(), true);
    if (field != null) {
        Persistent persistentAnnotation = ReflectionsUtil.getAnnotationSelfOrAccessor(field, Persistent.class);
        if (persistentAnnotation != null && persistentAnnotation.valueStrategy() != null
                && !persistentAnnotation.valueStrategy().equals(IdGeneratorStrategy.UNSPECIFIED)) {
            return persistentAnnotation.valueStrategy();
        }
    }

    return IdGeneratorStrategy.NATIVE;
}
 
开发者ID:motech,项目名称:motech,代码行数:13,代码来源:EntityMetadataBuilderImpl.java

示例6: getMappedBy

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
private String getMappedBy(AccessibleObject element) {
    for (AccessibleObject ao : MemberUtil.getFieldAndAccessorsForElement(element)) {
        Persistent persistentAnnotation = getAnnotationClassLoaderSafe(ao,
                MemberUtil.getDeclaringClass(ao), Persistent.class);

        if (persistentAnnotation != null) {
            return persistentAnnotation.mappedBy();
        }
    }
    return null;
}
 
开发者ID:motech,项目名称:motech,代码行数:12,代码来源:FieldProcessor.java

示例7: getNumero

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Obtiene el numero de una nueva Factura, el cual se genera en forma
 * automatica
 * 
 * @return numero long
 */
@Title(prepend = "Factura Nº ")
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT, sequence = "secuenciaNumeroFactura")
@Named("Número")
@TypicalLength(3)
@Disabled
@MemberOrder(sequence = "1")
@Column(allowsNull = "false")
public long getNumero() {
	return numero;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:17,代码来源:Factura.java

示例8: getUsuario

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Permite obtener un nombre de usuario
 * @return
 */
@Hidden
@Persistent(dependent = "true")
@Column(allowsNull = "false")
public Usuario getUsuario() {
	return usuario;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:11,代码来源:Persona.java

示例9: getLegajo

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Retorna el legajo del Empleado que se va a crear.
 * @return legajo long
 */
@TypicalLength(5)
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT, sequence = "secuenciaLegajo")
@MemberOrder(sequence = "1")
@Column(allowsNull = "false")
public long getLegajo() {
	return legajo;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:12,代码来源:Empleado.java

示例10: getNumeroCliente

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Retorna el numero de Cliente que se va a crear
 * 
 * @return numeroCliente long
 * @return long numeroCliente
 */
@TypicalLength(5)
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT, sequence = "secuenciaNumeroCliente")
@MemberOrder(sequence = "1")
@Column(allowsNull = "false")
public long getNumeroCliente() {
	return numeroCliente;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:14,代码来源:Cliente.java

示例11: getNumero

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Obtiene el numero de un nuevo Menu que se 
 * generará de forma automática
 * @return numero int
 */
@Hidden(where = Where.ALL_TABLES)
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT, sequence = "secuenciaNumeroMenu")
@TypicalLength(3)
@Disabled
@Column(allowsNull = "false")
@MemberOrder(sequence = "1")
public int getNumero() {
	return numero;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:15,代码来源:Menu.java

示例12: getNumero

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Obtiene el numero de una nueva comanda, el cual se genera en forma automatica
 * @return numero int
 */
@Named("Número")
@TypicalLength(3)
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT, sequence = "secuenciaNumeroComanda")
@Disabled
@Column(allowsNull = "false")
@MemberOrder(sequence = "1")
public int getNumero() {
	return numero;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:14,代码来源:Comanda.java

示例13: getProductos

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Obtiene una lista de Productos Elaborados
 * @return productos List<ValueProductosElaborados>
 */
@Persistent(dependentElement = "true")
@Join(deleteAction = ForeignKeyAction.CASCADE)
@Render(Type.EAGERLY)
@MemberOrder(sequence = "1")
public List<ValueProductoElaborado> getProductos() {
	return productos;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:12,代码来源:Comanda.java

示例14: getMenues

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Obtiene una lista de menues
 * @return menues List<ValueMenu>
 */
@Persistent(dependentElement = "true")
@Join(deleteAction = ForeignKeyAction.CASCADE)
@Render(Type.EAGERLY)
@MemberOrder(sequence = "2")
public List<ValueMenu> getMenues() {
	return menues;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:12,代码来源:Comanda.java

示例15: getOfertas

import javax.jdo.annotations.Persistent; //导入依赖的package包/类
/**
 * Permite obtener Ofertas para la comanda
 * @return list<Oferta>
 */
@Persistent(dependentElement = "true")
@Join(deleteAction = ForeignKeyAction.CASCADE)
@Render(Type.EAGERLY)
@MemberOrder(sequence = "3")
public List<ValueOferta> getOfertas() {
	return ofertas;
}
 
开发者ID:resto-tesis,项目名称:resto-tesis,代码行数:12,代码来源:Comanda.java


注:本文中的javax.jdo.annotations.Persistent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。