2016-12-29 6 views
0

こんにちは皆さん、もう一度、 私はorient dbで2つのクラスに参加しようとしています。 結果として2つのクラスのすべてのレコードとプロパティが必要です。 ここでは参加しないので、orient dbで私に提案してください。 orientdbの結合にエッジを使う方法も教えてください。OrientDB:OrientDBに参加する -

+1

を照会することができますがbeacuseは、グラフデータベースで参加します。この[ドキュメンテーション](http://orientdb.com/docs/2.2/Tutorial-Working-with-graphs.html) –

+0

を見ると、あなたのニーズをよりよく説明できるようにいくつかの例を追加できますか? thnx –

+0

は、私はこの 苦情テーブルのようなレコードが含ま牽引テーブルを持っている: RID | CLASS |国| ID | Sub_issue |苦情|製品| Date_rece |投稿| SUB_PRODUCT SubIssue表: RID | CLASSを| Sub_issue_i | Sub_issue_name 両方のテーブルに参加したい – Kunal

答えて

1

これはかなり簡単です。あなたのマスターテーブル。

私はactiveorient、ルビーorientDB ORMを使って説明します:

DB.create_class :basiswert 
=> Basiswert 

DB.create_class :stock 
=> Stock 

apple = Basiswert.create name: 'Apple', kind: 'silicon valley company' 
=> #<Basiswert:0x0000000241ca38 @metadata={"type"=>"d", "class"=>"basiswert", "version"=>1, "fieldTypes"=>nil, "cluster"=>53, "record"=>0}, @d=nil, @attributes={"name"=>"Apple", "kind"=>"silicon valley company", "created_at"=>Fri, 24 Feb 2017 16:55:37 +0100}> 
apple_stock = Stock.create symbol: 'AAPL', :price => 200, basiswert: apple 
=> #<Stock:0x00000003ecb370 @metadata={"type"=>"d", "class"=>"stock", "version"=>1, "fieldTypes"=>"basiswert=x", "cluster"=>57, "record"=>0}, @d=nil, @attributes={"symbol"=>"AAPL", "price"=>200, "basiswert"=>"#53:0", "created_at"=>Fri, 24 Feb 2017 16:55:43 +0100}> 
apple_stock.basiswert 
=> #<Basiswert:0x0000000241ca38 @metadata={"type"=>"d", "class"=>"basiswert", "version"=>1, "fieldTypes"=>nil, "cluster"=>53, "record"=>0}, @d=nil, @attributes={"name"=>"Apple", "kind"=>"silicon valley company", "created_at"=>Fri, 24 Feb 2017 16:55:37 +0100}> 

代わりにあなただけの "#53:0" を入れ«»リンゴstock.basiswertに

をこれが一方向であります結合(または単純なリンク)。 明らかに何かが存在しない東洋では株式クラスに

Stock.where basiswert: apple-stock.rid 

またはプレーンOrientDB-SQLで

select from stock where basiswert= "#53:0"