خرید بک لینک

Vote count: 0

I'm trying to create a spring boot app.Getting the following error-

org.postgresql.util.PSQLException: ERROR: relation "post" does not exist

When i try to run it from eclipse.I was originally getting the hibeate_sequence error but after looking thru i saw the @GeneratedValue(strategy=GenerationType.IDENTITY) solution.

Here is my code

My Post class is-

 package au.com.riosoftware.firstapp.domain;

 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;

@Entity

public class Post {
  private static final long serialVersionUID = -7049957706738879274L;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private long id;
private String message;

public Post(){
}

public Post(String message){
    this.message = message;
}

public long getId() {
    retu id;
}

   public String getMessage() {
     retu message;
  }

   public void setMessage(String message) {
      this.message = message;
  }
 }

My pom.xml-

    <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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>au.com.riosoftware.firstapp</groupId>
<artifactId>firstapp</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>firstapp</name>
<url>http://maven.apache.org</url>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.7.RELEASE</version>
</parent>

<properties>
    <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-thymeleaf</artifactId>
    </dependency>

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

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
<dependency>
   <groupId>org.postgresql</groupId>
   <artifactId>postgresql</artifactId>
   <version>9.4-1206-jdbc42</version>
</dependency>
</dependencies>

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

<repositories>
    <repository>
        <id>spring-milestone</id>
        <url>https://repo.spring.io/libs-release</url>
    </repository>

    <repository>
        <id>sonatype-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-milestone</id>
        <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
    <pluginRepository>
        <id>jetty</id>
        <url>http://mvnrepository.com/artifact/org.eclipse.jetty</url>
    </pluginRepository>
</pluginRepositories>

My application.properties is set as-

spring.jpa.database=postgresql
spring.datasource.platform=postgres
spring.jpa.show-sql=true 
spring.jpa.hibeate.ddl-auto=create-drop 
spring.database.driverClassName=org.postgresql.Driver   
spring.datasource.url=jdbc:postgresql://localhost:5432/testdb
spring.datasource.useame=postgres
spring.datasource.password=postgres
server.port=8080
logging.level.org.springframework.web=DEBUG 
logging.level.org.hibeate=ERROR

Any idea why this is happening

asked 23 secs ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 10 مرداد 1395 ساعت: 15:05

صفحه بندی