0

I'm moving application from windows to ubuntu server. One of the class which should be mapped to auto created table (by Hibernate), is created as table without problem on Windows MySQL but is not created on Ubuntu MySQL. All other classes are created as tables without problem.

In logs of application start on tomcat I have no errors- every thing is for hibernate made nice. Also a foreign key in other table is created.

The only thing which does not exists in other entities is '@Column(length= 40000)' but it seems not be possible to crash because of this annotation..

I have tried to remove other tables- they are auto recreated without problems..

There is code of my entity class:

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class ConsultationHrm {

    @Id
    @GeneratedValue
    private Long id;

    @Column(length= 40000)
    private String hrmMeasurements;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getHrmMeasurements() {
        return hrmMeasurements;
    }

    public void setHrmMeasurements(String hrmMeasurements) {
        this.hrmMeasurements = hrmMeasurements;
    }

}

Have you any idea, where can I try to find a source of problem?

EDIT:

I have removed a @Column annotation and deployed on server- table was created successfully. When I have removed a table and gave back class with @Column annottation, table is again not created...

Any idea how to deal with it now? ..default size is not enough for me here :-(

Mysql versions on windows and ubuntu:

5.7.16-0ubuntu0.16.04.1

5.7.11-log

Krystian
  • 2,221
  • 1
  • 26
  • 41

1 Answers1

0

Seems like problem is in MySQL database.

In my windows version, there is no problem to change column to VARCHAR(40000). In my version on ubuntu I can not change it in the same way.

Some solution is to use:

@Column(columnDefinition = "TEXT")
private String hrmMeasurements;

which according to ansewer for this question Maximum length for MySQL type text gives us ~65 k chars.

Community
  • 1
  • 1
Krystian
  • 2,221
  • 1
  • 26
  • 41