jemaja / weekmenu Goto Github PK
View Code? Open in Web Editor NEWA Spring Boot application to manage and create the weekly menu at home
License: MIT License
A Spring Boot application to manage and create the weekly menu at home
License: MIT License
For a single day, the date, recipe and options button are shown on different lines, where this should fit on a single line.
Currently, each time the page is loaded, the system will connect to the DB and try to insert each DayRecipe, this is unneeded overhead and could be done in a smarter way
2022-12-11 13:02:34.887 ERROR 39604 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.22.jar!/:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.22.jar!/:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.22.jar!/:5.3.22]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.2.jar!/:2.7.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.2.jar!/:2.7.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.2.jar!/:2.7.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.2.jar!/:2.7.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.2.jar!/:2.7.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.2.jar!/:2.7.2]
at nl.jemaja.weekmenu.WeekmenuApplication.main(WeekmenuApplication.java:13) ~[classes!/:1.0.2-BETA]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[weekmenu-1.0.2-BETA.jar:1.0.2-BETA]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[weekmenu-1.0.2-BETA.jar:1.0.2-BETA]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[weekmenu-1.0.2-BETA.jar:1.0.2-BETA]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[weekmenu-1.0.2-BETA.jar:1.0.2-BETA]
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:173) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.22.jar!/:5.3.22]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.22.jar!/:5.3.22]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.22.jar!/:5.3.22]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.22.jar!/:5.3.22]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.22.jar!/:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.22.jar!/:5.3.22]
... 24 common frames omitted
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:138) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]
... 41 common frames omitted
If on a workday, no recipe for workdays is found, it will not continue planning the next day. The planning just stops.
It should try to plan the next they, since this could be a saturday!
The DayRecipe class holds the recipe which is planned for a given date + status information.
there is a number of actions which Updates the DayRecipe records, and should return the updated version. However they return the version from before the update.
Hence it seems something with transactions or commits is going wrong.
Example1:
When the root URL is opened for a date range, which is new/ not loaded before, the controller will initiate the DayRecipe Records.
These will have recipe NULL.
Next the controller method will call the fuction to schedule dinners. This will ensure Recipe != null and status =1
After this action, the controller will find the DayRecipe's and pass them to the model for the frontend.
However, what is passed is recipe NULL, so the inital version.
After a refresh, the creation and planning steps will be skipped, and now it returns the correct recipe.
Example 2:
If a DayRecipe has status = 1 and Recipe != null.
The suggested recipe can be accepted (status =2) by an API PUT call to:
localhost:8080/api/v1/dayrecipe/accept/{ID}
(In class) DayRecipeRestControllerV1
This will update the status to 2, and return the record.
But here again, it returns the Pre-updated record instead of the actual record.
If a recipe was planned and a user chooses a different recipe. It does not update the last eaten date for the recipe being removed.
In PlannerService.longestPlanDay()
allow Map to be passed as a parameter, and also return the map.
Currently, if we plan for multiple days in a row, it will query the DB for each day x each recipe to find the last eaten date.
While actually only the recipe used the day before is changed.
New approach:
-Pass the Map as input
-If the map is empty, query DB for all recipes last eaten
-If the map is not empty, assume it is correct and use it to plan. (sort it by key)
-After planning, update the key of the recipe used in the map
-Take into account new recipes. All new recipes will get date 1-1-1970, however only 1 is stored. So we always need to query for new recipes which are not yet in the map, and add them
Re-use the page for new recipes.
InfoDto block should be handled generically and closable
The main page requires functionality to select a date range for which the DayRecipe's are shown
The controller already supports a from date (String f) and to date (String t) as get parameters.
However does not handle them yet.
To do:
For example, in the period / main screen selected next week in the date range picker.
Correctly shows this range.
Now if we set another recipe for a day, when the page is redirected, it should redirect to the same date range, however it does not, it returns to default.
If you currently are in a custom date range, and you use the choose other recipe function. The page reloads to the standard range (next 14 days)
it should reload to the previous custom range.
Probably something in period.js not passing the parameters?
When no recipe is found in the main page.
A stack trace is logged in the console.
This is not needed. Just logging to Debug and Warning is sufficient
When you use the option: Choose Other Recipe in the period screen.
On the first time another recipe is selected, an error 404 is trown.
URL looks like:
localhost:8080/;jsessionid=EB21CC0A9257CF5BA5C225D7026F8F97
second time error does not occur
And add /API/v1/ to base url
Not possible yet to modify this flag, but it is needed for planning.
Currently default set to true.
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.