我在Kotlinvert.x项目中使用Hibernate reactive,当我尝试构建时,我得到以下错误:Collection 'com.chaluchukwu.drone_system.entities.Delivery.cargoes' is declared with a raw type and has an explicit 'targetEntity'
下面是我的Delivery实体类:
@jakarta.persistence.Entity(name = "deliveries")
@Table(name = "deliveries")
open class Delivery(
@Column(name = "user_name")
open var userName: String? = null,
@Column(name= "reference")
open var reference: String? = UUID.randomUUID().toString().substring(0,10),
@ManyToOne
open var drone: Drone? = null,
@OneToMany
open var cargoes: List<Cargo>? = listOf(),
@CreationTimestamp(source = SourceType.DB)
@Column(name = "created_at")
open var createdAt: Date? = null,
@UpdateTimestamp(source = SourceType.DB)
@Column(name = "updated_at")
open var updatedAt: Date? = null,
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
open var id: Long? = null
) {}
字符串
有什么问题吗??
1条答案
按热度按时间xxls0lw81#
在
Delivery
类中,为@OneToMany
注解指定targetEntity
属性,以消除任何歧义,并让Hibernate确定集合中元素的目标实体类型。字符串