Skip to content

Commit

Permalink
HSEARCH-3277 Avoid using @type annotations
Browse files Browse the repository at this point in the history
They will be removed in Hibernate ORM 6.
  • Loading branch information
yrodiere committed Oct 6, 2022
1 parent d52072c commit 07ecc6d
Showing 1 changed file with 2 additions and 9 deletions.
Expand Up @@ -8,6 +8,7 @@

import static org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmUtils.with;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import jakarta.persistence.Basic;
Expand Down Expand Up @@ -118,25 +119,17 @@ public void setGenericProperty(GenericEntity<String> genericProperty) {
}

@Entity(name = "generic")
public abstract static class GenericEntity<T> {
public abstract static class GenericEntity<T extends Serializable> {

@Id
private Integer id;

@Basic
@GenericField
// Necessary for Hibernate ORM: even if we make T extend Serializable,
// ORM doesn't take it into account for some reason.
@SuppressWarnings("deprecation")
@org.hibernate.annotations.Type(type = "serializable")
private T content;

@Basic
@GenericField
// Necessary for Hibernate ORM: even if we make T extend Serializable,
// ORM doesn't take it into account for some reason.
@SuppressWarnings("deprecation")
@org.hibernate.annotations.Type(type = "serializable")
private T[] arrayContent;

@OneToMany(mappedBy = "genericProperty")
Expand Down

0 comments on commit 07ecc6d

Please sign in to comment.