JPA与postgresql
当我使用hibernate在Jpa中使用PostgreSQL数据库创建表实体时JPA与postgresql,postgresql,hibernate,spring-data-jpa,Postgresql,Hibernate,Spring Data Jpa,当我使用hibernate在Jpa中使用PostgreSQL数据库创建表实体时 tire - @Entity @Immutable public class User_entity_t implements Serializable, Cloneable { private static final long serialVersionUID = -7049957706738879274L; @Id @GeneratedValue(strategy = G
tire -
@Entity
@Immutable
public class User_entity_t implements Serializable, Cloneable {
private static final long serialVersionUID = -7049957706738879274L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long _judId;
@Column(nullable = false)
private String name;
我也有例外
{syntax error at or near "auto_increment"} Primary Key Id
自动增量听起来像MySQL
您必须设置正确的Hibernate方言。这可能是重复的声音,好像您的混淆层不知道Postgres如何处理“自动递增”列(作为
serial
或作为identity
)1)您应该避免使用auto并选择identity。2) 自动增量听起来像MySQL。你有正确的方言集吗?@SimonMartinelli谢谢你的回复。但当iuse Id GeneratedValue(strategy=GenerationType.IDENTITY)列(columnDefinition=“serial”)私有长Id时;同样的错误,你确定你为Postgres设置了正确的语法吗?