spring-projects / spring-statemachine

Spring Statemachine is a framework for application developers to use state machine concepts with Spring.
1.51k stars 598 forks source link

Spring state machine JPA auto-configuration DB Schema creation #1071

Open parthgupta0912 opened 1 year ago

parthgupta0912 commented 1 year ago

I would like my state machine db schema to be automatically created. I have add the Spring state machine JPA auto-configuration as a dependency and added the @EnableAutoConfiguration annotation as well. The JPA repositories have been enabled and even the entity scan is happening on the correct package. Ideally this should enable all the default repositories and entities used for persisting states, transitions etc.

These properties have also been set in application.properties.

spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto = create spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect

However, the tables are not getting created when I start my application.

If it is not possible to create these tables on auto configuration, can someone help me with the sql scripts. I could not find these schemas in the documentation.

Thanks!

mammadyahyayev commented 1 month ago

@parthgupta0912 have you tried adding following dependency?

<!-- https://mvnrepository.com/artifact/org.springframework.statemachine/spring-statemachine-data-jpa -->
<dependency>
    <groupId>org.springframework.statemachine</groupId>
    <artifactId>spring-statemachine-data-jpa</artifactId>
    <version>4.0.0</version>
</dependency>