javax.persistence.OneToOne Java Examples

The following examples show how to use javax.persistence.OneToOne. 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: BiDirectionalAssociationHandler.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private static String getMappedByNotManyToMany(FieldDescription target) {
	try {
		AnnotationDescription.Loadable<OneToOne> oto = EnhancerImpl.getAnnotation( target, OneToOne.class );
		if ( oto != null ) {
			return oto.getValue( new MethodDescription.ForLoadedMethod( OneToOne.class.getDeclaredMethod( "mappedBy" ) ) ).resolve( String.class );
		}

		AnnotationDescription.Loadable<OneToMany> otm = EnhancerImpl.getAnnotation( target, OneToMany.class );
		if ( otm != null ) {
			return otm.getValue( new MethodDescription.ForLoadedMethod( OneToMany.class.getDeclaredMethod( "mappedBy" ) ) ).resolve( String.class );
		}

		AnnotationDescription.Loadable<ManyToMany> mtm = EnhancerImpl.getAnnotation( target, ManyToMany.class );
		if ( mtm != null ) {
			return mtm.getValue( new MethodDescription.ForLoadedMethod( ManyToMany.class.getDeclaredMethod( "mappedBy" ) ) ).resolve( String.class );
		}
	}
	catch (NoSuchMethodException ignored) {
	}

	return null;
}
 
Example #2
Source File: AbstractEntityMetaFactory.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
private boolean getCascade(ManyToMany manyManyAnnotation, ManyToOne manyOneAnnotation, OneToMany oneManyAnnotation,
						   OneToOne oneOneAnnotation) {
	if (manyManyAnnotation != null) {
		return getCascade(manyManyAnnotation.cascade());
	}
	if (manyOneAnnotation != null) {
		return getCascade(manyOneAnnotation.cascade());
	}
	if (oneManyAnnotation != null) {
		return getCascade(oneManyAnnotation.cascade());
	}
	if (oneOneAnnotation != null) {
		return getCascade(oneOneAnnotation.cascade());
	}
	return false;
}
 
Example #3
Source File: JpaResourceFieldInformationProvider.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
@Override
public Optional<ResourceFieldType> getFieldType(BeanAttributeInformation attributeDesc) {
    Optional<OneToOne> oneToOne = attributeDesc.getAnnotation(OneToOne.class);
    Optional<OneToMany> oneToMany = attributeDesc.getAnnotation(OneToMany.class);
    Optional<ManyToOne> manyToOne = attributeDesc.getAnnotation(ManyToOne.class);
    Optional<ManyToMany> manyToMany = attributeDesc.getAnnotation(ManyToMany.class);
    if (oneToOne.isPresent() || oneToMany.isPresent() || manyToOne.isPresent() || manyToMany.isPresent()) {
        return Optional.of(ResourceFieldType.RELATIONSHIP);
    }

    Optional<Id> id = attributeDesc.getAnnotation(Id.class);
    Optional<EmbeddedId> embeddedId = attributeDesc.getAnnotation(EmbeddedId.class);
    if (id.isPresent() || embeddedId.isPresent()) {
        return Optional.of(ResourceFieldType.ID);
    }
    return Optional.empty();
}
 
Example #4
Source File: AnnotationBinder.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private static boolean hasAnnotationsOnIdClass(XClass idClass) {
//		if(idClass.getAnnotation(Embeddable.class) != null)
//			return true;

		List<XProperty> properties = idClass.getDeclaredProperties( XClass.ACCESS_FIELD );
		for ( XProperty property : properties ) {
			if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent( OneToMany.class ) ||
					property.isAnnotationPresent( ManyToOne.class ) || property.isAnnotationPresent( Id.class ) ||
					property.isAnnotationPresent( GeneratedValue.class ) || property.isAnnotationPresent( OneToOne.class ) ||
					property.isAnnotationPresent( ManyToMany.class )
					) {
				return true;
			}
		}
		List<XMethod> methods = idClass.getDeclaredMethods();
		for ( XMethod method : methods ) {
			if ( method.isAnnotationPresent( Column.class ) || method.isAnnotationPresent( OneToMany.class ) ||
					method.isAnnotationPresent( ManyToOne.class ) || method.isAnnotationPresent( Id.class ) ||
					method.isAnnotationPresent( GeneratedValue.class ) || method.isAnnotationPresent( OneToOne.class ) ||
					method.isAnnotationPresent( ManyToMany.class )
					) {
				return true;
			}
		}
		return false;
	}
 
