Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql org.springframework.dao.InvalidDataAccessResourceUsageException:无法提取结果集;_Mysql_Spring Data - Fatal编程技术网

Mysql org.springframework.dao.InvalidDataAccessResourceUsageException:无法提取结果集;

Mysql org.springframework.dao.InvalidDataAccessResourceUsageException:无法提取结果集;,mysql,spring-data,Mysql,Spring Data,类实体 @Entity @Table public class Camera { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; private String place; private String address; public Long getId

类实体

@Entity
    @Table
    public class Camera {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        private String name;
        private String place;
        private String address;
public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getPlace() {
        return place;
    }

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

   //Constructors, getters and setters are not shown here

    }
application.properties配置文件

spring.datasource.url= jdbc:mysql://localhost:3306/springbootdb
spring.datasource.username=root
spring.datasource.password=
server.port=9000
我有这个错误


我必须在数据库中手动创建表才能工作:(知道吗?配置文件中有问题吗?感谢您的帮助:)

应用程序中添加以下属性。属性文件:

spring.jpa.hibernate.ddl-auto=update
这将初始化您的数据库。根据spring文档,还可以查看其他属性:


我有getter和setter:(更新的答案。请尝试。现在应该可以初始化您的数据库了。谢谢,我非常感谢您的帮助:D,它现在可以工作了:DHi,在自动创建一个表之后,我尝试添加另一个列,它会导致此错误。有什么想法吗?org.springframework.beans.factory.BeanCreationException:创建名为“entityManagerFactory”的bean时出错'在类路径资源[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]中定义]:初始化方法调用失败;嵌套异常为javax.persistence.PersistenceException:[PersistenceUnit:default]无法构建Hibernate SessionFactory
spring.jpa.hibernate.ddl-auto=update