code: @Override
     public void newOneToOneRelationship(Project project, final JavaResource resource, final String fieldName,
              final String fieldType,
              final String inverseFieldName,
              final FetchType fetchType, final boolean required,
              final Iterable<CascadeType> cascadeTypes) throws FileNotFoundException
     {
        JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
        JavaClassSource entityClass = getJavaClassFrom(resource);
        JavaClassSource fieldEntityClass;
        if (areTypesSame(fieldType, entityClass.getCanonicalName()))
        {
           fieldEntityClass = entityClass;
        }
        else
        {
           fieldEntityClass = findEntity(project, fieldType);
           entityClass.addImport(fieldEntityClass);
        }
  
        FieldSource<JavaClassSource> localField = addFieldTo(entityClass, fieldEntityClass.getName(), fieldName,
                 OneToOne.class.getName());
        AnnotationSource<JavaClassSource> annotation = localField.getAnnotation(OneToOne.class);
        if ((inverseFieldName != null) && !inverseFieldName.isEmpty())
        {
           FieldSource<JavaClassSource> inverseField = addFieldTo(fieldEntityClass, entityClass.getName(),
                    inverseFieldName,
                    OneToOne.class.getName());
           inverseField.getAnnotation(OneToOne.class).setStringValue("mappedBy", localField.getName());
           java.saveJavaSource(fieldEntityClass);
        }
  
        if (fetchType != null && fetchType != FetchType.EAGER)
        {
           annotation.setEnumValue("fetch", fetchType);
        }
        if (required)
        {
           // Set the optional attribute of @OneToOne/@ManyToOne only when false, since the default value is true
           annotation.setLiteralValue("optional", "false");
        }
        addCascade(cascadeTypes, annotation);
        java.saveJavaSource(entityClass);
     }
docs: Creates a One-to-One relationship
  
  @param project
  @param resource
  @param fieldName
  @param fieldType
  @param inverseFieldName
  @param fetchType
  @param required
  @param cascadeTypes
  @throws FileNotFoundException