---
lang: en
title: 'API docs: sequelize.sequelizecrudrepository.createhasonerepositoryfactoryfor'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/extensions/sequelize
permalink: /doc/en/lb4/apidocs.sequelize.sequelizecrudrepository.createhasonerepositoryfactoryfor.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/sequelize](./sequelize.md) &gt; [SequelizeCrudRepository](./sequelize.sequelizecrudrepository.md) &gt; [createHasOneRepositoryFactoryFor](./sequelize.sequelizecrudrepository.createhasonerepositoryfactoryfor.md)

## SequelizeCrudRepository.createHasOneRepositoryFactoryFor() method

Function to create a constrained hasOne relation repository factory

**Signature:**

```typescript
protected createHasOneRepositoryFactoryFor<Target extends Entity, TargetID, ForeignKeyType>(relationName: string, targetRepositoryGetter: Getter<EntityCrudRepository<Target, TargetID>> | {
        [repoType: string]: Getter<EntityCrudRepository<Target, TargetID>>;
    }): HasOneRepositoryFactory<Target, ForeignKeyType>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

relationName


</td><td>

string


</td><td>

Name of the relation defined on the source model


</td></tr>
<tr><td>

targetRepositoryGetter


</td><td>

Getter&lt;EntityCrudRepository&lt;Target, TargetID&gt;&gt; \| { \[repoType: string\]: Getter&lt;EntityCrudRepository&lt;Target, TargetID&gt;&gt;; }


</td><td>


</td></tr>
</tbody></table>
**Returns:**

HasOneRepositoryFactory&lt;Target, ForeignKeyType&gt;


