Generation of Persistence Mapping Defaults



I am using IDEA Ultimate 14.0.2 and using Hibernate on a Dropwizard project with maven.

I have generated the ORMs and after compiling, the following error occurs:

INFO  [2014-12-16 08:41:03,042] org.hibernate.dialect.Dialect: HHH000400: Using
dialect: org.hibernate.dialect.MySQLDialect
ERROR [2014-12-16 08:41:03,154] xx.yy.zz.test.modules.module: org.h
ibernate.MappingException: Repeated column in mapping for entity: xx.yy.zz.test.models.TestTable column: content_type_id (should be mapped wit
h insert="false" update="false")

Where the database schema generation have created the following:

package xx.yy.zz.test.models;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Timestamp;

@javax.persistence.Table(name = "tbl_test", schema = "", catalog = "testdb")
public class TestTable {
    private int id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true)
    public int getId() {
        return id;

    public void setId(int id) { = id;

    private String name;

    @javax.persistence.Column(name = "name", nullable = false, insertable = true, updatable = true, length = 120)
    public String getName() {
        return name;

    public void setName(String name) { = name;

    private Timestamp created;

    @javax.persistence.Column(name = "created", nullable = false, insertable = true, updatable = true)
    public Timestamp getCreated() {
        return created;

    public void setCreated(Timestamp created) {
        this.created = created;

    private Timestamp updated;

    @javax.persistence.Column(name = "updated", nullable = false, insertable = true, updatable = true)
    public Timestamp getUpdated() {
        return updated;

    public void setUpdated(Timestamp updated) {
        this.updated = updated;

    private Integer createdById;

    @javax.persistence.Column(name = "created_by_id", nullable = true, insertable = true, updatable = true)
    public Integer getCreatedById() {
        return createdById;

    public void setCreatedById(Integer createdById) {
        this.createdById = createdById;

    private int contentTypeId;

    @Column(name = "content_type_id", nullable = false, insertable = true, updatable = true)
    public int getContentTypeId() {
        return contentTypeId;

    public void setContentTypeId(int contentTypeId) {
        this.contentTypeId = contentTypeId;

    private ContentType ContentTypeByContentTypeId;

    @JoinColumn(name = "content_type_id", referencedColumnName = "id", nullable = false)
    public ContentType getContentTypeByContentTypeId() {
        return ContentTypeByContentTypeId;

    public void setContentTypeByContentTypeId(ContentType ContentTypeByContentTypeId) {
        this.ContentTypeByContentTypeId = ContentTypeByContentTypeId;


where the RED part is the default generated value.

the problem is, I have hundreds of similar table with similar problem, how do I change the default to insertable = false, updatable = false during the OR generation? or better yet, is there any reason at all that column is being generated despite having the ContentType? How do I efficiently resolve this matter?

your kind response is very much appreciated.

Comment actions Permalink

Any update on this?

Comment actions Permalink

I have the same issue.

Any update?

Comment actions Permalink

This seems like a bug in the code generation tool itself -- I still see the same issue in version "IntelliJ IDEA 2017.3.4 (Ultimate Edition) Build #IU-173.4548.28, built on January 29, 2018".

It's fairly easy to fix manually in the class, but of course making manual edits to auto-generated classes is not a good solution.

Comment actions Permalink

Hi, we have a ticket for this problem, please upvote:


Please sign in to leave a comment.