Issue creating tables in JPA











up vote
0
down vote

favorite












I am working an assignment for a class, and am having trouble getting tables to be created in my MySQL database from entities in java. I am trying to get the tables to be created by typing mvn clean install in the project folder in terminal (which is what was given to me as an example to create them once I had the entities in java). No errors or anything occur, and I get a "build successful" message in terminal, but no new tables are created in MySQL. I have confirmed that my endpoint/username/password are all working by setting up the project using jdbc to manually connect instead of JPA and everything works fine that way. Note: This isn't the actual content of the assignment just the initial setup. I've followed the instructions the professor has given multiple times and it is not working. Thanks for the help!



I created my project using the spring command line interface in terminal:
spring init --dependencies=web test



I then added a webapp directory with a index.html file in the src/main directory of the project. Then the project was imported to IntelliJ as a Maven project



I added the following to my application.properties file which is in src/main resources (and is the resources root of the project). The aws endpoint/schema name are also filled in as usual:



spring.datasource.url=jdbc:mysql://MyAWSEndpoint:3306/SchemaName
spring.datasource.username=MyUsername
spring.datasource.password=MyPassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect


I then have a class that I created called random which is contained in src/main/java which is my source root for the project.



package com.example.test;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class random {
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
private int id;
private String name;


public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


Additionally I have a Repository I made for the entity in java contained in the same package as the class above.



package com.example.test;

import org.springframework.data.repository.CrudRepository;

public interface RandomRepository extends CrudRepository<random, Integer> {
}


Here is my pom.xml file as well



<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>


Additionally, I have a an application file in src/main/java:



package com.example.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

public static void main(String args) {
SpringApplication.run(DemoApplication.class, args);
}
}









share|improve this question






















  • Why do you think all that should create tables in MySQL when running mvn install? Your Spring Boot application doesn't run when you execute mvn install. It's only built.
    – JB Nizet
    Nov 11 at 19:58










  • not unless he uses mvn spring-boot:run
    – Ivonet
    Nov 11 at 20:03










  • In class and in the example provided in the slides to create tables all that was done was mvn clean install to create the tables. Should I be doing mvn spring-boot:run instead?
    – prestigem
    Nov 11 at 20:05

















up vote
0
down vote

favorite












I am working an assignment for a class, and am having trouble getting tables to be created in my MySQL database from entities in java. I am trying to get the tables to be created by typing mvn clean install in the project folder in terminal (which is what was given to me as an example to create them once I had the entities in java). No errors or anything occur, and I get a "build successful" message in terminal, but no new tables are created in MySQL. I have confirmed that my endpoint/username/password are all working by setting up the project using jdbc to manually connect instead of JPA and everything works fine that way. Note: This isn't the actual content of the assignment just the initial setup. I've followed the instructions the professor has given multiple times and it is not working. Thanks for the help!



I created my project using the spring command line interface in terminal:
spring init --dependencies=web test



I then added a webapp directory with a index.html file in the src/main directory of the project. Then the project was imported to IntelliJ as a Maven project



I added the following to my application.properties file which is in src/main resources (and is the resources root of the project). The aws endpoint/schema name are also filled in as usual:



spring.datasource.url=jdbc:mysql://MyAWSEndpoint:3306/SchemaName
spring.datasource.username=MyUsername
spring.datasource.password=MyPassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect


I then have a class that I created called random which is contained in src/main/java which is my source root for the project.



package com.example.test;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class random {
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
private int id;
private String name;


public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


Additionally I have a Repository I made for the entity in java contained in the same package as the class above.



package com.example.test;

import org.springframework.data.repository.CrudRepository;

public interface RandomRepository extends CrudRepository<random, Integer> {
}


Here is my pom.xml file as well



<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>


Additionally, I have a an application file in src/main/java:



package com.example.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

public static void main(String args) {
SpringApplication.run(DemoApplication.class, args);
}
}









