# HABTM with short length keys

**URL:** https://discourse.cakephp.org/t/habtm-with-short-length-keys/1324
**Category:** Need Help
**Created:** [October 14, 2016, 5:48am UTC](https://discourse.cakephp.org/t/habtm-with-short-length-keys/1324 "2016-10-14T05:48:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![classoutfit](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/classoutfit/32/410_2.png) [@classoutfit](https://discourse.cakephp.org/u/classoutfit)
#### Post date: [October 14, 2016, 5:48am UTC](https://discourse.cakephp.org/t/habtm-with-short-length-keys/1324/1 "2016-10-14T05:48:26Z")

</div>

CakePHP v 2.9.1. I have two tables that are joined with a HABTM relationship. The id field of one table is CHAR(1), the other is CHAR(3). This is quite acceptable, I believe. Saving HABTM data is failing because line 2040 of Model.php checks: if string and length = 36 or 16 - then save, else don’t save. By the time it’s got here any existing HABTM relationships have been deleted. Interested to know why this restriction is there, and more importantly how I can work around this (without remodelling my data structure or creating a through model).
