类javax.persistence.Lob源码实例Demo

下面列出了怎么用javax.persistence.Lob的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: bdf3   文件: AbstractCellPostParser.java
@Override
public void parse(Context context) {
	if (context.getValue() != null) {
		MappingRule mappingRule =context.getCurrentMappingRule();
		BeanMap beanMap = BeanMap.create(context.getCurrentEntity());
		if (context.getValue() != Constants.IGNORE_ERROR_FORMAT_DATA) {
			Field field = ReflectionUtils.findField(context.getEntityClass(), mappingRule.getPropertyName());
			Column column = field.getAnnotation(Column.class);
			if (column.nullable()) {
				if (context.getValue() == null) {
					throw new DataNullableException(context.getCurrentCell().getRow(), context.getCurrentCell().getCol());
				}
			}
			
			if (field.getType() == String.class && !field.isAnnotationPresent(Lob.class)) {
				String value = (String) context.getValue();
				if (value.getBytes().length > column.length()) {
					throw new DataLengthException(context.getCurrentCell().getRow(), context.getCurrentCell().getCol(), value, column.length());
				}
			}
			beanMap.put(mappingRule.getPropertyName(), context.getValue());
		}
	}
}
 
源代码2 项目: mPaaS   文件: FdContent.java
/**
 * 读-文档内容
 *
 * @return
 */
@Column
@Lob
@MetaProperty(messageKey = "property.fdContent")
default String getFdContent() {
    return (String) getExtendProps().get("fdContent");
}
 
源代码3 项目: o2oa   文件: CheckCore.java
public static void checkLobIndex(List<Class<?>> classes) throws Exception {
	for (Class<?> cls : classes) {
		List<Field> fields = FieldUtils.getAllFieldsList(cls);
		for (Field field : fields) {
			Lob lob = field.getAnnotation(Lob.class);
			Index index = field.getAnnotation(Index.class);
			if ((null != lob) && (null != index)) {
				System.err.println(String.format("checkLobIndex error: class: %s, field: %s.", cls.getName(),
						field.getName()));
			}
		}
	}
}
 
源代码4 项目: o2oa   文件: DynamicEntityBuilder.java
private void createStringLobField(Builder builder, Field field) {

//		public static final String stringLobValue_FIELDNAME = "stringLobValue";
//		@FieldDescribe("长文本.")
//		@Lob
//		@Basic(fetch = FetchType.EAGER)
//		@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + stringLobValue_FIELDNAME)

		AnnotationSpec lob = AnnotationSpec.builder(Lob.class).build();

		AnnotationSpec basic = AnnotationSpec.builder(Basic.class)
				.addMember("fetch", "javax.persistence.FetchType.EAGER").build();

		AnnotationSpec column = AnnotationSpec.builder(Column.class).addMember("length", "length_100M")
				.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();

		FieldSpec fieldSpec = FieldSpec.builder(String.class, field.getName(), Modifier.PRIVATE)
				.addAnnotation(this.fieldDescribe(field)).addAnnotation(lob).addAnnotation(basic).addAnnotation(column)
				.build();
		MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName()))
				.addModifiers(Modifier.PUBLIC).returns(String.class).addStatement("return this." + field.getName())
				.build();
		MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName()))
				.addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(String.class, field.getName())
				.addStatement("this." + field.getName() + " = " + field.getName()).build();
		builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set);

	}
 
@Override
public Optional<Boolean> isFilterable(BeanAttributeInformation attributeDesc) {
    Optional<Lob> lob = attributeDesc.getAnnotation(Lob.class);
    if (lob.isPresent()) {
        return Optional.of(false);
    }
    return Optional.empty();
}
 
源代码6 项目: jump-the-queue   文件: BinaryObjectEntity.java
/**
 * @return the {@link Blob} data.
 */
@Lob
@Column(name = "content")
public Blob getData() {

  return this.data;
}
 