Example #5
Source File: PersistentAttributesHelper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private static String getMappedByFromAnnotation(CtField persistentField) {

		OneToOne oto = PersistentAttributesHelper.getAnnotation( persistentField, OneToOne.class );
		if ( oto != null ) {
			return oto.mappedBy();
		}

		OneToMany otm = PersistentAttributesHelper.getAnnotation( persistentField, OneToMany.class );
		if ( otm != null ) {
			return otm.mappedBy();
		}

		// For @ManyToOne associations, mappedBy must come from the @OneToMany side of the association

		ManyToMany mtm = PersistentAttributesHelper.getAnnotation( persistentField, ManyToMany.class );
		return mtm == null ? "" : mtm.mappedBy();
	}
 
Example #6
Source File: AnnotationBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isIdClassPkOfTheAssociatedEntity(
		InheritanceState.ElementsToProcess elementsToProcess,
		XClass compositeClass,
		PropertyData inferredData,
		PropertyData baseInferredData,
		AccessType propertyAccessor,
		Map<XClass, InheritanceState> inheritanceStatePerClass,
		MetadataBuildingContext context) {
	if ( elementsToProcess.getIdPropertyCount() == 1 ) {
		final PropertyData idPropertyOnBaseClass = getUniqueIdPropertyFromBaseClass(
				inferredData,
				baseInferredData,
				propertyAccessor,
				context
		);
		final InheritanceState state = inheritanceStatePerClass.get( idPropertyOnBaseClass.getClassOrElement() );
		if ( state == null ) {
			return false; //while it is likely a user error, let's consider it is something that might happen
		}
		final XClass associatedClassWithIdClass = state.getClassWithIdClass( true );
		if ( associatedClassWithIdClass == null ) {
			//we cannot know for sure here unless we try and find the @EmbeddedId
			//Let's not do this thorough checking but do some extra validation
			final XProperty property = idPropertyOnBaseClass.getProperty();
			return property.isAnnotationPresent( ManyToOne.class )
					|| property.isAnnotationPresent( OneToOne.class );

		}
		else {
			final XClass idClass = context.getBootstrapContext().getReflectionManager().toXClass(
					associatedClassWithIdClass.getAnnotation( IdClass.class ).value()
			);
			return idClass.equals( compositeClass );
		}
	}
	else {
		return false;
	}
}
 
Example #7
Source File: SoftDeleteJoinExpressionProvider.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected Expression processOneToOneMapping(OneToOneMapping mapping) {
    ClassDescriptor descriptor = mapping.getDescriptor();
    Field referenceField = FieldUtils.getAllFieldsList(descriptor.getJavaClass())
            .stream().filter(f -> f.getName().equals(mapping.getAttributeName()))
            .findFirst().orElse(null);
    if (SoftDelete.class.isAssignableFrom(mapping.getReferenceClass()) && referenceField != null) {
        OneToOne oneToOne = referenceField.getAnnotation(OneToOne.class);
        if (oneToOne != null && !Strings.isNullOrEmpty(oneToOne.mappedBy())) {
            return new ExpressionBuilder().get("deleteTs").isNull();
        }
    }
    return null;
}
 
