---
lang: en
title: 'API docs: repository.defaultcrudrepository.ensurepersistable'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.defaultcrudrepository.ensurepersistable.html
---

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

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [DefaultCrudRepository](./repository.defaultcrudrepository.md) &gt; [ensurePersistable](./repository.defaultcrudrepository.ensurepersistable.md)

## DefaultCrudRepository.ensurePersistable() method

Converts an entity object to a JSON object to check if it contains navigational property. Throws an error if `entity` contains navigational property.

<b>Signature:</b>

```typescript
protected ensurePersistable<R extends T>(entity: R | DataObject<R>, options?: {}): legacy.ModelData<legacy.PersistedModel>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  entity | R \| [DataObject](./repository.dataobject.md)<!-- -->&lt;R&gt; | The entity passed from CRUD operations' caller. |
|  options | {} |  |

<b>Returns:</b>

legacy.ModelData&lt;legacy.PersistedModel&gt;


