gavinklfong / stream-api-exercises Goto Github PK
View Code? Open in Web Editor NEWJava Stream API Exercises
Java Stream API Exercises
A suggestion to improve the readme.md perhaps; clarify that this project requires a Lombok plugin in your IDE if you want to work with the sources directly.
Otherwise this could confuse users: https://stackoverflow.com/questions/72131339/eclipse-maven-build-succeeds-but-project-still-reports-compilation-errors
You could link to https://projectlombok.org/setup/overview for example.
Hi,
Thank you for your exercises. It's really a great source to learn functional programming and streams. However, I found a small bug and would be happy if you could fix it.
When I tried to run the given SQL scripts, it gave the error "Unknown column 'order_date' in the field list". Probably because in your class Order, you didn't give a column name (@column (name="order_date")) so Hibernate generates orderDate in the database. Maybe you can change it to orderDate. Similar things with delivery_date => deliveryDate.
Hi I have cloned the project directly and created an REST endpoint each to fetch the products and orders using the findAll()
method. When I try to invoke the endpoint using Postman, to see the data output, I am getting the below error:
Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: org.hibernate.collection.internal.PersistentSet[0]->space.gavinklfong.demo.streamapi.models.Product["orders"]->org.hibernate.collection.internal.PersistentSet[0]->space.gavinklfong.demo.streamapi.models.Order["products"]....
Looks like the infinite json issue is caused due the mapping between the product and order entity.
Hi, When I try to run project from terminal with comment mvn clean spring-boot:run
I got this exception. I searched on the net but could not work anything, do you have this problem too ?
o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': 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]
I've been facing this error while building the application , especially when application context load before unit test case runs.
i can resolve this by disabling autoconfiguration, but i want to understand , what is going wrong here.
java.lang.IllegalStateException: Failed to load ApplicationContext for [MergedContextConfiguration@76544c0a testClass = com.example.streams.StreamsApplicationTests, locations = [], classes = [com.example.streams.StreamsApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper=true"], contextCustomizers = [[ImportsContextCustomizer@428bdd72 key = [org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration, org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManagerAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@58326051, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@764faa6, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@7fb95505, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@9da1, org.springframework.boot.test.autoconfigure.filter.TypeExcludeFiltersContextCustomizer@351584c0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@685443d9, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@6eb2384f, org.springframework.boot.test.context.SpringBootTestAnnotation@3a8f6c54], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Failed to execute SQL script statement #1 of file [C:\Users\a\Documents\projects\practice\Streams\target\classes\data.sql]: INSERT INTO customer (id, name, tier) VALUES (1, 'Stefan Walker', 1) Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of file [C:\Users\a\Documents\projects\practice\Streams\target\classes\data.sql]: INSERT INTO customer (id, name, tier) VALUES (1, 'Stefan Walker', 1) Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "CUSTOMER" not found (this database is empty); SQL statement: INSERT INTO customer (id, name, tier) VALUES (1, 'Stefan Walker', 1) [42104-214]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.