标签:bin poi 存在 添加 tps ons conf exception red
1 Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.xxx.ProjectDTO
@MappedSuperclass
标注为映射的父类,即可解决上述问题
@Entity
@Table(name = "al_project")
public class ProjectDTO extends BaseDTO { ... }
@MappedSuperclass
public class BaseDTO { ... }
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘baseJpaRepository‘: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class java.lang.Object ... Caused by: java.lang.IllegalArgumentException: Not a managed type: class java.lang.Object
@NoRepositoryBean
告知SpringBoot该类不是一个存储库@NoRepositoryBean public interface BaseJpaRepository<T, ID> extends JpaRepository<T, ID> { ... }
*************************** APPLICATION FAILED TO START *************************** ... The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) ...
@Entity
注解@Entity
注解@MappedSuperclass
标明的英文映射父类@Entity @Table(name = "al_config") public class ConfigDTO extends BaseDTO { ... }
Caused by: org.hibernate.MappingException: Could not determine type for: com.asing1elife.teamnote.dto.ProjectGroupDTO, at table: al_project, for columns: [org.hibernate.mapping.Column(project_group)]
@ManyToOne
还是@OneToMay
,或其他对象映射规则@Entity @Table(name = "al_project") public class ProjectDTO extends BaseDTO { @Column private ProjectGroupDTO projectGroup; }
java.sql.SQLSyntaxErrorException: Table ‘asl_station.hibernate_sequence‘ doesn‘t exist
public class BaseDTO { @Id @GeneratedValue private Long id = 0L; }
@GeneratedValue
直接指定生成规则,就会抛出上述异常GeneratedType.AUTO
auto_increment
,这对应的应该是GenerationType.IDENTITY
public class BaseDTO { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id = 0L; }
Caused by: java.sql.SQLSyntaxErrorException: Unknown column ‘create_time‘ in ‘field list‘
@Column private Date createTime = DateUtil.getSysDate();
spring:
jpa:
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
hibernateLazyInitializer
属性,改属性在进行JSON转换时抛出异常com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.asing1elife.teamnote.core.bean.ResponseData["data"]->com.asing1elife.teamnote.dto.OrganizationDTO$HibernateProxy$f3Tr4vBI["hibernateLazyInitializer"])
@JsonIgnoreProperties("hibernateLazyInitializer")
,确保数据转换时会过滤掉休眠生成的属性
@JsonIgnoreProperties("hibernateLazyInitializer") public class BaseDTO { ... }
disable SerializationFeature.FAIL_ON_EMPTY_BEANS
可以尝试将JSON转换时的以下属性设置为false
spring: jackson: serialization: fail-on-empty-beans: false
(although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
标签:bin poi 存在 添加 tps ons conf exception red
原文地址:https://www.cnblogs.com/klyjb/p/11003475.html