jaysvcutil failing with TypeError: Cannot read property 'schemas' of undefined - jaydata

I am trying to generate the model from an existing OData service through jaysvcutil and am getting:
[...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:385
throw err;
^
TypeError: Cannot read property 'schemas' of undefined
at Metadata.processMetadata ([...]\node_modules\jaydata-dynamic-metadata\lib\metadata.js:353:35)
at requestData ([...]\node_modules\jaydata-dynamic-metadata\lib\metadataHandler.js:46:42)
at [...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:382:13
at IncomingMessage.<anonymous> ([...]\node_modules\jaydata-odatajs\lib\odata\net.js:179:21)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:921:12)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
I tried to condense the domain model into something really simple, so my current $metadata looks like this:
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="data">
<EntityType Name="Product">
<Key>
<PropertyRef Name="ProductId"/>
</Key>
<Property Name="ProductId" Type="Edm.Int64" Nullable="false"/>
<Property Name="ProductNo" Type="Edm.String" Nullable="true"/>
<Property Name="LifeTime" Type="Edm.Int64" Nullable="false"/>
<Property Name="Capacity" Type="Edm.Int64" Nullable="false"/>
<Property Name="PackingSize" Type="Edm.Int64" Nullable="false"/>
<Property Name="CreationTime" Type="Edm.DateTime" Nullable="false"/>
<Property Name="ModificationTime" Type="Edm.DateTime" Nullable="false"/>
</EntityType>
</Schema>
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="Namespace">
<EntityContainer Name="DomainData" m:IsDefaultEntityContainer="true">
<EntitySet Name="Product" EntityType="data.Product"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
This is an existing WCF DataService based OData provider using OData V1 and I am not able to change that - so please do not recommend updating the provider to V4.
Any help would be appreciated.

As per feedback from the JayData team:
JayData supports OData v4, as there have been multiple breaking changes in both OData and DataJS since v1.
and also
JayData 1.3.7 supports v2 and v3, but it does not support TypeScript and Angular 2.
I will therefore be looking at alternatives, presumably breezejs.

Related

Receive bytea with asp .net api

First of all, sorry for the probable English mistakes
I created a table in my postgresql database using the entity framework.
In edmx in the creation section I passed as bytea, however in the mapping I used binary (primitive type use is necessary).
<EntityType Name="styleexample">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="example" Type="String" MaxLength="40" />
<Property Name="example1" Type="Binary" />
<Property Name="example2" Type="DateTime" />
</EntityType>
<EntityType Name="styleexample">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int4" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="example" Type="varchar" MaxLength="40" />
<Property Name="example1" Type="bytea" />
<Property Name="example2" Type="timestamp" />
</EntityType>
The table was created with the correct typing
In the entity I referenced the column as byte []
In the column I inserted the base64 string of a png image, but in the service when I return the value is different from what I inserted
My response is also byte[]
It works. However, it returns the incorrect value. Is there a different way to do this process?
I solved the issue by adding to the service
var example1 = new StreamReader(new MemoryStream(estilo.example1));
var example1Stream = example1 .ReadToEnd();

SAP UI5 Smart Table Json Data Usage

I've got a problem about usage of json data in smart table object. I'm getting json data from web service and I set that json data any other variable. How can I bind that variable to EntitySet ? In fact I haven't got any json file in my application folders.
Here is the application sample link that I used for my project;
https://sapui5.netweaver.ondemand.com/explored.html#/sample/sap.m.tutorial.walkthrough.27/code
Here is the my metadata.xml codes;
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="UserModel" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Users">
<Key>
<PropertyRef Name="TKID"/>
<PropertyRef Name="TKTX"/>
</Key>
<Property Name="TKTX" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="TKID" Type="Edm.Int16" Nullable="false"/>
</EntityType>
</Schema>
<Schema Namespace="ODataWebV2.Northwind.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="UserModelEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Users" EntityType="UserModel.Users"/>
<!--How can I bind my json data incoming from webservice ?-->
</EntityContainer>
</Schema>
</edmx:DataServices>
Thanks for your help.

Tables for entities with boolean fields not created

i tried to switch a connection pool in GlassFish 4 from MySQL to Derby. I am using Spring-Data-JPA with JPA/Hibernate. The problem is that not all tables are created with the derby pool. The tables for entities which have at least one boolean field are not created.
I found nothing in the log files. :(
My applicationContext.xml:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:annotation-config />
<context:component-scan base-package="project" />
<bean
id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property
name="jndiName"
value="serverPool" />
<property
name="lookupOnStartup"
value="false" />
<property
name="proxyInterface"
value="javax.sql.DataSource" />
</bean>
<bean
id="hibernateJpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property
name="generateDdl"
value="true" />
<property
name="showSql"
value="true" />
</bean>
<bean
id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property
name="dataSource"
ref="dataSource" />
<property
name="jpaVendorAdapter"
ref="hibernateJpaVendorAdapter" />
<property
name="packagesToScan"
value="project.model.entity" />
</bean>
<bean
id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property
name="entityManagerFactory"
ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<jpa:repositories base-package="project.model.repository" />
</beans>
If the problem is only creating boolean columns, try to use #Column to add DDL statement to the Derby database, I know this decrease portability but it will solve the problem. the property is named columnDefinition. http://docs.oracle.com/javaee/6/api/javax/persistence/Column.html
Also I think there need to be something in the log, try to increase the log level.
Okay, i found the solution: I connected to the derby database and executed the command values syscs_util.syscs_get_database_property( 'DataDictionaryVersion' ); The result was 10.1, but version 10.7 is necessary for boolean support. I then renamed the database name in the derby pool inside GlassFish (its by default sun-appserv-samples) and now all tables are created. With the new database the command gave me version 10.9.

specify a database schema for activiti-5.12.1 tables

I am going to use activiti-5.12.1, in my project.
here is the activiti.cfg.xml file:
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >
<property name="databaseType" value="postgres" />
<property name="jdbcUrl" value="jdbc:postgresql://project:5432/MYPROJECT" />
<property name="jdbcDriver" value="org.postgresql.Driver" />
<property name="jdbcUsername" value="me" />
<property name="jdbcPassword" value="you" />
<property name="databaseSchemaUpdate" value="false" />
<property name="jobExecutorActivate" value="false" />
<property name="history" value="full" />
<property name="customPreVariableTypes">
<list>
<ref bean="activitiScriptNodeType" />
<ref bean="activitiScriptNodeListType" />
</list>
</property>
<property name="mailServerHost" value="mail.my-corp.com" />
<property name="mailServerPort" value="5025" />
</bean>
</beans>
I want to create activiti database on my own, by using the scripts which are available in activiti-engine-5.12.1.jar.
By default, the tables are created in public schema, but I want them to be in another schema like mySchema for example.
my questioin is how can I manage this, besides, how can I specify this in activiti.cfg.xml, to inform activiti engine api that activiti tables are in mySchema?
I am using MySQL database for activiti, so i have got some configuration like this to creat my own schema name :
<property name="databaseType" value="mysql" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti" />
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUsername" value="root" />
<property name="jdbcPassword" value="root" />
So as you using postgresql, i am not quite sure about whether the following code will work for you or not :
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >
<property name="databaseType" value="postgres" />
<property name="jdbcUrl" value="jdbc:postgresql://project:5432/MYPROJECT/activiti" />
<property name="jdbcDriver" value="org.postgresql.Driver" />
<property name="jdbcUsername" value="me" />
<property name="jdbcPassword" value="you" />
<property name="databaseSchemaUpdate" value="false" />
<property name="jobExecutorActivate" value="false" />
<property name="history" value="full" />
<property name="customPreVariableTypes">
<list>
<ref bean="activitiScriptNodeType" />
<ref bean="activitiScriptNodeListType" />
</list>
</property>
<property name="mailServerHost" value="mail.my-corp.com" />
<property name="mailServerPort" value="5025" />
</bean>
Before deploying `activiti with new changes, mke sure that your database has the schema created.
Try changing the database's type to your database's name or "postgresql".
If you are using spring the below property helps:
spring.activiti.databaseSchema=MY_SCHEMA

Entity Framework: 0..1-to-many foreign key constraint not recognized?

I am using EF4 to map a DB schema to an object model; I initially generated the EDMX from the database but have been editing the XML directly (trying to leave the SSDL the same while changing the CSDL/MSL to approximate the object model I want). The database contains, among many other things, a couple tables with a (0..)1-to-many constraint via foreign key like so:
go
create table Options (
KitNodeID int primary key foreign key references KitNodes (KitNodeID),
[SKUID] int null foreign key (SKUID) references SKUs (SKUID)
)
go
create table Upgrades (
UpgradeID int identity (1, 1) primary key not null,
[Name] nvarchar(50) not null,
DefaultOptionID int null references Options (KitNodeID)
)
The relevant sections in the EDMX look like this:
[...]
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="DModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
<EntityContainer Name="DModelStoreContainer">
<AssociationSet Name="FK__Upgrades__Defaul__70DDC3D8" Association="DModel.Store.FK__Upgrades__Defaul__70DDC3D8">
<End Role="Options" EntitySet="Options" />
<End Role="Upgrades" EntitySet="Upgrades" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Upgrades">
<Key>
<PropertyRef Name="UpgradeID" />
</Key>
<Property Name="UpgradeID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
<Property Name="DefaultOptionID" Type="int" />
</EntityType>
<Association Name="FK__Upgrades__Defaul__70DDC3D8">
<End Role="Options" Type="DModel.Store.Options" Multiplicity="0..1" />
<End Role="Upgrades" Type="DModel.Store.Upgrades" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Options">
<PropertyRef Name="KitNodeID" />
</Principal>
<Dependent Role="Upgrades">
<PropertyRef Name="DefaultOptionID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="DModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="DEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="Upgrades" EntityType="DModel.Upgrade" />
<AssociationSet Name="Upgrade_DefaultOption" Association="DModel.Upgrade_DefaultOption">
<End Role="Options" EntitySet="Options" />
<End Role="Upgrades" EntitySet="Upgrades" />
</AssociationSet>
</EntityContainer>
<Association Name="Upgrade_DefaultOption">
<End Role="Options" Type="DModel.Option" Multiplicity="0..1" />
<End Role="Upgrades" Type="DModel.Upgrade" Multiplicity="*" />
</Association>
<EntityType Name="Upgrade">
<Key>
<PropertyRef Name="UpgradeID" />
</Key>
<Property Name="UpgradeID" Nullable="false" annotation:StoreGeneratedPattern="Identity" Type="Int32" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
<NavigationProperty Name="DefaultOption" Relationship="DModel.Upgrade_DefaultOption" FromRole="Upgrades" ToRole="Options" />
<NavigationProperty Name="OptInOptions" Relationship="DModel.OptInOptions" FromRole="Upgrades" ToRole="Options" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="DModelStoreContainer" CdmEntityContainer="DEntities">
<EntitySetMapping Name="Upgrades"><EntityTypeMapping TypeName="DModel.Upgrade"><MappingFragment StoreEntitySet="Upgrades">
<ScalarProperty Name="UpgradeID" ColumnName="UpgradeID" />
<ScalarProperty Name="Name" ColumnName="Name" />
</MappingFragment></EntityTypeMapping></EntitySetMapping>
<AssociationSetMapping Name="Upgrade_DefaultOption" TypeName="DModel.Upgrade_DefaultOption" StoreEntitySet="FK__Upgrades__Defaul__70DDC3D8">
<EndProperty Name="Upgrades">
<ScalarProperty Name="UpgradeID" ColumnName="UpgradeID"/>
</EndProperty>
<EndProperty Name="Options">
<ScalarProperty Name="KitNodeID" ColumnName="DefaultOptionID"/>
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
It will generate code, but when I try to use it I get an "Error 2007: The Table 'FK_Upgrades_Defaul__70DDC3D8' specified as part of this MSL does not exist in MetadataWorkspace." It looks like it can't find the underlying foreign key constraint that the SSDL is supposed to use, but I do see one with that name in the database.
Really, I feel I don't have a very good understanding of how this kind of mapping is supposed to work in general - is a foreign key constraint in the database really treated as an "associationset"? - but this is the closest I can work out. I don't know if anyone could diagnose the problem from the info I've given, but any pointers on where to look? I've tried various things like changing the StoreEntitySet to point to Options, etc. but they just result in different errors.
Try changing how you define your foreign key, see: How do I create a foreign key in SQL Server?
You will probably have to delete and recreate you model.