如何解决仅返回存储库中的扩展文档
我想问一下如何仅从存储库中返回扩展文档。我有InheritanceType table_per_entity,当我调用存储库方法findAll()时,我只想返回扩展对象。在此示例中,我具有CustomPropertyDefinition类,并且CustomPropery扩展了CustomPropertyDefinition。
当我有CustomPropertyDefinitionRepository存储库时,我想通过repo.findAll();仅返回CustomPropertyDefinitions。
@Entity
@Table(name = "custom_property_definitions")
@JsonIgnoreProperties({ "hibernateLazyInitializer","definitionsUsedIn" })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class CustomPropertyDefinition {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid",strategy = "uuid2")
@Column(name = "id",length = 40)
private String id;
@Column(name = "property_type",nullable = false,length = 10)
private String propertyType;
@Column(name = "symbolic_name",unique = true,nullable = false)
private String symbolicName;
@Column(name = "lower_bound")
private String lowerBound;
@Column(name = "upper_bound")
private String upperBound;
@ElementCollection
@CollectionTable(name = "custom_property_definition_allowed_values",joinColumns = @JoinColumn(name = "id"))
@Cascade(CascadeType.ALL)
@Column(name = "allowedValue")
@OrderBy("allowedValue ASC")
private Set<String> allowedValues;
@Transient
private Set<String> allowedValuesToAdd = new HashSet<String>();
@ManyToMany(mappedBy = "customPropertyDefinitions")
private Set<DocumentClassDefinition> definitionsUsedIn;
@ManyToMany(mappedBy = "custPropDefinitions")
private List<PropertyFolderStructure> propertyFolderStructure;
@Entity
@Indexed
@Table(name = "custom_properties")
@JsonIgnoreProperties(value = "stringValue")
public class CustomProperty extends CustomPropertyDefinition {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid",length = 40)
private String id;
@Column(name = "definition_id",length = 40)
private String definitionId;
@Field
@Column(name = "value")
private String stringValue;
@Transient
private String title;
@Transient
private Object value;
@IndexedEmbedded
@ManyToOne
@JoinColumn(name = "document_id",referencedColumnName = "id",updatable = true)
@JsonBackReference
private Document parentDocument;
感谢您的帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。