share|improve this question






















  • Why do you think all that should create tables in MySQL when running mvn install? Your Spring Boot application doesn't run when you execute mvn install. It's only built.
    – JB Nizet
    Nov 11 at 19:58










  • not unless he uses mvn spring-boot:run
    – Ivonet
    Nov 11 at 20:03










  • In class and in the example provided in the slides to create tables all that was done was mvn clean install to create the tables. Should I be doing mvn spring-boot:run instead?
    – prestigem
    Nov 11 at 20:05















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am working an assignment for a class, and am having trouble getting tables to be created in my MySQL database from entities in java. I am trying to get the tables to be created by typing mvn clean install in the project folder in terminal (which is what was given to me as an example to create them once I had the entities in java). No errors or anything occur, and I get a "build successful" message in terminal, but no new tables are created in MySQL. I have confirmed that my endpoint/username/password are all working by setting up the project using jdbc to manually connect instead of JPA and everything works fine that way. Note: This isn't the actual content of the assignment just the initial setup. I've followed the instructions the professor has given multiple times and it is not working. Thanks for the help!



I created my project using the spring command line interface in terminal:
spring init --dependencies=web test



I then added a webapp directory with a index.html file in the src/main directory of the project. Then the project was imported to IntelliJ as a Maven project



I added the following to my application.properties file which is in src/main resources (and is the resources root of the project). The aws endpoint/schema name are also filled in as usual:



spring.datasource.url=jdbc:mysql://MyAWSEndpoint:3306/SchemaName
spring.datasource.username=MyUsername
spring.datasource.password=MyPassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect


I then have a class that I created called random which is contained in src/main/java which is my source root for the project.



package com.example.test;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class random {
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
private int id;
private String name;


public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


Additionally I have a Repository I made for the entity in java contained in the same package as the class above.



package com.example.test;

import org.springframework.data.repository.CrudRepository;

public interface RandomRepository extends CrudRepository<random, Integer> {
}


Here is my pom.xml file as well



<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>


Additionally, I have a an application file in src/main/java:



package com.example.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

public static void main(String args) {
SpringApplication.run(DemoApplication.class, args);
}
}









share|improve this question













I am working an assignment for a class, and am having trouble getting tables to be created in my MySQL database from entities in java. I am trying to get the tables to be created by typing mvn clean install in the project folder in terminal (which is what was given to me as an example to create them once I had the entities in java). No errors or anything occur, and I get a "build successful" message in terminal, but no new tables are created in MySQL. I have confirmed that my endpoint/username/password are all working by setting up the project using jdbc to manually connect instead of JPA and everything works fine that way. Note: This isn't the actual content of the assignment just the initial setup. I've followed the instructions the professor has given multiple times and it is not working. Thanks for the help!



I created my project using the spring command line interface in terminal:
spring init --dependencies=web test



I then added a webapp directory with a index.html file in the src/main directory of the project. Then the project was imported to IntelliJ as a Maven project



I added the following to my application.properties file which is in src/main resources (and is the resources root of the project). The aws endpoint/schema name are also filled in as usual:



spring.datasource.url=jdbc:mysql://MyAWSEndpoint:3306/SchemaName
spring.datasource.username=MyUsername
spring.datasource.password=MyPassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect


I then have a class that I created called random which is contained in src/main/java which is my source root for the project.



package com.example.test;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class random {
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
private int id;
private String name;


public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


Additionally I have a Repository I made for the entity in java contained in the same package as the class above.



package com.example.test;

import org.springframework.data.repository.CrudRepository;

public interface RandomRepository extends CrudRepository<random, Integer> {
}


Here is my pom.xml file as well



<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>


Additionally, I have a an application file in src/main/java:



package com.example.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

public static void main(String args) {
SpringApplication.run(DemoApplication.class, args);
}
}






mysql spring spring-boot jpa spring-data-jpa






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 19:54









prestigem

134