@Override
public JdbcType getJdbcType() {

	if (isAnnotationPresent(
			org.springframework.data.mybatis.annotation.JdbcType.class)) {
		return JdbcType.valueOf(getRequiredAnnotation(
				org.springframework.data.mybatis.annotation.JdbcType.class).value());
	}

	if (isAnnotationPresent(Temporal.class)) {
		Temporal temporal = getRequiredAnnotation(Temporal.class);
		switch (temporal.value()) {

		case DATE:
			return DATE;
		case TIME:
			return TIME;
		case TIMESTAMP:
			return TIMESTAMP;
		}
	}

	Class<?> actualType = getActualType();

	if (isAnnotationPresent(Lob.class)) {
		if (actualType == String.class) {
			return CLOB;
		}
		return BLOB;
	}

	JdbcType jdbcType = JAVA_MAPPED_TO_JDBC_TYPES.get(actualType);

	return null == jdbcType ? UNDEFINED : jdbcType;
}
 
源代码8 项目: jeewx   文件: JeecgDemoCkfinderEntity.java
/**
 * 方法: 取得java.lang.Object
 * 
 * @return: java.lang.Object 备注
 */
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "REMARK", nullable = true)
public java.lang.String getRemark() {
	return this.remark;
}
 
源代码9 项目: cia   文件: CommitteeProposalData.java
/**
* Gets the ballot summary item.
*
* @return the ballot summary item
*/
  @Basic
  @Column(name = "BALLOT_SUMMARY_ITEM")
  @Lob
  public String getBallotSummaryItem() {
      return XmlAdapterUtils.unmarshall(ElementAsString.class, this.getBallotSummary());
  }
 
源代码10 项目: olingo-odata2   文件: JPATypeConverter.java
private static boolean isBlob(final Attribute<?, ?> currentAttribute) {
  if (currentAttribute != null) {
    AnnotatedElement annotatedElement = (AnnotatedElement) currentAttribute.getJavaMember();
    if (annotatedElement != null && annotatedElement.getAnnotation(Lob.class) != null) {
      return true;
    }
  }
  return false;
}
 
源代码11 项目: olingo-odata2   文件: JPATypeConverterTest.java
@SuppressWarnings("unchecked")
@Override
public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {

  if (testCase.equals("temporalnull")) {
    return null;
  }

  if (annotationClass.equals(Temporal.class)) {
    if (temporal == null) {
      temporal = EasyMock.createMock(Temporal.class);
      if (testCase.equals("datetime")) {
        EasyMock.expect(temporal.value()).andReturn(TemporalType.TIMESTAMP).anyTimes();
        EasyMock.replay(temporal);
      } else if (testCase.equals("time")) {
        EasyMock.expect(temporal.value()).andReturn(TemporalType.TIME).anyTimes();
        EasyMock.replay(temporal);
      }
    }
    return (T) temporal;
  } else if (annotationClass.equals(Lob.class)) {
    if (testCase.equals("lob")) {
      lob = EasyMock.createMock(Lob.class);
      EasyMock.replay(lob);
    }
    return (T) lob;
  }
  return null;

}
 
源代码12 项目: ankush   文件: NodeMonitoring.java
/**
 * @return the graphView
 */
@JsonIgnore
@Lob
@Column(length = Integer.MAX_VALUE - 1)
public byte[] getGraphView() {
	return graphView;
}
 
源代码13 项目: ankush   文件: NodeMonitoring.java
/**
 * @return the technologyServiceBytes
 */
@JsonIgnore
@Lob
@Column(length = Integer.MAX_VALUE - 1)
public byte[] getTechnologyServiceBytes() {
	return technologyServiceBytes;
}
 
源代码14 项目: ankush   文件: Template.java
/**
 * @return the dataBytes
 */
@JsonIgnore
@Lob
@Column(length = Integer.MAX_VALUE - 1)
public byte[] getDataBytes() {
	return dataBytes;
}
 
源代码15 项目: we-cmdb   文件: AdmOperateRecord.java
@Lob
@Column(name = "json_obj_str")
public String getJsonObjStr() {
    return this.jsonObjStr;
}
 
源代码16 项目: we-cmdb   文件: AdmLog.java
@Lob
@Column(name = "log_content")
public String getLogContent() {
    return this.logContent;
}
 