Example #8
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Cascade(CascadeType.ALL)
@OneToOne(fetch = FetchType.LAZY)
// disable foreign key, to be able to remove runtime data
@JoinColumn(name = "CLEAN_SCRIPT_ID", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
public ScriptData getCleanScript() {
    return cleanScript;
}
 
Example #9
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Cascade(org.hibernate.annotations.CascadeType.ALL)
@OneToOne(fetch = FetchType.LAZY)
// disable foreign key, to be able to remove runtime data
@JoinColumn(name = "ENV_SCRIPT_ID", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
public ScriptData getEnvScript() {
    return envScript;
}
 
Example #10
Source File: JpaUtils.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the mappedBy value from an attribute
 * @param attribute attribute
 * @return mappedBy value or null if none.
 */
public static String getMappedBy(Attribute<?, ?> attribute) {
	String mappedBy = null;
	
	if (attribute.isAssociation()) {
		Annotation[] annotations = null;
		Member member = attribute.getJavaMember();
		if (member instanceof Field) {
			annotations = ((Field) member).getAnnotations();
		}
		else if (member instanceof Method) {
			annotations = ((Method) member).getAnnotations();
		}
		
		for (Annotation a : annotations) {
			if (a.annotationType().equals(OneToMany.class)) {
				mappedBy = ((OneToMany) a).mappedBy();
				break;
			}
			else if (a.annotationType().equals(ManyToMany.class)) {
				mappedBy = ((ManyToMany) a).mappedBy();
				break;
			}
			else if (a.annotationType().equals(OneToOne.class)) {
				mappedBy = ((OneToOne) a).mappedBy();
				break;
			}
		}
	}
	
	return "".equals(mappedBy) ? null : mappedBy;
}
 
Example #11
Source File: JPAAnnotationsConfigurer.java    From oval with Eclipse Public License 2.0 5 votes vote down vote up
protected void addAssertValidCheckIfRequired(final Annotation constraintAnnotation, final Collection<Check> checks,
   @SuppressWarnings("unused") /*parameter for potential use by subclasses*/final AccessibleObject fieldOrMethod) {
   if (containsCheckOfType(checks, AssertValidCheck.class))
      return;

   if (constraintAnnotation instanceof OneToOne || constraintAnnotation instanceof OneToMany || constraintAnnotation instanceof ManyToOne
      || constraintAnnotation instanceof ManyToMany) {
      checks.add(new AssertValidCheck());
   }
}
 
Example #12
Source File: PersistentAttributesHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static CtClass getTargetEntityClass(CtClass managedCtClass, CtField persistentField) throws NotFoundException {
	// get targetEntity defined in the annotation
	try {
		OneToOne oto = PersistentAttributesHelper.getAnnotation( persistentField, OneToOne.class );
		OneToMany otm = PersistentAttributesHelper.getAnnotation( persistentField, OneToMany.class );
		ManyToOne mto = PersistentAttributesHelper.getAnnotation( persistentField, ManyToOne.class );
		ManyToMany mtm = PersistentAttributesHelper.getAnnotation( persistentField, ManyToMany.class );

		Class<?> targetClass = null;
		if ( oto != null ) {
			targetClass = oto.targetEntity();
		}
		if ( otm != null ) {
			targetClass = otm.targetEntity();
		}
		if ( mto != null ) {
			targetClass = mto.targetEntity();
		}
		if ( mtm != null ) {
			targetClass = mtm.targetEntity();
		}

		if ( targetClass != null && targetClass != void.class ) {
			return managedCtClass.getClassPool().get( targetClass.getName() );
		}
	}
	catch (NotFoundException ignore) {
	}

	// infer targetEntity from generic type signature
	String inferredTypeName = inferTypeName( managedCtClass, persistentField.getName() );
	return inferredTypeName == null ? null : managedCtClass.getClassPool().get( inferredTypeName );
}
 
Example #13
Source File: JpaResourceInformationProvider.java    From crnk-framework with Apache License 2.0 5 votes vote down vote up
@Override
protected RelationshipRepositoryBehavior getDefaultRelationshipRepositoryBehavior(BeanAttributeInformation attributeDesc) {
	Optional<OneToOne> oneToOne = attributeDesc.getAnnotation(OneToOne.class);
	Optional<OneToMany> oneToMany = attributeDesc.getAnnotation(OneToMany.class);
	Optional<ManyToOne> manyToOne = attributeDesc.getAnnotation(ManyToOne.class);
	Optional<ManyToMany> manyToMany = attributeDesc.getAnnotation(ManyToMany.class);
	if (oneToOne.isPresent() || manyToOne.isPresent() || oneToMany.isPresent() || manyToMany.isPresent()) {
		Optional<String> mappedBy = getMappedBy(attributeDesc);
		if (mappedBy.isPresent() && mappedBy.get().length() > 0) {
			return RelationshipRepositoryBehavior.FORWARD_OPPOSITE;
		}
		return RelationshipRepositoryBehavior.FORWARD_OWNER;
	}
	return RelationshipRepositoryBehavior.DEFAULT;
}
 
Example #14
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Cascade(CascadeType.ALL)
@OneToOne(fetch = FetchType.LAZY)
// disable foreign key, to be able to remove runtime data
@JoinColumn(name = "FLOW_SCRIPT_ID", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
public ScriptData getFlowScript() {
    return flowScript;
}
 
Example #15
Source File: ColumnsBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
	Ejb3JoinColumn[] joinColumns;
	JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
	if ( joinTableAnn != null ) {
		joinColumns = Ejb3JoinColumn.buildJoinColumns(
				joinTableAnn.inverseJoinColumns(),
				null,
				entityBinder.getSecondaryTables(),
				propertyHolder,
				inferredData.getPropertyName(),
				buildingContext
		);
		if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
			throw new AnnotationException(
					"JoinTable.name() on a @ToOne association has to be explicit: "
							+ BinderHelper.getPath( propertyHolder, inferredData )
			);
		}
	}
	else {
		OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
		String mappedBy = oneToOneAnn != null
				? oneToOneAnn.mappedBy()
				: null;
		joinColumns = Ejb3JoinColumn.buildJoinColumns(
				null,
				mappedBy,
				entityBinder.getSecondaryTables(),
				propertyHolder,
				inferredData.getPropertyName(),
				buildingContext
		);
	}
	return joinColumns;
}
 
Example #16
Source File: ToOneBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> getTargetEntityClass(XProperty property) {
	final ManyToOne mTo = property.getAnnotation( ManyToOne.class );
	if (mTo != null) {
		return mTo.targetEntity();
	}
	final OneToOne oTo = property.getAnnotation( OneToOne.class );
	if (oTo != null) {
		return oTo.targetEntity();
	}
	throw new AssertionFailure("Unexpected discovery of a targetEntity: " + property.getName() );
}
 
Example #17
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@OneToOne(fetch = FetchType.LAZY)
@OnDelete(action = OnDeleteAction.CASCADE)
public TaskData getIfBranch() {
    return ifBranch;
}
 
Example #18
Source File: Location.java    From metacat with Apache License 2.0 4 votes vote down vote up
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "location")
public Info getInfo() {
    return info;
}
 
