This is a very strange problem. I'll add some technical info to this discussion in case it helps.
The "pd_templates" table stores potentially multiple html templates for displaying the *summary* of a configured instance of a policy. It can store multiple templates by language - this is basically an i18n feature. In practice, we only really have English language versions, so there should only be one row in that table for each row in the "policydefs" table. The "policydefs" table should have one row per policy definition (basically one row for each item in the Policy Type drop-down when adding a new policy to an API).
The ORM class for the pd_templates table is here:
And the policy definition ORM bean is here:
This sounds like hibernate making a mess of things (or more likely my mis-understanding of something hibernate is doing). It's one of the reasons I'm on the fence about ORM technologies in general. They can be so helpful, but if you wrote your own SQL statements you'd never have a weird issue like this.
In any case, at this point I have no theory about how this could be happening.
I assume your "policydefs" table is sensible. So the question is why hibernate would be duplicating the data in "pd_templates", especially when doing a simple GET of the information (shouldn't be mutating anything!).
Could try enabling SQL logging in hibernate to see what's going on.
But of course trying to replicate the problem locally is always the best approach. :)
-Eric