jpa and postgresql

I can't find the reason of the error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: org/hibernate/mapping/RelationalModel
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: org/hibernate/mapping/RelationalModel
application.yaml
spring:
application:
name: 23-Spring-6-IoC-XML-BEAN-LIFECYCLE
datasource:
url: jdbc:postgresql://localhost:5432/springdata?currentSchema=public
username: postgres
password: root
driver-class-name: org.postgresql.Driver
jpa:
properties:
hibernate:
show_sql: true
format_sql: true
dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: validate

logging:
level:
root: info
file:
name: demo.log
path: /
spring:
application:
name: 23-Spring-6-IoC-XML-BEAN-LIFECYCLE
datasource:
url: jdbc:postgresql://localhost:5432/springdata?currentSchema=public
username: postgres
password: root
driver-class-name: org.postgresql.Driver
jpa:
properties:
hibernate:
show_sql: true
format_sql: true
dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: validate

logging:
level:
root: info
file:
name: demo.log
path: /
pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.ladsn</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.1.3</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>


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

<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.ladsn</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.1.3</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
3 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Alex! 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.
Alex
AlexOP2mo ago
entity
package org.example.demo.domain.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "companies")
public class Company implements EntityBase<Integer> {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@Column(nullable = false, unique = true)
private String name;

// @Builder.Default
// @ElementCollection
// @CollectionTable(name = "company_locales", joinColumns = @JoinColumn(name = "company_id"))
// @MapKeyColumn(name = "lang")
// @Column(name = "description")
// private Map<String,String> locales = new HashMap<>();
}
package org.example.demo.domain.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "companies")
public class Company implements EntityBase<Integer> {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@Column(nullable = false, unique = true)
private String name;

// @Builder.Default
// @ElementCollection
// @CollectionTable(name = "company_locales", joinColumns = @JoinColumn(name = "company_id"))
// @MapKeyColumn(name = "lang")
// @Column(name = "description")
// private Map<String,String> locales = new HashMap<>();
}
import java.io.Serializable;


public interface EntityBase<T extends Serializable> {
public void setId(T id);
public T getId();
}
import java.io.Serializable;


public interface EntityBase<T extends Serializable> {
public void setId(T id);
public T getId();
}
JavaBot
JavaBot2mo ago
Post Closed
This post has been closed by <@1012707805930729524>.
Want results from more Discord servers?
Add your server