Example #19
Source File: UserOnAndOffRegister.java    From OA with GNU General Public License v3.0 4 votes vote down vote up
@OneToOne
@JoinColumn(name="userId")
public Users getUserId() {
	return userId;
}
 
Example #20
Source File: Race.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.EAGER)  
@PrimaryKeyJoinColumn
public AgeGroups getAgeGroups() {
    return ageGroups;
}
 
Example #21
Source File: ResultMapParser.java    From mybatis-jpa with Apache License 2.0 4 votes vote down vote up
public List<ResultMapping> resolveResultMappings(String resource, String id, Class<?> type) {
  List<ResultMapping> resultMappings = new ArrayList<>();

  MapperBuilderAssistant assistant = new MapperBuilderAssistant(configuration, resource);

  List<Field> fields = PersistentUtil.getPersistentFields(type);

  for (Field field : fields) {
    // java field name
    String property = field.getName();
    // sql column name
    String column = PersistentUtil.getColumnName(field);
    Class<?> javaType = field.getType();

    //resultMap is not need jdbcType
    JdbcType jdbcType = null;

    String nestedSelect = null;
    String nestedResultMap = null;
    if (PersistentUtil.isAssociationField(field)) {
      // OneToOne or OneToMany

      // mappedBy
      column = PersistentUtil.getMappedName(field);
      if (field.isAnnotationPresent(OneToOne.class)) {
        nestedResultMap = id + "_association[" + javaType.getSimpleName() + "]";
        registerResultMap(resolveResultMap(resource, nestedResultMap, javaType));
      }
      if (field.isAnnotationPresent(OneToMany.class)) {
        Type genericType = field.getGenericType();
        if (genericType instanceof ParameterizedType) {
          ParameterizedType pt = (ParameterizedType) genericType;
          Class<?> actualType = (Class<?>) pt.getActualTypeArguments()[0];
          // create resultMap with actualType
          nestedResultMap = id + "collection[" + actualType.getSimpleName() + "]";
          registerResultMap(resolveResultMap(resource, nestedResultMap, actualType));
        }
      }
    }

    String notNullColumn = null;
    String columnPrefix = null;
    String resultSet = null;
    String foreignColumn = null;
    // if primaryKey,then flags.add(ResultFlag.ID);
    List<ResultFlag> flags = new ArrayList<>();
    if (field.isAnnotationPresent(Id.class)) {
      flags.add(ResultFlag.ID);
    }
    // lazy or eager
    boolean lazy = false;
    // typeHandler
    Class<? extends TypeHandler<?>> typeHandlerClass = ColumnMetaResolver
        .resolveTypeHandler(field);

    ResultMapping resultMapping = assistant.buildResultMapping(type, property, column,
        javaType, jdbcType, nestedSelect, nestedResultMap, notNullColumn, columnPrefix,
        typeHandlerClass, flags, resultSet, foreignColumn, lazy);
    resultMappings.add(resultMapping);
  }
  return resultMappings;

}
 
