I need to add metadata to a vertex class.
I want to store the canonical name of the java class in the Vertex class definition as a metadata so later I could ask for it to instantiate and hydrate an object.
Are there any way to do that?
You can define CUSTOM metadata by using ALTER CLASS command. Example.
ALTER CLASS Post CUSTOM javaClass="com.my.Post"
So you can retrieve that custom property through API or SQL.
For more information look at the official documentation about it: http://orientdb.com/docs/last/SQL-Alter-Class.html.
Related
I want Filter functionality in server Side (Spring Data JPA).
Which is going to use in UI-Grid (AngularJs)
I Have a class Product,Vendor, etc I want to search byId,ByProductName,ByProductCode,..etc. For All Class.
I Want To create a Generic Class For This which will take Modal className, Column Name, Value, etc.
How I will Create this Generic Class And how to implement the filtering for my Rest Api.
Please Give some Idea about this.
It won't be as generic as you would like to, but you can achieve this kind of result quite easily using QueryBeExmaple - https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#query-by-example
I am a new learner on OrientDB and have this question about schema. How to define a schema-full mode for a new class -say person class? Similarly how to define the schema-hybrid mode -using sql?
Somehow I can't make out this from the documentation.
Thanks,
DBuserN
The schema-full mode is controlled on a per-class basis and can be enabled or disabled using the STRICTMODE keyword. For example:
alter class Person strictmode=true;
For reference
http://orientdb.com/docs/2.0/orientdb.wiki/SQL-Alter-Class.html
Schema-full Enables strict-mode at a class-level and sets all fields as mandatory.
Schema-less Enables classes with no properties. Default is non-strict-mode, meaning that records can have arbitrary fields.
Schema-hybrid Enables classes with some fields, but allows records to define custom fields. This is also sometimes called schema-mixed.
You can define schema, as you create the structure of your DB. So if you define properties on a class it will be schema-full. A class without properties and it will be schema-less etc...
You can fine more information on official documentation.
Hope it helps.
I have extended Entity Framework autogenerated classes with custom partial classes and added several new properties and business login into it. I need to populate those properties any time objects are either materialized from the database or created from scratch without a database contact.
Can I use or is it advised to use the New() method inside the class for that? (I know there is an event ObjectContext.ObjectMaterialized as well).
As an example, in my partial class i have a property
Public Property Employees As List(Of Employee)
and I want to instantiate that list somewhere (where?).
You could just write a default constructor for those entities where you set default property values. Notice Entity Framework doesn't create constructors for you, so they can easily be added in partial classes.
I am trying to learn zend framework, and managed to get through the whole quickstart tutorial they have. However, there is something that I simply can not understand, and was hoping somebody can help me with.
In the tutorial, you create a db-table class, a mapper, and a model. I read the documentation, and understand the purpose of the db-table class (define table, relations, create/fetch rows). When you query the db-table class, you'll get an object of class db-table-row, which you can use to manipulate a specific record in the db.
However, I can not understand why the tutorial would have me create a mapper and a model, nor the reason for defining getter/setter methods in the model (shouldn't those be provided by db-table-row?)
Even in the controller, they created an object from the model class and the mapper class, then they completely ignored the model object, and just used the mapper object.
Is there any need at all to have those 3 classes? what different purpose does each fulfill? As far as I can see, all I need is the db-table class, am I right?
When you query the db-table class, you'll get an object of class
db-table-row
No you get db-table-rowset instead which is collection of row .
secondly
you don't even need db-table class
$dbTable = new Zend_Db_Table('tableName');
But since db-table class allow you to define relationship between other tables inside it (business logic) hence became important .
db-table-row became important when the entity is important for e.g User Table . Inside your custom db-table-row for user you can add method getTopics(); which return rowset for all the topics created by theat user hence fruther helping with business logic.
I have an entity in core data called Location. Inside this I have a few fields, such as date. But, I would also like to save a class object in it that I created called Annotation. What type of attribute would I use for this, since it is a custom class object that I created?
Location (object)
|__ Date
|__ Annotation (MKAnnotation protocol)
You have two options:
If your Annotation class conforms to the NSCoding protocol (or if you're willing to write an NSValueTransformer to convert your custom class to an NSData instance, you can use a transformable attribute in your Core Data entity. Core Data will use the designated NSValueTransformer to automatically serialize/deserialize your Annotation instance for you.
You can create an Annotation entity in your Core Data model. You'll have to write your own code to assign a CLLocationCoordinate2D to the entity. You would probably create a persistent backing using two doubles and then write setters/accessors for the CLLocationCoordinate2D.
The advantage of (1) is that it's easier (if your class conforms to NSCoding). The advantage of (2) is that you can query against the data within the entity, even if using SQLite persistent stores. If you use (1), the data is opaque to the SQLite query engine, so you won't be able to query against it with a SQLite backend.
it would be easier to add the class as a core data class then you could just have a relationship between the two classes as a one-to-one relation. you can however use the type binary data as an attribute type and store whatever data you want in there. ( i use this to store c structs sometimes ) You just need to use the NSData class to wrap your object and set the property.