Connection Error between Spring Boot and MySQL :

Application Properties: spring.datasource.url=jdbc:mysql://localhost:3306/ems spring.datasource.username=root spring.datasource.password=admin1234 server.port = 5045 spring.jpa.properties..dialect=org.hibernate.dialect.MySQLDialect spring.jpa.hibernate.ddl-auto=update when i run this code, it doesn't make any table in mySql (ems database)
14 Replies
JavaBot
JavaBot10mo ago
This post has been reserved for your question.
Hey @DigitalDynamo! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st10mo ago
Can you please show the full stack trace?
DigitalDynamo
DigitalDynamoOP10mo ago
this is my output
No description
DigitalDynamo
DigitalDynamoOP10mo ago
table doesn't show any feilds
No description
john
john10mo ago
package entity; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.Table; import lombok.*; @Getter @Setter @AllArgsConstructor @NoArgsConstructor @Entity @Table(name="Employee")
public class Employee {


@Id
@GeneratedValue
private long id;

//@Column(name="first_name")
private String firstname;
private String lastname;
private String email;
}
public class Employee {


@Id
@GeneratedValue
private long id;

//@Column(name="first_name")
private String firstname;
private String lastname;
private String email;
}
This message has been formatted automatically. You can disable this using /preferences.
dan1st
dan1st10mo ago
Did you click the refresh button on the top right?
DigitalDynamo
DigitalDynamoOP10mo ago
yup
dan1st
dan1st10mo ago
Entity classes must be in a subpackage of your main class
DigitalDynamo
DigitalDynamoOP10mo ago
may be this is wrong ??
No description
dan1st
dan1st10mo ago
the entity package must be imside com.example.demo and the other packages should be as well
DigitalDynamo
DigitalDynamoOP10mo ago
oo i see thanks alot
JavaBot
JavaBot10mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
DigitalDynamo
DigitalDynamoOP10mo ago
i will try then tell you
JavaBot
JavaBot10mo ago
Post Closed
This post has been closed by <@805083232369770526>.
Want results from more Discord servers?
Add your server