Closed DimitarPetrov closed 2 years ago
Hello,
I have encountered a problem when trying to query fields of a @Embeddable ComplexType. The setup is as follows:
@Embeddable
I have an @Embeddable class like this:
@Embeddable public class Link { @Column(name = "title", length = Integer.MAX_VALUE) private String title; @Column(name = "description", length = Integer.MAX_VALUE) private String description; @Column(name = "url", length = Integer.MAX_VALUE) private String url; @Column(name = "extensions", length = Integer.MAX_VALUE) private String extensions; }
And I use it in the @Entity class like this:
@Entity
@ElementCollection @CollectionTable(name = "links", joinColumns = @JoinColumn(name = "package_id")) private List<Link> links;
When I get OData $metadata everything looks perfectly fine:
"package": { ... "links": { "$Type": "com.sap.cloud.cmp.ord.service.Link", "$Collection": true }, ... }
"Link": { "$Kind": "ComplexType", "extensions": { "$Type": "Edm.String", "$MaxLength": 2147483647 }, "description": { "$Type": "Edm.String", "$MaxLength": 2147483647 }, "title": { "$Type": "Edm.String", "$MaxLength": 2147483647 }, "url": { "$Type": "Edm.String", "$MaxLength": 2147483647 } },
However when I execute the following query:
/packages?$filter=links/any(d:startswith(d/title,%27More%27))&$format=JSON
I got:
{ "error": { "code": null, "message": "OData Library: An exception without message text was thrown." } }
In order for query by Complex Type to work, an Entity for each Complex type (Embeddable in JPA) should be created as well.
Hello,
I have encountered a problem when trying to query fields of a
@Embeddable
ComplexType. The setup is as follows:I have an
@Embeddable
class like this:And I use it in the
@Entity
class like this:When I get OData $metadata everything looks perfectly fine:
However when I execute the following query:
I got: