org.hibernate.annotations.Type Java Examples

The following examples show how to use org.hibernate.annotations.Type. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnumArrayType.java    From hibernate-types with Apache License 2.0 6 votes vote down vote up
@Override
public void setParameterValues(Properties parameters) {
    DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE);
    Annotation[] annotations = parameterType.getAnnotationsMethod();
    if (annotations != null) {
        for (int i = 0; i < annotations.length; i++) {
            Annotation annotation = annotations[i];
            if (Type.class.isAssignableFrom(annotation.annotationType())) {
                Type type = (Type) annotation;
                name = type.type();
                break;
            }
        }
    }
    if (name == null) {
        name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE));
    }
    ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters);
}
 
Example #2
Source File: EnumArrayType.java    From hibernate-types with Apache License 2.0 6 votes vote down vote up
@Override
public void setParameterValues(Properties parameters) {
    DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE);
    Annotation[] annotations = parameterType.getAnnotationsMethod();
    if (annotations != null) {
        for (int i = 0; i < annotations.length; i++) {
            Annotation annotation = annotations[i];
            if (Type.class.isAssignableFrom(annotation.annotationType())) {
                Type type = (Type) annotation;
                name = type.type();
                break;
            }
        }
    }
    if (name == null) {
        name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE));
    }
    ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters);
}
 
Example #3
Source File: EnumArrayType.java    From hibernate-types with Apache License 2.0 6 votes vote down vote up
@Override
public void setParameterValues(Properties parameters) {
    DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE);
    Annotation[] annotations = parameterType.getAnnotationsMethod();
    if (annotations != null) {
        for (int i = 0; i < annotations.length; i++) {
            Annotation annotation = annotations[i];
            if (Type.class.isAssignableFrom(annotation.annotationType())) {
                Type type = (Type) annotation;
                name = type.type();
                break;
            }
        }
    }
    if (name == null) {
        name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE));
    }
    ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters);
}
 
Example #4
Source File: EnumArrayType.java    From hibernate-types with Apache License 2.0 6 votes vote down vote up
@Override
public void setParameterValues(Properties parameters) {
    DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE);
    Annotation[] annotations = parameterType.getAnnotationsMethod();
    if (annotations != null) {
        for (int i = 0; i < annotations.length; i++) {
            Annotation annotation = annotations[i];
            if (Type.class.isAssignableFrom(annotation.annotationType())) {
                Type type = (Type) annotation;
                name = type.type();
                break;
            }
        }
    }
    if (name == null) {
        name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE));
    }
    ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters);
}
 
Example #5
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Column(name = "EXECUTER_INFORMATION_DATA", length = Integer.MAX_VALUE)
@Cascade(CascadeType.ALL)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @org.hibernate.annotations.Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
@OnDelete(action = OnDeleteAction.CASCADE)
public ExecuterInformationData getExecuterInformationData() {
    return executerInformationData;
}
 
Example #6
Source File: PropertyContainer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static boolean discoverTypeWithoutReflection(XProperty p) {
	if ( p.isAnnotationPresent( OneToOne.class ) && !p.getAnnotation( OneToOne.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( OneToMany.class ) && !p.getAnnotation( OneToMany.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( ManyToOne.class ) && !p.getAnnotation( ManyToOne.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( ManyToMany.class ) && !p.getAnnotation( ManyToMany.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( ManyToAny.class ) ) {
		if ( !p.isCollection() && !p.isArray() ) {
			throw new AnnotationException( "@ManyToAny used on a non collection non array property: " + p.getName() );
		}
		return true;
	}
	else if ( p.isAnnotationPresent( Type.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( Target.class ) ) {
		return true;
	}
	return false;
}
 
Example #7
Source File: SimpleValueBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setExplicitType(Type typeAnn) {
	if ( typeAnn != null ) {
		explicitType = typeAnn.type();
		typeParameters.clear();
		for ( Parameter param : typeAnn.parameters() ) {
			typeParameters.setProperty( param.name(), param.value() );
		}
	}
}
 
Example #8
Source File: RMNodeData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public String[] getJmxUrls() {
    return jmxUrls;
}
 
Example #9
Source File: RMNodeData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public Client getOwner() {
    return owner;
}
 
Example #10
Source File: RMNodeData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(name = "USAGE_INFO", length = Integer.MAX_VALUE, nullable = true)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public Map<String, String> getUsageInfo() {
    return usageInfo;
}
 
Example #11
Source File: ImportItem.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
@DateTimeFormat(iso = ISO.DATE)
public LocalDateTime getPublicationDate() {
    return publicationDate;
}
 
Example #12
Source File: Snippet.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable = false)
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getUpdatedDate() {
	return updatedDate;
}
 
Example #13
Source File: PaperightTheme.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable = false)
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getCreatedDate() {
	return createdDate;
}
 
Example #14
Source File: Product.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable=false)
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getUpdatedDate() {
	return updatedDate;
}
 
Example #15
Source File: PublisherPaymentDetails.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable=false)
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getUpdatedDate() {
	return updatedDate;
}
 
Example #16
Source File: PublisherPaymentRequest.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable=false, updatable=false)
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getCreatedDate() {
	return createdDate;
}
 
Example #17
Source File: Company.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable = false)
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getCreatedDate() {
	return createdDate;
}
 
Example #18
Source File: Company.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable = true)
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getDateOfEstablishment() {
	return dateOfEstablishment;
}
 
Example #19
Source File: RMNodeData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public NodeState getState() {
    return state;
}
 
Example #20
Source File: RMNodeData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public Permission getUserPermission() {
    return userPermission;
}
 
Example #21
Source File: RMNodeData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public Client getProvider() {
    return provider;
}
 
Example #22
Source File: ScriptData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(name = "URL", length = Integer.MAX_VALUE)
@Lob
@Type(type = "org.hibernate.type.MaterializedClobType")
public String getURL() {
    return url;
}
 
Example #23
Source File: NodeSourceData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public Map<String, Serializable> getInfrastructureVariables() {
    return infrastructureVariables;
}
 
Example #24
Source File: NodeSourceData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public LinkedHashMap<String, String> getAdditionalInformation() {
    return additionalInformation;
}
 
Example #25
Source File: NodeSourceData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public Client getProvider() {
    return provider;
}
 
Example #26
Source File: NodeSourceData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public List<Serializable> getPolicyParameters() {
    return policyParameters;
}
 
Example #27
Source File: NodeSourceData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
public List<Serializable> getInfrastructureParameters() {
    return infrastructureParameters;
}
 
Example #28
Source File: NodeSourceData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(length = Integer.MAX_VALUE)
@Type(type = "org.hibernate.type.MaterializedClobType")
public String getInfrastructureType() {
    return infrastructureType;
}
 
Example #29
Source File: PublisherEarning.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable=false, updatable=false)
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getCreatedDate() {
	return createdDate;
}
 
Example #30
Source File: PdfConversion.java    From website with GNU Affero General Public License v3.0 4 votes vote down vote up
@Column(nullable=false, updatable=false)
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
public DateTime getCreatedDate() {
	return createdDate;
}