Example #22
Source File: AdmIntegrateTemplateAlias.java    From we-cmdb with Apache License 2.0 4 votes vote down vote up
@OneToOne(mappedBy = "childIntegrateTemplateAlias")
public AdmIntegrateTemplateRelation getParentIntegrateTemplateRelation() {
    return this.parentIntegrateTemplateRelation;
}
 
Example #23
Source File: JavaxPersistenceImpl.java    From ormlite-core with ISC License 4 votes vote down vote up
@Override
public DatabaseFieldConfig createFieldConfig(DatabaseType databaseType, Field field) {
	Column columnAnnotation = field.getAnnotation(Column.class);
	Basic basicAnnotation = field.getAnnotation(Basic.class);
	Id idAnnotation = field.getAnnotation(Id.class);
	GeneratedValue generatedValueAnnotation = field.getAnnotation(GeneratedValue.class);
	OneToOne oneToOneAnnotation = field.getAnnotation(OneToOne.class);
	ManyToOne manyToOneAnnotation = field.getAnnotation(ManyToOne.class);
	JoinColumn joinColumnAnnotation = field.getAnnotation(JoinColumn.class);
	Enumerated enumeratedAnnotation = field.getAnnotation(Enumerated.class);
	Version versionAnnotation = field.getAnnotation(Version.class);

	if (columnAnnotation == null && basicAnnotation == null && idAnnotation == null && oneToOneAnnotation == null
			&& manyToOneAnnotation == null && enumeratedAnnotation == null && versionAnnotation == null) {
		return null;
	}

	DatabaseFieldConfig config = new DatabaseFieldConfig();
	String fieldName = field.getName();
	if (databaseType.isEntityNamesMustBeUpCase()) {
		fieldName = databaseType.upCaseEntityName(fieldName);
	}
	config.setFieldName(fieldName);

	if (columnAnnotation != null) {
		if (stringNotEmpty(columnAnnotation.name())) {
			config.setColumnName(columnAnnotation.name());
		}
		if (stringNotEmpty(columnAnnotation.columnDefinition())) {
			config.setColumnDefinition(columnAnnotation.columnDefinition());
		}
		config.setWidth(columnAnnotation.length());
		config.setCanBeNull(columnAnnotation.nullable());
		config.setUnique(columnAnnotation.unique());
	}
	if (basicAnnotation != null) {
		config.setCanBeNull(basicAnnotation.optional());
	}
	if (idAnnotation != null) {
		if (generatedValueAnnotation == null) {
			config.setId(true);
		} else {
			// generatedValue only works if it is also an id according to {@link GeneratedValue)
			config.setGeneratedId(true);
		}
	}
	if (oneToOneAnnotation != null || manyToOneAnnotation != null) {
		// if we have a collection then make it a foreign collection
		if (Collection.class.isAssignableFrom(field.getType())
				|| ForeignCollection.class.isAssignableFrom(field.getType())) {
			config.setForeignCollection(true);
			if (joinColumnAnnotation != null && stringNotEmpty(joinColumnAnnotation.name())) {
				config.setForeignCollectionColumnName(joinColumnAnnotation.name());
			}
			if (manyToOneAnnotation != null) {
				FetchType fetchType = manyToOneAnnotation.fetch();
				if (fetchType != null && fetchType == FetchType.EAGER) {
					config.setForeignCollectionEager(true);
				}
			}
		} else {
			// otherwise it is a foreign field
			config.setForeign(true);
			if (joinColumnAnnotation != null) {
				if (stringNotEmpty(joinColumnAnnotation.name())) {
					config.setColumnName(joinColumnAnnotation.name());
				}
				config.setCanBeNull(joinColumnAnnotation.nullable());
				config.setUnique(joinColumnAnnotation.unique());
			}
		}
	}
	if (enumeratedAnnotation != null) {
		EnumType enumType = enumeratedAnnotation.value();
		if (enumType != null && enumType == EnumType.STRING) {
			config.setDataType(DataType.ENUM_STRING);
		} else {
			config.setDataType(DataType.ENUM_INTEGER);
		}
	}
	if (versionAnnotation != null) {
		// just the presence of the version...
		config.setVersion(true);
	}
	if (config.getDataPersister() == null) {
		config.setDataPersister(DataPersisterManager.lookupForField(field));
	}
	config.setUseGetSet(DatabaseFieldConfig.findGetMethod(field, databaseType, false) != null
			&& DatabaseFieldConfig.findSetMethod(field, databaseType, false) != null);
	return config;
}
 
