Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Hibernate creates db table with Varchar(255), how to increase to Varchar(1000)?

I want to increase the 255 to 1000 when the table is automatically created by Java Hibernate, but how to do this?

Part of the code that might need changes for it:

@Entity
public class Work implements Serializable {

    @Id
    @GeneratedValue

    private long workNumber;
    private int fromYear;
    private int tillYear;
    private String name;
    private String profession;
    private String description;

    @ManyToOne
    private User user;

    public Work() {
    }

    public Work(long workNumber, int fromYear, int tillYear, String name, String profession, String description) {
        this.setWorkNumber(workNumber);
        this.setFromYear(fromYear);
        this.setTillYear(tillYear);
        this.setName(name);
        this.setProfession(profession);
        this.setDescription(description);
    }
like image 234
MOTIVECODEX Avatar asked Oct 17 '25 01:10

MOTIVECODEX


1 Answers

Why not trying simply

@Column(columnDefinition="varchar(1000)")?

like image 86
Andrei Nicusan Avatar answered Oct 19 '25 15:10

Andrei Nicusan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!