134












  • Why do you think all that should create tables in MySQL when running mvn install? Your Spring Boot application doesn't run when you execute mvn install. It's only built.
    – JB Nizet
    Nov 11 at 19:58










  • not unless he uses mvn spring-boot:run
    – Ivonet
    Nov 11 at 20:03










  • In class and in the example provided in the slides to create tables all that was done was mvn clean install to create the tables. Should I be doing mvn spring-boot:run instead?
    – prestigem
    Nov 11 at 20:05




















  • Why do you think all that should create tables in MySQL when running mvn install? Your Spring Boot application doesn't run when you execute mvn install. It's only built.
    – JB Nizet
    Nov 11 at 19:58










  • not unless he uses mvn spring-boot:run
    – Ivonet
    Nov 11 at 20:03










  • In class and in the example provided in the slides to create tables all that was done was mvn clean install to create the tables. Should I be doing mvn spring-boot:run instead?
    – prestigem
    Nov 11 at 20:05


















Why do you think all that should create tables in MySQL when running mvn install? Your Spring Boot application doesn't run when you execute mvn install. It's only built.
– JB Nizet
Nov 11 at 19:58




Why do you think all that should create tables in MySQL when running mvn install? Your Spring Boot application doesn't run when you execute mvn install. It's only built.
– JB Nizet
Nov 11 at 19:58












not unless he uses mvn spring-boot:run
– Ivonet
Nov 11 at 20:03




not unless he uses mvn spring-boot:run
– Ivonet
Nov 11 at 20:03












In class and in the example provided in the slides to create tables all that was done was mvn clean install to create the tables. Should I be doing mvn spring-boot:run instead?
– prestigem
Nov 11 at 20:05






In class and in the example provided in the slides to create tables all that was done was mvn clean install to create the tables. Should I be doing mvn spring-boot:run instead?
– prestigem
Nov 11 at 20:05














1 Answer
1






active

oldest

votes

















up vote
0
down vote













You might want to use the below property in the application.properties once:



spring.jpa.hibernate.ddl-auto=create 


after the first run you can comment it out again.



To be sure your db user must have the correct privileges to create tables otherwise it won't work :-)



And you need to run the application either by using:



mvn clean package && java -jar target/test-0.0.1-SNAPSHOT.jar 


or



mvn clean spring-boot:run


if your application is only build it will not run and not do anything except being compiled and tested.



It might be that your teacher had the setup of the database in the unit tests? then it would have been done...



Good luck






share|improve this answer





















  • I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
    – prestigem
    Nov 11 at 20:10










  • Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
    – Ivonet
    Nov 11 at 20:11












  • hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
    – prestigem
    Nov 11 at 20:14












  • Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
    – Ivonet
    Nov 11 at 20:16










  • Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
    – prestigem
    Nov 11 at 20:18











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252615%2fissue-creating-tables-in-jpa%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You might want to use the below property in the application.properties once:



spring.jpa.hibernate.ddl-auto=create 


after the first run you can comment it out again.



To be sure your db user must have the correct privileges to create tables otherwise it won't work :-)



And you need to run the application either by using:



mvn clean package && java -jar target/test-0.0.1-SNAPSHOT.jar 


or



mvn clean spring-boot:run


if your application is only build it will not run and not do anything except being compiled and tested.



It might be that your teacher had the setup of the database in the unit tests? then it would have been done...



Good luck






share|improve this answer





















  • I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
    – prestigem
    Nov 11 at 20:10










  • Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
    – Ivonet
    Nov 11 at 20:11












  • hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
    – prestigem
    Nov 11 at 20:14












  • Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
    – Ivonet
    Nov 11 at 20:16










  • Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
    – prestigem
    Nov 11 at 20:18















up vote
0
down vote













You might want to use the below property in the application.properties once:



spring.jpa.hibernate.ddl-auto=create 


after the first run you can comment it out again.



To be sure your db user must have the correct privileges to create tables otherwise it won't work :-)



And you need to run the application either by using:



