how do i create table in mysql cluster using hibernate

Viewed 477

I am using the hibernate with spring boot and table created in given database but not in another database like 10.10.1.350 is management node and 10.10.1.348 and 10.10.1.349 are child db. when we create table using query directly in 348 then table auto created in 349. But we are using the hibernate then table created in 348 but not auto create in 349.

Properties like:-

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://10.10.1.348:3306/test
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=abc@1234
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect 

Pojo Class-

@Entity
@Table(name = "test")
@Getter
@Setter
public class Test {

    @Id
    @Column(name = "tst_id")
    private Long tstId;
    @Column(name = "tst_nm")
    private String tstNm;


}

pom.xml for mysql dependency-

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>

        </dependency>
1 Answers
Related