Implementing a connection request form in db scope without having predefined relationships in struture

I used SQL engines and some noSQL engines, as well as indexdb, and it could clear data across multiple tables without specifying foreign keys or anything else.

My question is: is it possible to make a query to clear data on object tables in Realm without defining any special relationships in the structure? To express myself better, I'm going to post code samples of what I want to achieve with Realm so you can help me.

Implementation using dexie, indexdb wrappers

db.quote_items.where('quote_id').equals(quote_id).then(function(a){ db.products.where('id').equals(quote_id.product_id).then(function(){ list.push({'id': a.id, 'product_name':a.product_name, 'product_code': a.product_code, 'quantity':a.quantity, 'tax':a.tax, 'unit_price':a.unit_price, 'val_tax':a.val_tax, 'discount_val':a.discount_val, 'gross_total':a.gross_total, 'details ':b.details }); }).catch(function (e) { console.log(e); alert("Sorry, Something went wrong"); }) }).catch(function (e) { console.log(e); alert("Sorry, Something went wrong");}) 

Mysql implementation

  SELECT quote_items.id AS id, quote_items.product_name AS product_name ...... FROM quote_items, products WHERE quote_items.quote_id = quote_id AND products.id = quotes_items.produc_id 

Expected implementation in Realm.io for Android

  RealmResults result = realm.where(quote_items.class) .equalTo("quote_id", quote_id).equalTo("quote.product_id", quote_id).equalTo("product.product_id", "quotes.itemkey").findAll() 
+5
source share
1 answer

While Realm is a NoSQL database, it still has a schema, so you cannot return multiple classes in a single query.

What you ask for can be resolved using an abstract superclass with common fields. This has not yet been implemented, but you can follow its progress here: https://github.com/realm/realm-java/issues/761

In addition, JOINS does not exist in Realm, since it is not a relational database, but more like a graph database. References to other objects are like references to objects. You can read more here: https://realm.io/docs/java/latest/#relationships

+4
source

All Articles