源代码17 项目: we-cmdb   文件: VersionAttr.java
@Lob
public String getV() {
    return this.v;
}
 
源代码18 项目: jeecg   文件: CgformFtlEntity.java
/**
 *方法: 取得
 *@return:   表单模板内容
 */
@Lob
@Column(name ="FTL_CONTENT",nullable=true)
public String getFtlContent(){
	return this.ftlContent;
}
 
源代码19 项目: Quelea   文件: Song.java
@Lob
@Column(name="translations", length=STRING_LENGTH)
public HashMap<String, String> getTranslations() {
    return translations;
}
 
源代码20 项目: crnk-framework   文件: AbstractEntityMetaFactory.java
@Override
protected void initAttribute(MetaAttribute attr) {
	ManyToMany manyManyAnnotation = attr.getAnnotation(ManyToMany.class);
	ManyToOne manyOneAnnotation = attr.getAnnotation(ManyToOne.class);
	OneToMany oneManyAnnotation = attr.getAnnotation(OneToMany.class);
	OneToOne oneOneAnnotation = attr.getAnnotation(OneToOne.class);
	Version versionAnnotation = attr.getAnnotation(Version.class);
	Lob lobAnnotation = attr.getAnnotation(Lob.class);
	Column columnAnnotation = attr.getAnnotation(Column.class);

	boolean idAttr = attr.getAnnotation(Id.class) != null || attr.getAnnotation(EmbeddedId.class) != null;
	boolean attrGenerated = attr.getAnnotation(GeneratedValue.class) != null;

	attr.setVersion(versionAnnotation != null);
	attr.setAssociation(
			manyManyAnnotation != null || manyOneAnnotation != null || oneManyAnnotation != null || oneOneAnnotation !=
					null);

	attr.setLazy(isJpaLazy(attr.getAnnotations(), attr.isAssociation()));
	attr.setLob(lobAnnotation != null);
	attr.setFilterable(lobAnnotation == null);
	attr.setSortable(lobAnnotation == null);

	attr.setCascaded(getCascade(manyManyAnnotation, manyOneAnnotation, oneManyAnnotation, oneOneAnnotation));

	if (attr.getReadMethod() == null) {
		throw new IllegalStateException("no getter found for " + attr.getParent().getName() + "." + attr.getName());
	}
	Class<?> attributeType = attr.getReadMethod().getReturnType();
	boolean isPrimitiveType = ClassUtils.isPrimitiveType(attributeType);
	boolean columnNullable = (columnAnnotation == null || columnAnnotation.nullable()) &&
			(manyOneAnnotation == null || manyOneAnnotation.optional()) &&
			(oneOneAnnotation == null || oneOneAnnotation.optional());
	attr.setNullable(!isPrimitiveType && columnNullable);

	boolean hasSetter = attr.getWriteMethod() != null;
	attr.setInsertable(hasSetter && (columnAnnotation == null || columnAnnotation.insertable()) && !attrGenerated
			&& versionAnnotation == null);
	attr.setUpdatable(
			hasSetter && (columnAnnotation == null || columnAnnotation.updatable()) && !idAttr && versionAnnotation == null);

}
 
源代码21 项目: jeecg   文件: TSAttachment.java
@Column(name = "attachmentcontent",length=3000)
@Lob
public byte[] getAttachmentcontent() {
	return this.attachmentcontent;
}
 
源代码22 项目: lams   文件: JPAOverriddenAnnotationReader.java
private void getLob(List<Annotation> annotationList, Element element) {
	Element subElement = element != null ? element.element( "lob" ) : null;
	if ( subElement != null ) {
		annotationList.add( AnnotationFactory.create( new AnnotationDescriptor( Lob.class ) ) );
	}
}
 
