我被困在下面的问题中。任何人都可以就如何解决这个问题分享一些想法或建议 我试图解决这个问题从过去1周开始。
ExternalTaxController.java
ExternalTax externalTax = externalTaxManager.getExternalTaxById(id);
Map<Long, Long> propIdToOnegIdMap=externalTaxManager.mapPropertiesToOnegIds(externalTax.getPropertyIds());
在上面,externalTax.getPropertyIds()有时会返回超过1000条记录。 如果记录超过1000,那么抛出的错误将如下所示,
org.hibernate.exception.SQLGrammarException: could not execute query
ORA-01795: maximum number of expressions in a list is 1000.
ExternalTax.java(Bean类):
@ElementCollection(fetch = FetchType.EAGER)
@Fetch(FetchMode.SUBSELECT)
@JoinTable(
name="OMH_EXTERNAL_TAX_PROP_XREF",
joinColumns = @JoinColumn(name="OMH_EXTERNAL_TAX_ID")
)
@Column(name="OMH_PROPERTY_ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "OMH_EXTERNAL_TAX_PROP_XREF_SEQUENCE")
@SequenceGenerator(name = "OMH_EXTERNAL_TAX_PROP_XREF_SEQUENCE", sequenceName = "OMH_EXTERNAL_TAX_PROP_XREF_SEQ")
@CollectionId(
columns = @Column(name="OMH_EXTERNAL_TAX_PROP_XREF_ID"),
type = @Type(type="long"),
generator = "OMH_EXTERNAL_TAX_PROP_XREF_SEQUENCE"
)
private Collection<Long> propertyIds = new ArrayList<Long>();
public Collection<Long> getPropertyIds() {
HashSet<Long> retVal = new HashSet<Long>();
retVal.addAll(propertyIds);
return retVal;
}
我不知道这里是如何完成映射的。任何人都可以就如何解决这个问题分享一些想法或建议。