mvn clean package && java -jar target/test-0.0.1-SNAPSHOT.jar 


or



mvn clean spring-boot:run


if your application is only build it will not run and not do anything except being compiled and tested.



It might be that your teacher had the setup of the database in the unit tests? then it would have been done...



Good luck






share|improve this answer





















  • I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
    – prestigem
    Nov 11 at 20:10










  • Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
    – Ivonet
    Nov 11 at 20:11












  • hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
    – prestigem
    Nov 11 at 20:14












  • Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
    – Ivonet
    Nov 11 at 20:16










  • Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
    – prestigem
    Nov 11 at 20:18













up vote
0
down vote










up vote
0
down vote









You might want to use the below property in the application.properties once:



spring.jpa.hibernate.ddl-auto=create 


after the first run you can comment it out again.



To be sure your db user must have the correct privileges to create tables otherwise it won't work :-)



And you need to run the application either by using:



mvn clean package && java -jar target/test-0.0.1-SNAPSHOT.jar 


or



mvn clean spring-boot:run


if your application is only build it will not run and not do anything except being compiled and tested.



It might be that your teacher had the setup of the database in the unit tests? then it would have been done...



Good luck






share|improve this answer












You might want to use the below property in the application.properties once:



spring.jpa.hibernate.ddl-auto=create 


after the first run you can comment it out again.



To be sure your db user must have the correct privileges to create tables otherwise it won't work :-)



And you need to run the application either by using:



mvn clean package && java -jar target/test-0.0.1-SNAPSHOT.jar 


or



mvn clean spring-boot:run


if your application is only build it will not run and not do anything except being compiled and tested.



It might be that your teacher had the setup of the database in the unit tests? then it would have been done...



Good luck







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 20:06









Ivonet

1,177518




1,177518












  • I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
    – prestigem
    Nov 11 at 20:10










  • Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
    – Ivonet
    Nov 11 at 20:11












  • hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
    – prestigem
    Nov 11 at 20:14












  • Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
    – Ivonet
    Nov 11 at 20:16










  • Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
    – prestigem
    Nov 11 at 20:18


















  • I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
    – prestigem
    Nov 11 at 20:10










  • Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
    – Ivonet
    Nov 11 at 20:11












  • hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
    – prestigem
    Nov 11 at 20:14












  • Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
    – Ivonet
    Nov 11 at 20:16










  • Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
    – prestigem
    Nov 11 at 20:18
















I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
– prestigem
Nov 11 at 20:10




I just tried this out and it still isn't creating the tables. I think you may be on to something about not having correct privileges though. I created my database on AWS (rds database) and am using the username and password I gave the db when I initially created it. Would this have the correct privileges immediately, or is there something else I should do to upgrade my privilege level?
– prestigem
Nov 11 at 20:10












Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
– Ivonet
Nov 11 at 20:11






Nope I would take a look at the user on aws... see what it may and may not do. It might also be easier to just test it against a mysql in a docker image on your local machine before going to the cloud :-) e.g. github.com/IvoNet/ivonet-docker-images/tree/master/databases/…
– Ivonet
Nov 11 at 20:11














hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
– prestigem
Nov 11 at 20:14






hmmmm I saw your updated comment, and tried the mvn clean spring-boot:run command. I actually get a build failure when I do this with a laundry list of different errors. The main one that it seems to be highlighting is InvocationTargetException: Unsatisfied dependency expressed through constructor parameter 0
– prestigem
Nov 11 at 20:14














Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
– Ivonet
Nov 11 at 20:16




Then it seems you have a constructor with an argument in a class that needs something you don't have hehe. Good luck :-)
– Ivonet
Nov 11 at 20:16












Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
– prestigem
Nov 11 at 20:18




Interesting, thanks for the help! I'll probably go to office hours tomorrow to ask the professor about this I guess. I was hoping to get a head start on the assignment but I guess not :(
– prestigem
Nov 11 at 20:18


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252615%2fissue-creating-tables-in-jpa%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues