Spring Integration : error while inseting records in database with jdbc outbound gateway - mysql

I'm trying to insert data in the mysql database with jdbc outbound gateway but getting this error
nested exception is java.sql.SQLException: Invalid argument value:
java.io.NotSerializableException
App-config.xml is
<int-jdbc:inbound-channel-adapter
id="jdbcExtractor"
data-source="dataSource"
query="select * from Persons"
row-mapper="personRowMapeer"
channel="dataChannel">
<int:poller
fixed-delay="10000">
</int:poller>
</int-jdbc:inbound-channel-adapter>
<int:service-activator id="beanParser" input-channel="dataChannel" output-channel="JdbcChannel" ref="extractData" method="extractJdbcData" ></int:service-activator>
<int:channel id="JdbcChannel"></int:channel>
<int:channel id="testReply"></int:channel>
<int-jdbc:outbound-gateway
request-channel="JdbcChannel"
reply-channel="testReply"
request-sql-parameter-source-factory="requestSource"
reply-sql-parameter-source-factory="replySource"
data-source="dataSource"
update="insert into Persons (PersonID,LastName,FirstName,Address,City) values (:PersonID, :LastName, :FirstName, :Address, :City)"
query="select * from Persons where PersonID = :PersonID"
id="outboundInsert" >
</int-jdbc:outbound-gateway>
<bean id="personRowMapeer" class="com.example.SpringIntegrationDemo.test.PersonRowMapper"></bean>
<bean name="extractData" class="com.example.SpringIntegrationDemo.test.ExtractData"></bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/demo" />
<property name="username" value="*****" />
<property name="password" value="*****" />
</bean>
<bean id="requestSource" class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory">
<property name="parameterExpressions">
<map>
<entry key="PersonID" value="payload.personId"/>
<entry key="LastName" value="payload.lastName"/>
<entry key="FirstName" value="payload.firstName"/>
<entry key="Address" value="payload.address" />
<entry key="City" value="payload.city" />
</map>
</property>
</bean>
<bean id="replySource" class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory">
<property name="parameterExpressions">
<map>
<entry key="PersonID" value="payload.personId"/>
</map>
</property>
</bean>
Extractor Class :
public class ExtractData implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6405067378057426543L;
public PersonVo extractJdbcData(List<PersonVo> personVos) {
System.out.println("Printing the result set "+personVos.size());
return personVos.get(3);
}
}
I have added Serializable part later in the code.
RowMapper is already in place.
below is the full stack trace
2018-08-20 22:43:04.032 INFO 9086 --- [ main] c.e.S.SpringIntegrationDemoApplication : Starting SpringIntegrationDemoApplication on pratik-HP-Pavilion-g6-Notebook-PC with PID 9086 (/home/pratik/Documents/workspace-sts-3.9.5.RELEASE/SpringIntegrationDemo/target/classes started by pratik in /home/pratik/Documents/workspace-sts-3.9.5.RELEASE/SpringIntegrationDemo)
2018-08-20 22:43:04.036 INFO 9086 --- [ main] c.e.S.SpringIntegrationDemoApplication : No active profile set, falling back to default profiles: default
2018-08-20 22:43:04.097 INFO 9086 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#143640d5: startup date [Mon Aug 20 22:43:04 IST 2018]; root of context hierarchy
2018-08-20 22:43:04.424 INFO 9086 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from URL [file:/home/pratik/Documents/workspace-sts-3.9.5.RELEASE/SpringIntegrationDemo/target/classes/app-config.xml]
2018-08-20 22:43:04.704 INFO 9086 --- [ main] o.s.i.config.IntegrationRegistrar : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2018-08-20 22:43:05.201 INFO 9086 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2018-08-20 22:43:05.203 INFO 9086 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2018-08-20 22:43:05.454 INFO 9086 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$978e7c27] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-08-20 22:43:05.559 INFO 9086 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$2803756] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-08-20 22:43:05.794 INFO 9086 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
2018-08-20 22:43:05.888 INFO 9086 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: com.mysql.jdbc.Driver
2018-08-20 22:43:06.659 INFO 9086 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-08-20 22:43:06.671 INFO 9086 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {service-activator:beanParser} as a subscriber to the 'dataChannel' channel
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.integration.channel.DirectChannel : Channel 'application.dataChannel' has 1 subscriber(s).
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started beanParser
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {jdbc:outbound-gateway:outboundInsert} as a subscriber to the 'JdbcChannel' channel
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.integration.channel.DirectChannel : Channel 'application.JdbcChannel' has 1 subscriber(s).
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started outboundInsert
2018-08-20 22:43:06.672 INFO 9086 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2018-08-20 22:43:06.673 INFO 9086 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'application.errorChannel' has 1 subscriber(s).
2018-08-20 22:43:06.673 INFO 9086 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
2018-08-20 22:43:06.673 INFO 9086 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 1073741823
2018-08-20 22:43:06.676 INFO 9086 --- [ main] o.s.i.e.SourcePollingChannelAdapter : started jdbcExtractor
2018-08-20 22:43:06.691 INFO 9086 --- [ main] c.e.S.SpringIntegrationDemoApplication : Started SpringIntegrationDemoApplication in 2.993 seconds (JVM running for 3.91)
Printing the result set 8
2018-08-20 22:43:06.755 INFO 9086 --- [ask-scheduler-1] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2018-08-20 22:43:06.830 ERROR 9086 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jdbc.JdbcOutboundGateway#0]; nested exception is org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [insert into Persons (PersonID,LastName,FirstName,Address,City) values (?, ?, ?, ?, ?)Invalid argument value: java.io.NotSerializableException; nested exception is java.sql.SQLException: Invalid argument value: java.io.NotSerializableException, failedMessage=GenericMessage [payload=com.example.SpringIntegrationDemo.vo.PersonVo#158c1a9d, headers={id=3be9637d-1c7a-fb51-e416-438fd8ab9e41, timestamp=1534785186707}]
at org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:184)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:175)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:426)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:336)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:227)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:227)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:290)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.lambda$run$0(AbstractPollingEndpoint.java:391)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:385)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [insert into Persons (PersonID,LastName,FirstName,Address,City) values (?, ?, ?, ?, ?)Invalid argument value: java.io.NotSerializableException; nested exception is java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:110)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1402)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:620)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:850)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:871)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:317)
at org.springframework.integration.jdbc.JdbcMessageHandler.executeUpdateQuery(JdbcMessageHandler.java:198)
at org.springframework.integration.jdbc.JdbcOutboundGateway.handleRequestMessage(JdbcOutboundGateway.java:136)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158)
... 41 more
Caused by: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.PreparedStatement.setSerializableObject(PreparedStatement.java:4414)
at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:4085)
at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:411)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:232)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:147)
at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.setValues(PreparedStatementCreatorFactory.java:278)
at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:236)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
... 48 more
Caused by: java.io.NotSerializableException: java.lang.Object
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at com.mysql.jdbc.PreparedStatement.setSerializableObject(PreparedStatement.java:4403)
... 55 more
Is there something am I doing incorrectly ?

