Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Generation of Persistence Mapping Defaults

$
0
0

Hi,

 

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;

 

@Entity

@javax.persistence.Table(name = "tbl_test", schema = "", catalog = "testdb")

public class TestTable {

    private int id;

 

    @Id

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true)

    public int getId() {

        return id;

    }

 

    public void setId(int id) {

        this.id = id;

    }

 

    private String name;

 

    @Basic

    @javax.persistence.Column(name = "name", nullable = false, insertable = true, updatable = true, length = 120)

    public String getName() {

        return name;

    }

 

    public void setName(String name) {

        this.name = name;

    }

 

    private Timestamp created;

 

    @Basic

    @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;

 

    @Basic

    @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;

 

    @Basic

    @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;

 

    @Basic

    @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;

 

    @ManyToOne

    @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.


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>