Web application running on both Oracle and MySQL

117 views Asked by At

I have a web application that works on both Oracle and MySQL Databases, my problem is that I want to create a column in the database that has a LONGTEXT type in MySQL and CLOB in Oracle, how can I achieve that using Hibernate? Here is my code:

@Column(name = "BigText" , nullable = false)
public String getBigText() {
    return bigText;
}

I tried using: columnDefinition="LONGTEXT", it is working under MySQL but not Oracle. What else can I do?

1

There are 1 answers

6
m suresh On

see the below link

defference between oracle and mysql datatype

if(databasename.equals("oracle"){ use here entity for oracle datatype used }else if(databasename.equals("mysql"){ use here entity for mysqldatatype used }