源代码23 项目: lams   文件: PropertyBinder.java
public Property makeProperty() {
	validateMake();
	LOG.debugf( "Building property %s", name );
	Property prop = new Property();
	prop.setName( name );
	prop.setValue( value );
	prop.setLazy( lazy );
	prop.setLazyGroup( lazyGroup );
	prop.setCascade( cascade );
	prop.setPropertyAccessorName( accessType.getType() );

	if ( property != null ) {
		prop.setValueGenerationStrategy( determineValueGenerationStrategy( property ) );

		if ( property.isAnnotationPresent( AttributeAccessor.class ) ) {
			final AttributeAccessor accessor = property.getAnnotation( AttributeAccessor.class );
			prop.setPropertyAccessorName( accessor.value() );
		}
	}

	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;
}
 
源代码24 项目: tianti   文件: Article.java
@Lob
public String getContent() {
	return content;
}
 
源代码25 项目: celerio-angular-quickstart   文件: Book.java
@Basic(fetch = LAZY)
@Column(name = "EXTRACT_BINARY")
@Lob
public byte[] getExtractBinary() {
    return extractBinary;
}
 
源代码26 项目: jeewx   文件: CgformFtlEntity.java
/**
 *方法: 取得byte[]
 *@return: byte[]  表单模板内容
 */
@Lob
@Column(name ="FTL_CONTENT",nullable=true)
public String getFtlContent(){
	return this.ftlContent;
}
 
源代码27 项目: jeewx   文件: TSAttachment.java
@Column(name = "attachmentcontent",length=3000)
@Lob
public byte[] getAttachmentcontent() {
	return this.attachmentcontent;
}
 
源代码28 项目: oval   文件: JPAAnnotationsConfigurer.java
protected void initializeChecks(final Column annotation, final Collection<Check> checks, final AccessibleObject fieldOrMethod) {
   /* If the value is generated (annotated with @GeneratedValue) it is allowed to be null
    * before the entity has been persisted, same is true in case of optimistic locking
    * when a field is annotated with @Version.
    * Therefore and because of the fact that there is no generic way to determine if an entity
    * has been persisted already, a not-null check will not be performed for such fields.
    */
   if (!annotation.nullable() //
      && !fieldOrMethod.isAnnotationPresent(GeneratedValue.class) //
      && !fieldOrMethod.isAnnotationPresent(Version.class) //
      && !fieldOrMethod.isAnnotationPresent(NotNull.class) //
      && !containsCheckOfType(checks, NotNullCheck.class) //
   ) {
      checks.add(new NotNullCheck());
   }

   // add Length check based on Column.length parameter, but only:
   if (!fieldOrMethod.isAnnotationPresent(Lob.class) && // if @Lob is not present
      !fieldOrMethod.isAnnotationPresent(Enumerated.class) && // if @Enumerated is not present
      !fieldOrMethod.isAnnotationPresent(Length.class) // if an explicit @Length constraint is not present
   ) {
      final LengthCheck lengthCheck = new LengthCheck();
      lengthCheck.setMax(annotation.length());
      checks.add(lengthCheck);
   }

   // add Range check based on Column.precision/scale parameters, but only:
   if (!fieldOrMethod.isAnnotationPresent(Range.class) // if an explicit @Range is not present
      && annotation.precision() > 0 // if precision is > 0
      && Number.class.isAssignableFrom(fieldOrMethod instanceof Field //
         ? ((Field) fieldOrMethod).getType() //
         : ((Method) fieldOrMethod).getReturnType()) // if numeric field type
   ) {
      /* precision = 6, scale = 2  => -9999.99<=x<=9999.99
       * precision = 4, scale = 1  =>   -999.9<=x<=999.9
       */
      final RangeCheck rangeCheck = new RangeCheck();
      rangeCheck.setMax(Math.pow(10, annotation.precision() - annotation.scale()) - Math.pow(0.1, annotation.scale()));
      rangeCheck.setMin(-1 * rangeCheck.getMax());
      checks.add(rangeCheck);
   }
}
 
源代码29 项目: sample-java-spring-genericdao   文件: Student.java
@Lob
@Column(name = "STUDENT_PHOTO")
public byte[] getPhoto() {
	return this.picture;
}
 
源代码30 项目: sample-java-spring-genericdao   文件: Instructor.java
@Lob
@Column(name = "INSTRUCTOR_RESUME", nullable = false)
public char[]  getResume() {
	return this.resume;
}
 
 类所在包
 同包方法