Example #24
Source File: RaceAwards.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@OneToOne(mappedBy = "awards")
@MapsId
@JoinColumn(name="race_id")  
public Race getRace() {
    return race;
}
 
Example #25
Source File: WeixinPhotoAlbumEntity.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@OneToOne(fetch=FetchType.LAZY)  
@JoinColumn(name="PHOTO_ID")  
public WeixinPhotoEntity getPhoto() {
	return photo;
}
 
Example #26
Source File: JPAAnnotationsConfigurer.java    From oval with Eclipse Public License 2.0 4 votes vote down vote up
protected void initializeChecks(final OneToOne annotation, final Collection<Check> checks) {
   if (!annotation.optional() && !containsCheckOfType(checks, NotNullCheck.class)) {
      checks.add(new NotNullCheck());
   }
}
 
Example #27
Source File: Location.java    From metacat with Apache License 2.0 4 votes vote down vote up
@OneToOne
@JoinColumn(name = "table_id", nullable = false)
public Table getTable() {
    return table;
}
 
Example #28
Source File: Location.java    From metacat with Apache License 2.0 4 votes vote down vote up
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "location")
public Schema getSchema() {
    return schema;
}
 
Example #29
Source File: Tblstudents.java    From Spring-MVC-Blueprints with MIT License 4 votes vote down vote up
@OneToOne(fetch = FetchType.LAZY, mappedBy = "tblstudents")
public Tblgpa getTblgpa() {
	return this.tblgpa;
}
 
Example #30
Source File: Info.java    From metacat with Apache License 2.0 4 votes vote down vote up
@OneToOne
@JoinColumn(name = "location_id", nullable = false)
public Location getLocation() {
    return location;
}