Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 91853 invoked from network); 26 Apr 2010 17:29:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Apr 2010 17:29:36 -0000 Received: (qmail 82316 invoked by uid 500); 26 Apr 2010 17:29:36 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 82283 invoked by uid 500); 26 Apr 2010 17:29:35 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 82275 invoked by uid 99); 26 Apr 2010 17:29:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 17:29:35 +0000 X-ASF-Spam-Status: No, hits=-0.3 required=10.0 tests=AWL,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jhodges@twitter.com designates 209.85.221.192 as permitted sender) Received: from [209.85.221.192] (HELO mail-qy0-f192.google.com) (209.85.221.192) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 17:29:31 +0000 Received: by qyk30 with SMTP id 30so15083146qyk.16 for ; Mon, 26 Apr 2010 10:29:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.127.5 with SMTP id e5mr1352996qas.1.1272302950078; Mon, 26 Apr 2010 10:29:10 -0700 (PDT) Received: by 10.224.60.212 with HTTP; Mon, 26 Apr 2010 10:29:09 -0700 (PDT) In-Reply-To: References: Date: Mon, 26 Apr 2010 10:29:09 -0700 Message-ID: Subject: Re: ORM in Cassandra? From: Jeff Hodges To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable There is, of course, also cassandra_object on the ruby side. I assume this thread has the implicit requirement of Java, though. -- Jeff On Mon, Apr 26, 2010 at 10:26 AM, Isaac Arias wrote: > On Apr 26, 2010, at 12:13 PM, Geoffry Roberts wrote: > >> Clearly Cassandra is not an RDBMS. =A0The intent of my Hibernate >> reference was to be more lyrical. =A0Sorry if that didn't come through. > >> Nonetheless, the need remains to relieve ourselves from excessive >> boilerplate coding. > > I agree with eliminating boilerplate code. Chris Shorrock wrote a > simple object mapper in Scala for his Cascal Cassandra client. You may > want to check out the wiki on GitHub > (http://wiki.github.com/shorrockin/cascal/). > > In my opinion, a mapping solution for Cassandra should be more like a > Template. Something that helps map (back and forth) rows to objects, > columns to properties, etc. Since the data model can vary so much > depending on data access patters, any overly structured approach that > prescribes a particular schema will be of limited use. > > If you're from the Java world, think of iBATIS vs. Hibernate. > > >> >> On Mon, Apr 26, 2010 at 9:00 AM, Ned Wolpert =3D > wrote: >> I don't think you are trying to convert Cassandra to a RDBMS with what = =3D > you want. The issue is that finding a way to map these objects to =3D > Cassandra in a meaningful way is hard. Its not as easy as saying 'do =3D > what hibernate does' simply because its not an RDBMS...but it is a =3D > reasonable and useful goal. I'm trying to accomplish this myself with =3D > the grails Cassandra plugin. >>=3D20 >>=3D20 >> On Fri, Apr 23, 2010 at 8:00 PM, aXqd wrote: >> On Sat, Apr 24, 2010 at 1:36 AM, Ned Wolpert =3D > wrote: >> > There is nothing wrong with what you are asking. Some work has been = =3D > done to >> > get an ORM layer ontop of cassandra, for example, with a RubyOnRails >> > project. I'm trying to simplify cassandra integration with grails =3D > with the >> > plugin I'm writing. >> > The problem is ORM solutions to date are wrapping a relational =3D > database. >> > (The 'R' in ORM) Cassandra isn't a relational database so it does =3D > not map >> > cleanly. >>=3D20 >> Thanks. I noticed this problem before. I just want to know, in the >> first place, what exactly is the right way to model relations in >> Cassandra(a no-relational database). >> So far, I still have those entities, and, without foreign keys, I use >> relational entities, which contains the IDs of both sides of >> relations. >> In some other cases, I just duplicate data, and maintain the relations >> manually by updating all the data in the same time. >>=3D20 >> Is this the right way to go? Or what I am doing is still trying to >> convert Cassandra to a RDBMS? >>=3D20 >> > >> > On Fri, Apr 23, 2010 at 1:29 AM, aXqd wrote: >> >> >> >> On Fri, Apr 23, 2010 at 3:03 PM, Benoit Perroud =3D > >> >> wrote: >> >> > I understand the question more like : Is there already a lib =3D > which >> >> > help to get rid of writing hardcoded and hard to maintain lines =3D > like : >> >> > >> >> > MyClass data; >> >> > String[] myFields =3D3D {"name", "label", ...} >> >> > List columns; >> >> > for (String field : myFields) { >> >> > =A0 =A0if (field =3D3D=3D3D "name") { >> >> > =A0 =A0 =A0 columns.add(new Column(field, data.getName())) >> >> > =A0 =A0} else if (field =3D3D=3D3D "label") { >> >> > =A0 =A0 =A0columns.add(new Column(field, data.getLabel())) >> >> > =A0 =A0} else ... >> >> > } >> >> > (same for loading (instanciating) automagically the object). >> >> >> >> Yes, I am talking about this question. >> >> >> >> > >> >> > Kind regards, >> >> > >> >> > Benoit. >> >> > >> >> > 2010/4/23 dir dir : >> >> >>>So maybe it's weird to combine ORM and Cassandra, right? Is =3D > there >> >> >>>anything we can take from ORM? >> >> >> >> >> >> Honestly I do not understand what is your question. It is clear = =3D > that >> >> >> you can not combine ORM such as Hibernate or iBATIS with =3D > Cassandra. >> >> >> Cassandra it self is not a RDBMS, so you will not map the table = =3D > into >> >> >> the object. >> >> >> >> >> >> Dir. >> >> >> >> Sorry, English is not my mother tongue. >> >> >> >> I do understand I cannot combine ORM with Cassandra, because they =3D > are >> >> totally different ways for building our data model. But I think =3D > there >> >> are still something can be learnt from ORM to make Cassandra easier = =3D > to >> >> use, just as what ORM did to RDBMS before. >> >> >> >> IMHO, domain model is still intact when we design our software, =3D > hence >> >> we need another way to map them to Cassandra's entity model. =3D > Relation >> >> does not just go away in this case, hence we need another way to >> >> express those relations and have a tool to set up Keyspace / >> >> ColumnFamily automatically as what django's SYNCDB does. >> >> >> >> According to my limited experience with Cassandra, now, we do more >> >> when we write, and less when we read/query. Hence I think the =3D > problem >> >> lies exactly in how we duplicate our data to do queries. >> >> >> >> Please correct me if I got these all wrong. >> >> >> >> >> >> >> >> On Fri, Apr 23, 2010 at 12:12 PM, aXqd =3D > wrote: >> >> >>> >> >> >>> Hi, all: >> >> >>> >> >> >>> I know many people regard O/R Mapping as rubbish. However it is >> >> >>> undeniable that ORM is quite easy to use in most simple cases, >> >> >>> Meanwhile Cassandra is well known as No-SQL solution, a.k.a. >> >> >>> No-Relational solution. >> >> >>> So maybe it's weird to combine ORM and Cassandra, right? Is =3D > there >> >> >>> anything we can take from ORM? >> >> >>> I just hate to write CRUD functions/Data layer for each object = =3D > in even >> >> >>> a disposable prototype program. >> >> >>> >> >> >>> Regards. >> >> >>> -Tian >> >> >> >> >> >> >> >> > >> > >> > >> > >> > -- >> > Virtually, Ned Wolpert >> > >> > "Settle thy studies, Faustus, and begin..." =A0 --Marlowe >> > >>=3D20 >>=3D20 >>=3D20 >> --=3D20 >> Virtually, Ned Wolpert >>=3D20 >> "Settle thy studies, Faustus, and begin..." =A0 --Marlowe >>=3D20 >