The problem not with the whole ExtractData or even its PersonVo. There is something wrong with your parameters for the INSERT:
<entry key="PersonID" value="payload.personId"/>
<entry key="LastName" value="payload.lastName"/>
<entry key="FirstName" value="payload.firstName"/>
<entry key="Address" value="payload.address" />
<entry key="City" value="payload.city" />
Some of these values extracted from the PersonVo is not compatible with plain conversion to the JDBC types.

Related

Springboot - Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled

I have just created the spring boot application from spring initializer and execute it in intellij.But I am facing some error. Can anyone please help me to solve the error?
package com.demo.grocery;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class GroceryApplication {
public static void main(String[] args) {
SpringApplication.run(GroceryApplication.class, args);
}
}
And this is the error I am facing
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.2)
2022-07-29 22:12:46.331 INFO 14136 --- [ main] com.demo.grocery.GroceryApplication : Starting GroceryApplication using Java 11.0.13 on DESKTOP-MQ2O3FR with PID 14136 (C:\Users\keerthi\Downloads\grocery\target\classes started by keerthi in C:\Users\keerthi\Downloads\grocery)
2022-07-29 22:12:46.336 INFO 14136 --- [ main] com.demo.grocery.GroceryApplication : No active profile set, falling back to 1 default profile: "default"
2022-07-29 22:12:47.288 INFO 14136 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-07-29 22:12:47.306 INFO 14136 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7 ms. Found 0 JPA repository interfaces.
2022-07-29 22:12:48.437 INFO 14136 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-07-29 22:12:48.463 INFO 14136 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-07-29 22:12:48.463 INFO 14136 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-07-29 22:12:48.721 INFO 14136 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-07-29 22:12:48.721 INFO 14136 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2267 ms
2022-07-29 22:12:48.832 WARN 14136 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2022-07-29 22:12:48.839 INFO 14136 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-07-29 22:12:48.868 INFO 14136 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-07-29 22:12:48.897 ERROR 14136 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Process finished with exit code 1
I have tried most of the solutions from stackoverflow, help me to solve this error
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePassword
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.jpa.show-sql: true
Paste this in your application properties file in the resource folder.
Change the database name in the second line and also change the username and password according to your database.

