I am trying to run a query similar to
/contacts?$filter=LastModified gt 2022-03-19T12:50:54.219Z
To the following entity:
<EntityType Name="Entity" Abstract="true">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Guid" Nullable="false" />
<Property Name="ConcurrencyToken" Type="Edm.Guid" />
<Property Name="LastModified" Type="Edm.DateTimeOffset" />
</EntityType
The query seems to work but it is not filtering anything for me. I have also tried a lot of alternatives but nothing works. Think this is an issue with the server?
Related
Say, for such an entity defined below, what is the correct response for GET "serviceRoot/entity(1)/nav"? Assuming entity with id 1 has valid values, but its stored key for the 'nav' reference is null.
<EntityType Name="entityType">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Nullable="false" Type="Edm.Integer"/>
<Property Name="name" Nullable="false" Type="Edm.String"/>
<NavigationProperty Name="nav" Nullable="true" Type="this.navType"/>
</EntityType>
<EntityType Name="navType">
<Key>
<PropertyRef Name="navId"/>
</Key>
<Property Name="navId" Nullable="false" Type="Edm.Integer"/>
<Property Name="name" Nullable="false" Type="Edm.String"/>
</EntityType>
<EntityContainer Name="Container">
<EntitySet EntityType="navType" Name="navSet"/>
<EntitySet EntityType="entityType" Name="entity">
<NavigationPropertyBinding Path="nav" Target="this.navSet"/>
</EntitySet>
</EntityContainer>
204 No Content is the correct response according to the OData v4 specification.
If the relationship terminates on a single entity, the response MUST be the format-specific representation of the related single entity. If no entity is related, the service returns 204 No Content.
Source: Requesting Related Entities
Good guess!
I'm trying to binding oData to my List using mock server.
My metadata.xml is
<edmx:Edmx
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
Version="1.0">
<edmx:DataServices m:DataServiceVersion="2.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="GWSAMPLE_BASIC" xml:lang="en">
<EntityType Name="Equipment" BaseType="GWSAMPLE_BASIC.EquipmentBO">
</EntityType>
<EntityContainer Name="DefaultContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="EquipmentSet" EntityType="GWSAMPLE_BASIC.Equipment"/>
</EntityContainer>
<EntityType Name="EquipmentBO" BaseType="GWSAMPLE_BASIC.BaseEntityBO">
<Property Name="code" Type="Edm.String" Nullable="true"></Property>
</EntityType>
<EntityType Name="BaseEntityBO" Abstract="true">
<Key>
<PropertyRef Name="id"></PropertyRef>
</Key>
<Property Name="id" Type="Edm.String"/>
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Equipment.json:
[
{
"id": "1"
},
{
"id": "2"
},
{
"id": "3"
}
]
But it appear like this:
When I add Key:
<EntityType Name="Equipment" BaseType="GWSAMPLE_BASIC.EquipmentBO">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.String"/>
</EntityType>
It works fine:
Also, I found createKey will also produce an error:
ODataModel-dbg.js:2005 Uncaught TypeError: Cannot read property 'propertyRef' of undefined
this.getModel().createKey("EquipmentSet", {
id : "111"
});
So my question is, can I fix this without changing my oData metadata? Key is already defined in BaseEntityBO.
This question is a duplicate of openui5 issue #951.
Unfortunately datajs, the OData library we are using in SAPUI5, does not support derived entity types. As it is a rarely used feature, there currently are no plans to support this.
It seems this problem can only be solved from backend service.
I am new to OData/Olingo. I am trying out the tutorial at Olingo (http://olingo.apache.org/doc/odata4/tutorials/read/tutorial_read.html), and have currently completed chapter 2. However, When I tried validating my service through the OData Validator (http://services.odata.org/validation/) it fails stating: Error retrieving validation results
Here is what I get when I hit: /ODataDemo/Service.svc/
<app:service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:metadata="http://docs.oasis-open.org/odata/ns/metadata" metadata:context="$metadata">
<app:workspace>
<atom:title>NTTD.OData.Container</atom:title>
<app:collection href="Properties">
<atom:title>Properties</atom:title>
</app:collection>
</app:workspace>
</app:service>
Here is the metadata at /ODataDemo/NttdService.svc/$metadata
<?xml version='1.0' encoding='UTF-8'?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="NTTD.OData">
<EntityType Name="Property">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Int32"/>
<Property Name="Name" Type="Edm.String"/>
<Property Name="Location" Type="Edm.String"/>
</EntityType>
<EntityContainer Name="Container">
<EntitySet Name="Properties" EntityType="NTTD.OData.Property"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Please help. Where are things going wrong?
In my NHibernate mapping file I've had two classes mapped where one classes property had the same name as another classes name (Group).
<class name="Machine" table="SpisMaszyn" dynamic-update="true">
<cache usage ="read-write"/>
<id name="ID" column="ID" type="int">
<generator class="native" />
</id>
<property column="NazwaMaszyny" name="MachineName" />
<property column="Grupa" name="Group" />
</class>
<class name="Group" table="SpisGrup" dynamic-update="true">
<cache usage ="read-write"/>
<id name="ID" column="ID" type="int">
<generator class="native" />
</id>
<property name="Name" column="Nazwa" />
</class>
I don't know why but if the names are the same the code wasn't working properly. In my ModelState I was getting null value for Group. I'm not sure what can be causing it.
Do you have any idea what might cause this ?
The mapping is correct. A fact that some property and some other class name share same name, is not any issue for NHibernate. Check the underlying column content. Run profiler to see the SQL Query and assure that returned data are there...
original assumpiton that many-to-one is required removed
I have a property of IDictionary type with key type and value type other than string. Most of the examples given on the internet and in Spring.Net uses string as one of the types.
Here are the config settings:
<property name="DirectoryServiceAgents">
<dictionary key-type="OM.ServiceTier.DTO.Transients.AuthenticationDomainIdentifier, OM.ServiceTier" value-type="OM.ServiceTier.Services.User.Internal.IDirectoryServiceAgent, OM.ServiceTier">
<entry>
<key>
<object type="OM.ServiceTier.DTO.Transients.AuthenticationDomainIdentifier, OM.ServiceTier">
<constructor-arg type="string" value="${activeDirectory.Domain}"/>
</object>
</key>
<value>
<object type="OM.ServiceTier.Services.User.Internal.DirectoryServiceAgent, OM.ServiceTier">
<property name="LDAPPath" value="${activeDirectory.LDAPPath}"/>
<property name="LDAPContainer" value="${activeDirectory.LDAPContainer}"/>
<property name="UserName" value="${activeDirectory.UserName}"/>
<property name="Password" value="${activeDirectory.Password}"/>
</object>
</value>
</entry>
</dictionary>
</property>
I am getting the following ConfigurationErrorException:
Error creating context 'spring.root': The element 'http://www.springframework.net:value' cannot contain child element 'http://www.springframework.net:object' because the parent element's content model is text only.
Is there something wrong in my config?
I'm not sure if the dictionary configuration supports inline object definitions for keys and/or values. It's not mentioned in the documentation on setting collection values.
Could you try this configuration:
<object>
<!-- snip -->
<property name="DirectoryServiceAgents">
<dictionary
key-type="OM.ServiceTier.DTO.Transients.AuthenticationDomainIdentifier, OM.ServiceTier"
value-type="OM.ServiceTier.Services.User.Internal.IDirectoryServiceAgent, OM.ServiceTier">
<entry key-ref="authDomainId" value-ref="serviceAgent"/>
</dictionary>
</property>
<!-- snip -->
</object>
<object id="authDomainId"
type="OM.ServiceTier.DTO.Transients.AuthenticationDomainIdentifier, OM.ServiceTier">
<constructor-arg type="string" value="${activeDirectory.Domain}"/>
</object>
<object id="serviceAgent"
type="OM.ServiceTier.Services.User.Internal.DirectoryServiceAgent, OM.ServiceTier">
<property name="LDAPPath" value="${activeDirectory.LDAPPath}"/>
<property name="LDAPContainer" value="${activeDirectory.LDAPContainer}"/>
<property name="UserName" value="${activeDirectory.UserName}"/>
<property name="Password" value="${activeDirectory.Password}"/>
</object>