I am using Springboot 2.7.2
with Hibernate
and Mysql 8
. Is there a way to make an Entity
class so as to execute a create table Query like this.
CREATE TABLE `settings` (
`SettingsId` enum('1') NOT NULL,
................,
................,
PRIMARY KEY (`SettingsId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CodePudding user response:
Did you try this?
- add @EnableAutoConfiguration
- add application.properties. like below :
- spring.jpa.hibernate.ddl-auto=create
- spring.jpa.generate-ddl=true
CodePudding user response:
I have got the answer from here and made the Entity Class like this
@Entity
public class Settings {
public enum SettingsId {
}
@Id
@Enumerated(EnumType.STRING)
@Column(columnDefinition = "ENUM('1')")
private SettingsId settingsId;
........;
........;
}