Hibernate Katharsis:如何为jpa实体设置资源类型?
我在我的项目中使用带spring boot的Katharsis,我的问题是Katharsis jpa。katharsis似乎忽略了@JsonApiResource注释,或者没有为指定的类型应用映射 我目前有两门课: 一个是我的实体用户:Hibernate Katharsis:如何为jpa实体设置资源类型?,hibernate,spring-boot,spring-data-jpa,jsonapi-resources,katharsis,Hibernate,Spring Boot,Spring Data Jpa,Jsonapi Resources,Katharsis,我在我的项目中使用带spring boot的Katharsis,我的问题是Katharsis jpa。katharsis似乎忽略了@JsonApiResource注释,或者没有为指定的类型应用映射 我目前有两门课: 一个是我的实体用户: @JsonApiResource(type = "users") @Entity @Table (name = "users") @EqualsAndHashCode(of = "firstName") @NoArgsConstructor public cla
@JsonApiResource(type = "users")
@Entity
@Table (name = "users")
@EqualsAndHashCode(of = "firstName")
@NoArgsConstructor
public class User {
@Getter
@Setter
@JsonApiId
@Id
@GeneratedValue (strategy = GenerationType.AUTO)
private Long id;
@Getter
@Setter
@Column
@JsonProperty (value = "last-name")
private String lastName;
@Getter
@Setter
@Column
@JsonProperty (value = "first-name")
private String firstName;
}
第二个是我的jpa存储库:
@Component
public class UserResourceRepository extends JpaEntityRepository<User, Long> {
@Autowired
public UserResourceRepository(JpaModule module) {
super(module, JpaRepositoryConfig.create(User.class));
}
}
问题分为两部分:
-获取数据的url:无效,
-json api序列化中的字段采用驼峰格式,而不是破折号
然后,如果没有katharsis jpa模块(例如使用一个简单的ResourceRepositoryBase),注释@JsonApiResource就可以正常工作
有人对此有什么想法吗?Katharsis对spring的总体支持率很低。您应该将此问题发布到实际github问题部分。现在,卡萨尔西斯正处于一个不断变化的状态,所以请注意。卡萨尔西斯对spring的支持总体上很差。您应该将此问题发布到实际github问题部分。现在,Katharsis处于一个不断变化的状态,所以请注意。
katharsis:
resourcePackage: my_package_name
domainName: http://localhost:8080
pathPrefix: /api
jpa:
enabled: false
spring:
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/my_db
username: my_user
password: my_password
jpa:
hibernate:
ddl-auto: update
show-sql: true