Giter Club home page Giter Club logo

spring-boot-jpa-course's Introduction

spring-boot-jpa-course's People

Contributors

rameshmf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spring-boot-jpa-course's Issues

Is it possible to use h2 embedded database ?

How is it possible to use h2 instead of MySql?

I have tried setting the dependency in pom.xml and set the according values on application.properties

spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

and I receive the following error

2023-01-02 18:30:14.658  WARN 3576 --- [  restartedMain] o.h.t.s.i.ExceptionHandlerLoggedImpl     : GenerationTarget encountered exception accepting command : Error executing DDL "create table ecommerce.products (id bigint not null, active boolean not null, date_created timestamp, description varchar(255), image_url varchar(255), last_updated timestamp, name varchar(255) not null, price decimal(19,2), stock_keeping_unit varchar(255) not null, category_id bigint, primary key (id))" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table ecommerce.products (id bigint not null, active boolean not null, date_created timestamp, description varchar(255), image_url varchar(255), last_updated timestamp, name varchar(255) not null, price decimal(19,2), stock_keeping_unit varchar(255) not null, category_id bigint, primary key (id))" via JDBC Statement

It seems that the schema is the problem.

At the file Product.java removing the schema = "ecommerce", gives the following error

2023-01-02 18:33:57.667  INFO 20728 --- [  restartedMain] c.s.s.SpringDataJpaCourseApplication     : Started SpringDataJpaCourseApplication in 2.933 seconds (JVM running for 3.358)
2023-01-02 18:33:57.674  INFO 20728 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2023-01-02 18:33:57.681 ERROR 20728 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Error thrown while acquiring connection from data source

org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-200]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:622) ~[h2-1.4.200.jar:1.4.200]

This is as far as I could go

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.