本文整理匯總了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);
}
}
}
示例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;
}
示例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));
}
}
}
示例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()));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}