Spring boot Error creating bean with name 'entityManagerFactory' defined in class path resource

I'm trying to do a 'spring-boot:run` and want to generate columns for all the
five variables:
#Entity
Class Shopping{
#Id
#GeneratedValue
private int id;
private ShopifyInfo shop_info;
private int product_count;
private List<Products> products;
private List<Variants> variants;
}
But I'm getting this error:
022-05-11 21:46:20.710 ERROR 25420 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.List, at table: shopify, for columns: [org.hibernate.mapping.Column(products)]
2022-05-11 21:46:20.710 WARN 25420 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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 javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.List, at table: shopify, for columns: [org.hibernate.mapping.Column(products)]
2022-05-11 21:46:20.710 INFO 25420 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-05-11 21:46:20.793 INFO 25420 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2022-05-11 21:46:20.796 INFO 25420 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-05-11 21:46:20.812 INFO 25420 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-11 21:46:20.945 ERROR 25420 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
Do I need to use mapping between the Entity class and product class. Need a suggestion on this?
Your comment:
**Here I'm trying to do a "spring-boot:run" and want to generate columns for all above
five variables. But I'm getting this error :**
indicates that you want to have columns with the ids of the products and variants in your shopping table, however what you probably want to do is have a join table.
The error is telling you that your mapping is not understood, your use case should use a many to many relationship, and you will need a separate table to hold the foreign keys. Basically annotate the products and variants attributes with #ManyToMany and specify the join table, this is left as an exercise to you.
Check https://www.baeldung.com/jpa-many-to-many for an example

MySQL connection to Springboot

I looked into similar issues and tried to do different options as mentioned in the prior threads, but not able to fix it. I have the error below, can somebody help me to fix this issue.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.11.RELEASE)
2020-12-08 15:05:30.602 INFO 11076 --- [ main] c.p.c.ConferenceDemoApplication : Starting ConferenceDemoApplication on DESKTOP-3RN8P39 with PID 11076 (C:\Users\tania\Downloads\conference-demo\conference-demo\target\classes started by tania in C:\Users\tania\Downloads\conference-demo)
2020-12-08 15:05:30.607 INFO 11076 --- [ main] c.p.c.ConferenceDemoApplication : No active profile set, falling back to default profiles: default
2020-12-08 15:05:32.039 INFO 11076 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-12-08 15:05:32.162 INFO 11076 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 109ms. Found 2 JPA repository interfaces.
2020-12-08 15:05:33.208 INFO 11076 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-12-08 15:05:33.220 INFO 11076 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-12-08 15:05:33.221 INFO 11076 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-12-08 15:05:33.339 INFO 11076 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-12-08 15:05:33.339 INFO 11076 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2655 ms
2020-12-08 15:05:33.595 INFO 11076 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-12-08 15:05:33.655 INFO 11076 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.22.Final
2020-12-08 15:05:33.775 INFO 11076 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2020-12-08 15:05:33.866 INFO 11076 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-12-08 15:05:34.392 INFO 11076 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-12-08 15:05:34.406 WARN 11076 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata : Unable to resolve name [org.hibernate.dialect.mysqlDialect] as strategy [org.hibernate.dialect.Dialect]
2020-12-08 15:05:34.409 WARN 11076 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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]
2020-12-08 15:05:34.410 INFO 11076 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-12-08 15:05:34.413 INFO 11076 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-12-08 15:05:34.416 INFO 11076 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-12-08 15:05:34.426 INFO 11076 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-08 15:05:34.432 ERROR 11076 --- [ 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:1794) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at com.pluralsight.conferencedemo.ConferenceDemoApplication.main(ConferenceDemoApplication.java:10) ~[classes/:na]
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.4.22.Final.jar:5.4.22.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:176) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
... 16 common frames omitted
Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.mysqlDialect] as strategy [org.hibernate.dialect.Dialect]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:156) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:239) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:183) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:170) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:164) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:74) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:51) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
... 33 common frames omitted
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.dialect.mysqlDialect]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:133) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:152) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
... 43 common frames omitted
Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.mysqlDialect
at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:210) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Class.java:468) ~[na:na]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:130) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
... 44 common frames omitted
Process finished with exit code 1
Pom.xml application properties
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.2.11.RELEASE
com.example
demo
0.0.1-SNAPSHOT
demo
Demo project for Spring Boot
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.3.Final</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I have been trying different options to get rid of this error, but it appears that the issue is with the mapping. Below are the model outputs, need your help in resolving this issue.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.11.RELEASE)
2020-12-09 18:16:25.136 INFO 16144 --- [ main] c.p.c.ConferenceDemoApplication : Starting ConferenceDemoApplication on DESKTOP-3RN8P39 with PID 16144 (C:\Users\tania\Downloads\conference-demo\conference-demo\target\classes started by tania in C:\Users\tania\Downloads\conference-demo)
2020-12-09 18:16:25.140 INFO 16144 --- [ main] c.p.c.ConferenceDemoApplication : No active profile set, falling back to default profiles: default
2020-12-09 18:16:26.448 INFO 16144 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-12-09 18:16:26.577 INFO 16144 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 114ms. Found 2 JPA repository interfaces.
2020-12-09 18:16:27.536 INFO 16144 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-12-09 18:16:27.552 INFO 16144 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-12-09 18:16:27.552 INFO 16144 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-12-09 18:16:27.676 INFO 16144 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-12-09 18:16:27.676 INFO 16144 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2437 ms
2020-12-09 18:16:27.898 INFO 16144 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-12-09 18:16:27.946 INFO 16144 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.22.Final
2020-12-09 18:16:28.062 INFO 16144 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-12-09 18:16:28.154 INFO 16144 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-12-09 18:16:28.501 INFO 16144 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-12-09 18:16:28.517 INFO 16144 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2020-12-09 18:16:28.827 WARN 16144 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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.AnnotationException: #OneToOne or #ManyToOne on com.pluralsight.conferencedemo.models.Session.speakers references an unknown entity: java.util.List
2020-12-09 18:16:28.827 INFO 16144 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-12-09 18:16:28.854 INFO 16144 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-12-09 18:16:28.854 INFO 16144 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-12-09 18:16:28.863 INFO 16144 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-09 18:16:28.872 ERROR 16144 --- [ 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.AnnotationException: #OneToOne or #ManyToOne on com.pluralsight.conferencedemo.models.Session.speakers references an unknown entity: java.util.List
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.11.RELEASE.jar:2.2.11.RELEASE]
at com.pluralsight.conferencedemo.ConferenceDemoApplication.main(ConferenceDemoApplication.java:10) ~[classes/:na]
Caused by: org.hibernate.AnnotationException: #OneToOne or #ManyToOne on com.pluralsight.conferencedemo.models.Session.speakers references an unknown entity: java.util.List
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:97) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processEndOfQueue(InFlightMetadataCollectorImpl.java:1823) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processFkSecondPassesInOrder(InFlightMetadataCollectorImpl.java:1767) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1655) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:286) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255) ~[hibernate-core-5.4.22.Final.jar:5.4.22.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
... 16 common frames omitted
Process finished with exit code 1
Model1
package com.pluralsight.conferencedemo.models;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import javax.persistence.*;
import java.util.List;
#Entity(name="sessions")
public class Session {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long session_id;
#Column(name="session_name", nullable = false)
private String session_name;
#Column(name="session_description", nullable = false)
private String session_description;
#Column(name="session_length", nullable = false)`enter code here`
private Integer session_length;
#ManyToMany
#JoinTable(
name="session_speakers",
joinColumns = #JoinColumn(name="session_id"),
inverseJoinColumns = #JoinColumn(name="speaker_id")
)
private List<Speakers> speakers;
public Session(){
}
public List<Speakers> getSpeakers() {
return speakers;
}
public void setSpeakers(List<Speakers> speakers) {
this.speakers = speakers;
}
public Long getSession_id() {
return session_id;
}
public void setSession_id(Long session_id) {
this.session_id = session_id;
}
public String getSession_name() {
return session_name;
}
public void setSession_name(String session_name) {
this.session_name = session_name;
}
public String getSession_description() {
return session_description;
}
public void setSession_description(String session_description) {
this.session_description = session_description;
}
public Integer getSession_length() {
return session_length;
}
public void setSession_length(Integer session_length) {
this.session_length = session_length;
}
}
Model2
package com.pluralsight.conferencedemo.models;
import javax.persistence.*;
import java.util.List;
#Entity(name="speakers")
public class Speakers {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long speaker_id;
#Column(name="first_name", nullable = false)
private String first_name;
#Column(name="last_name", nullable = false)
private String last_name;
#Column(name="title", nullable = false)
private String title;
#Column(name="company", nullable = false)
private String company;
#Column(name="speaker_bio", nullable = false)
private String speaker_bio;
private byte[] speaker_photo;
#ManyToMany(mappedBy= "speakers")
private List<Session> session;
public Speakers(){
}
public byte[] getSpeaker_photo() {
return speaker_photo;
}
public void setSpeaker_photo(byte[] speaker_photo) {
this.speaker_photo = speaker_photo;
}
public List<Session> getSession() {
return session;
}
public void setSession(List<Session> session) {
this.session = session;
}
public Long getSpeaker_id() {
return speaker_id;
}
public void setSpeaker_id(Long speaker_id) {
this.speaker_id = speaker_id;
}
public String getFirst_name() {
return first_name;
}
public void setFirst_name(String first_name) {
this.first_name = first_name;
}
public String getLast_name() {
return last_name;
}
public void setLast_name(String last_name) {
this.last_name = last_name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getSpeaker_bio() {
return speaker_bio;
}
public void setSpeaker_bio(String speaker_bio) {
this.speaker_bio = speaker_bio;
}
}

Springboot Hibernate does not create tables in remote mysql database

I'm trying to create tables on my remote db, but It doesn't make any query on it.
Actually when I'm typing my db password wrong it gives me an error, so I assume that somehow it is connecting but not serializing any entity.
Here is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.palmieri</groupId>
<artifactId>InstaPalm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>InstaPalm</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>14</java.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
<version>2.3.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>2.3.4.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Here is my entity class User
package com.palmieri.InstaPalm.entities;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Date;
import java.util.List;
#Entity
#Table(name = "photo")
public class Photo implements Serializable {
private static final long serialVersionUID = 6470094278127188729L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
#Column(name = "data", nullable = false)
private Date data;
#ManyToOne( fetch = FetchType.EAGER)
private User user;
#Column(name="link", nullable = false)
private String link;
#OneToMany(mappedBy = "photo", fetch = FetchType.EAGER)
private List<Like> likes;
#OneToMany(mappedBy = "photo", fetch = FetchType.EAGER)
private List<Comment> comments;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public List<Like> getLikes() {
return likes;
}
public void setLikes(List<Like> likes) {
this.likes = likes;
}
public List<Comment> getComments() {
return comments;
}
public void setComments(List<Comment> comments) {
this.comments = comments;
}
}
And my application.properties
## Database Properties
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://sql2.freemysqlhosting.net:3306/XXX?useSSL=false
spring.datasource.username = XXXXX
spring.datasource.password = XXXXX
## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.open-in-view=false
spring.jpa.show-sql=true
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = none
I'm sure i'm missing some configuration or some property but I cant figure out which one, maybe I mismatched the packages? thank you for your response
EDIT 1
Here is my log
2020-09-23 14:54:49.807 INFO 14620 --- [ restartedMain] c.p.InstaPalm.InstaPalmApplication : Starting InstaPalmApplication on SI-W-00446 with PID 14620 (C:\Users\SI2001\IdeaProjects\InstaPalm\InstaPalm\target\classes started by SI2001 in C:\Users\SI2001\IdeaProjects\InstaPalm\InstaPalm)
2020-09-23 14:54:49.809 INFO 14620 --- [ restartedMain] c.p.InstaPalm.InstaPalmApplication : No active profile set, falling back to default profiles: default
2020-09-23 14:54:49.809 DEBUG 14620 --- [ restartedMain] o.s.boot.SpringApplication : Loading source class com.palmieri.InstaPalm.InstaPalmApplication
2020-09-23 14:54:49.919 DEBUG 14620 --- [ restartedMain] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/C:/Users/SI2001/IdeaProjects/InstaPalm/InstaPalm/target/classes/application.properties' (classpath:/application.properties)
2020-09-23 14:54:49.921 DEBUG 14620 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : Matching URLs for reloading : [file:/C:/Users/SI2001/IdeaProjects/InstaPalm/InstaPalm/target/classes/]
2020-09-23 14:54:49.921 DEBUG 14620 --- [ restartedMain] o.s.b.d.settings.DevToolsSettings : Included patterns for restart : []
2020-09-23 14:54:49.921 DEBUG 14620 --- [ restartedMain] o.s.b.d.settings.DevToolsSettings : Excluded patterns for restart : [/spring-boot-starter-[\w-]+/, /spring-boot/(bin|build|out)/, /spring-boot-starter/(bin|build|out)/, /spring-boot-devtools/(bin|build|out)/, /spring-boot-actuator/(bin|build|out)/, /spring-boot-autoconfigure/(bin|build|out)/]
2020-09-23 14:54:49.922 INFO 14620 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-09-23 14:54:49.922 INFO 14620 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-09-23 14:54:49.922 DEBUG 14620 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#4d5a23dd
2020-09-23 14:54:51.024 INFO 14620 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-09-23 14:54:51.046 INFO 14620 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14ms. Found 0 JPA repository interfaces.
2020-09-23 14:54:51.574 DEBUG 14620 --- [ restartedMain] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\SI2001\.m2\repository\org\springframework\boot\spring-boot\2.3.4.RELEASE\spring-boot-2.3.4.RELEASE.jar
2020-09-23 14:54:51.575 DEBUG 14620 --- [ restartedMain] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\SI2001\.m2\repository\org\springframework\boot\spring-boot\2.3.4.RELEASE\spring-boot-2.3.4.RELEASE.jar
2020-09-23 14:54:51.575 DEBUG 14620 --- [ restartedMain] .s.b.w.e.t.TomcatServletWebServerFactory : None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored.
2020-09-23 14:54:51.641 INFO 14620 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-09-23 14:54:51.651 INFO 14620 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-09-23 14:54:51.651 INFO 14620 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.38]
2020-09-23 14:54:51.797 INFO 14620 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-09-23 14:54:51.798 DEBUG 14620 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2020-09-23 14:54:51.798 INFO 14620 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1876 ms
2020-09-23 14:54:51.927 DEBUG 14620 --- [ restartedMain] o.s.b.w.s.ServletContextInitializerBeans : Mapping filters: filterRegistrationBean urls=[/*] order=-2147483647, characterEncodingFilter urls=[/*] order=-2147483648, formContentFilter urls=[/*] order=-9900, requestContextFilter urls=[/*] order=-105
2020-09-23 14:54:51.927 DEBUG 14620 --- [ restartedMain] o.s.b.w.s.ServletContextInitializerBeans : Mapping servlets: dispatcherServlet urls=[/]
2020-09-23 14:54:51.945 DEBUG 14620 --- [ restartedMain] o.s.b.a.m.w.servlet.WebMvcMetricsFilter : Filter 'webMvcMetricsFilter' configured for use
2020-09-23 14:54:51.945 DEBUG 14620 --- [ restartedMain] o.s.b.w.s.f.OrderedRequestContextFilter : Filter 'requestContextFilter' configured for use
2020-09-23 14:54:51.945 DEBUG 14620 --- [ restartedMain] s.b.w.s.f.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured for use
2020-09-23 14:54:51.945 DEBUG 14620 --- [ restartedMain] o.s.b.w.s.f.OrderedFormContentFilter : Filter 'formContentFilter' configured for use
DEBUG StatusLogger org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!
2020-09-23 14:54:52.109 INFO 14620 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-23 14:54:52.147 INFO 14620 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-09-23 14:54:52.200 INFO 14620 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.21.Final
2020-09-23 14:54:52.355 INFO 14620 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-09-23 14:54:52.361 DEBUG 14620 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 #ModelAttribute, 0 #InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2020-09-23 14:54:52.415 DEBUG 14620 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : 2 mappings in 'requestMappingHandlerMapping'
2020-09-23 14:54:52.446 DEBUG 14620 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
2020-09-23 14:54:52.459 DEBUG 14620 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 0 #ExceptionHandler, 1 ResponseBodyAdvice
2020-09-23 14:54:52.463 INFO 14620 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-09-23 14:54:53.132 INFO 14620 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-09-23 14:54:53.153 INFO 14620 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2020-09-23 14:54:53.364 DEBUG 14620 --- [ restartedMain] inMXBeanRegistrar$SpringApplicationAdmin : Application Admin MBean registered with name 'org.springframework.boot:type=Admin,name=SpringApplication'
2020-09-23 14:54:53.411 DEBUG 14620 --- [ restartedMain] o.s.b.d.livereload.LiveReloadServer : Starting live reload server on port 35729
2020-09-23 14:54:53.413 INFO 14620 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-09-23 14:54:53.419 INFO 14620 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-09-23 14:54:53.479 INFO 14620 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-09-23 14:54:53.481 INFO 14620 --- [ restartedMain] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-09-23 14:54:53.482 INFO 14620 --- [ restartedMain] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-09-23 14:54:53.500 INFO 14620 --- [ restartedMain] c.p.InstaPalm.InstaPalmApplication : Started InstaPalmApplication in 4.246 seconds (JVM running for 5.36)
2020-09-23 14:54:53.506 DEBUG 14620 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Creating new Restarter for thread Thread[main,5,main]
2020-09-23 14:54:53.506 DEBUG 14620 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Immediately restarting application
2020-09-23 14:54:53.506 DEBUG 14620 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader#1c3d316b
2020-09-23 14:54:53.506 DEBUG 14620 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Starting application com.palmieri.InstaPalm.InstaPalmApplication with URLs [file:/C:/Users/SI2001/IdeaProjects/InstaPalm/InstaPalm/target/classes/]
2020-09-23 14:54:54.064 INFO 14620 --- [ion(3)-10.8.2.7] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-09-23 14:54:54.064 INFO 14620 --- [ion(3)-10.8.2.7] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-09-23 14:54:54.064 DEBUG 14620 --- [ion(3)-10.8.2.7] o.s.web.servlet.DispatcherServlet : Detected StandardServletMultipartResolver
2020-09-23 14:54:54.071 DEBUG 14620 --- [ion(3)-10.8.2.7] o.s.web.servlet.DispatcherServlet : enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data
2020-09-23 14:54:54.072 INFO 14620 --- [ion(3)-10.8.2.7] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms
You can achieve your purpose by adding this
spring.jpa.hibernate.ddl-auto = create
But keep in mind that, everytime you start your application, it will delete all previous tables and data. So to avoid this, you just change it toupdate like this
spring.jpa.hibernate.ddl-auto = update
add createDatabaseIfNotExist=true to your db.url
spring.datasource.url = jdbc:mysql://sql2.freemysqlhosting.net:3306/XXX useSSL=false&createDatabaseIfNotExist=true
i think you need to use the following configurations in application.properties/application.yml file:
database:
name: yourdbname
spring:
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: ######
password: ######
url: jdbc:mysql://sql2.freemysqlhosting.net:3306/${database.name}&useSSL=false&createDatabaseIfNotExist=true
If you want Hibernate to create your tables you should set the spring.jpa.hibernate.ddl-auto Property in your application.property file from none to create or update.
spring.jpa.hibernate.ddl-auto = create
It's better to create an empty database first using the SQL command if it's not available in your MySQL server.
Then run your application with the following property added into your application.properties file.
spring.jpa.hibernate.ddl-auto = update
As the update parameter will not drop your database and recreate it on each restart

org.hibernate.HibernateException: Missing column: auth_password in Spring Boot application

I am working with a Spring Boot application . I have faced some issue related to org.hibernate.HibernateException: Missing column: auth_password in medxlabpro.appsettings
I have column in my PoJo class authpassword not auth_password. So why this type of issue coming in my application . Anyone can help me please. I have added JPA configuration and Log.
As per my concern i guess it is coming due to configuration mistake.
generate-ddl: false
hibernate:
ddl-auto: validate
:: Spring Boot :: (v1.2.1.RELEASE)
2016-06-21 19:31:52.733 INFO 8196 --- [ main] org.sam.application.Application : Starting Application on DESKTOP-JIBLNR1 with PID 8196 (C:\LabSystem\Scheduler\target\classes started by Sitansu in C:\LabSystem\Scheduler)
2016-06-21 19:31:52.805 INFO 8196 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#bd4dc25: startup date [Tue Jun 21 19:31:52 IST 2016]; root of context hierarchy
2016-06-21 19:31:53.912 INFO 8196 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' of type [class org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$960de3bc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-06-21 19:31:53.948 INFO 8196 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' of type [class org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$3cdcd8e2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-06-21 19:31:54.435 INFO 8196 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-06-21 19:31:54.463 INFO 8196 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-06-21 19:31:54.560 INFO 8196 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.7.Final}
2016-06-21 19:31:54.561 INFO 8196 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-06-21 19:31:54.563 INFO 8196 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-06-21 19:31:54.900 INFO 8196 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-06-21 19:31:55.677 INFO 8196 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2016-06-21 19:31:55.687 INFO 8196 --- [ main] o.h.e.jdbc.internal.LobCreatorBuilder : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
2016-06-21 19:31:56.056 INFO 8196 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-06-21 19:31:56.592 INFO 8196 --- [ main] o.h.tool.hbm2ddl.SchemaValidator : HHH000229: Running schema validator
2016-06-21 19:31:56.593 INFO 8196 --- [ main] o.h.tool.hbm2ddl.SchemaValidator : HHH000102: Fetching database metadata
2016-06-21 19:31:56.628 INFO 8196 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: medxlabpro.appsettings
2016-06-21 19:31:56.629 INFO 8196 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [hl7ftphostname, hl7ftppassword, clientcode, desktopheight1, desktopheight2, newordereligipdfneeded, billingdays, receiptno, defaultpagesize, desktopheight3, postingbatchno, desktopheight4, desktopheight5, id, edibatchno, desktopheight6, datarootfolder, desktopheight7, desktopheight8, claimno, hl7ftpfolder, hl7ftpusername, neworderorderpdfneeded, authpassword, desktoppagesize8, hl7ftpport, desktoppagesize6, neworderresultpdfneeded, desktoppagesize7, desktoppagesize4, desktoppagesize5, versionno, desktoppagesize2, desktoppagesize3, desktoppagesize1, invoiceno]
2016-06-21 19:31:56.636 WARN 8196 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: auth_password in abcdpro.appsettings
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
at org.sam.application.Application.main(Application.java:33)
Caused by: org.hibernate.HibernateException: Missing column: auth_password in abcdpro.appsettings
at org.hibernate.mapping.Table.validateColumns(Table.java:365)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1338)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
JPA configuration:
jpa:
generate-ddl: false
hibernate:
ddl-auto: validate
database: MYSQL
show-sql: true
How can i fix this anyone can help me please ?
Thanks
Sitansu
By default Spring Boot uses SpringNamingStrategy. This strategy generates underscores in table and field names. So for field authPassword the strategy generates auth_password column name.
If you want to map entity fields to camel case column names you can use org.hibernate.cfg.EJB3NamingStrategy or implement your own.
You can specify a naming strategy in application.properties
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
I have column in my PoJo class authpassword not auth_password.
Easy solution could be:
add #Column(name="auth_password") to your authpassword field.
Then it should work