Date: Sun, 8 Apr 2012 09:02:39 -0700 (PDT) From: Antonio Salazar Cardozo To: liftweb@googlegroups.com Message-ID: <30353422.197.1333900959817.JavaMail.geo-discussion-forums@ynee1> In-Reply-To: <1333900252.50863.YahooMailClassic@web140204.mail.bf1.yahoo.com> References: <1333819594.61237.YahooMailClassic@web140209.mail.bf1.yahoo.com> <1333900252.50863.YahooMailClassic@web140204.mail.bf1.yahoo.com> Subject: Re: [Lift] ORM Query Newbie Question MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_195_30523615.1333900959815" ------=_Part_195_30523615.1333900959815 Content-Type: multipart/alternative; boundary="----=_Part_196_30256096.1333900959815" ------=_Part_196_30256096.1333900959815 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Daymo, While I can't help you (I don't use Lift's ORM), please keep in mind that people on this list have lives and volunteer their time here when they have it, and that you have not only given a mere day for people to try to help, but it has been a weekend day, and on Easter weekend to boot (for those who celebrate it). Try waiting patiently a few more days to see if someone comes along who has a deeper understanding of how the Lift ORM works and can give you appropriate advice. Thanks, Antonio On Sunday, April 8, 2012 11:50:52 AM UTC-4, Daymo Brooks wrote: > > No one's got an idea?? > > > --- On *Sat, 4/7/12, Daymo Brooks * wrote: > > > From: Daymo Brooks > Subject: [Lift] ORM Query Newbie Question > To: liftweb@googlegroups.com > Date: Saturday, April 7, 2012, 5:26 PM > > Hi there, > > I need some help with how to query the db with lift. I was trying to get > all terms and their summed up frequency count for all documents that were > created since midnight with the following sql: > > // gives me the ids of today since midnight > val doc = Document.findAll(By(Document.createdAt, new > org.joda.time.DateMidnight().toDate)).map(_.id) > > Then I tried naively to apply the values to another query: > > DB.runQuery("select t.name, sum(frequency) from Term t " + > "join DocumentTerm dt on dt.word_id = t.id " + > "join Document d on dt.document_id = d.id " + > "where d.id in (?) group by t.name, dt.frequency order by > dt.frequency desc", > List(doc:_*)) > > But this gives me a "java.io.NotSerializableException: > net.liftweb.util.FatLazy"... > > My Db schema looks like this: > > Document: > ########################################### > id | title | author | created_at | etc ... > ########################################### > > DocumentTerm: > ############################################################## > id | term_id | document_id | frequency | created_at | etc ... > ############################################################## > > Term: > ################################# > id | name | created_at | etc ... > ################################# > > Any help is appreciated. > Thanks > D. > > ------=_Part_196_30256096.1333900959815 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Daymo,
While I can't help you (I don't use Lift's ORM), please keep = in mind that people on this list have lives and volunteer their time here w= hen they have it, and that you have not only given a mere day for people to= try to help, but it has been a weekend day, and on Easter weekend to boot = (for those who celebrate it). Try waiting patiently a few more days to see = if someone comes along who has a deeper understanding of how the Lift ORM w= orks and can give you appropriate advice.
Thanks,
Anton= io

On Sunday, April 8, 2012 11:50:52 AM UTC-4, Daymo Brooks wrote:
No one's got an idea?? 


--- On Sat, 4/7/12, Daymo Brooks= <lift_daym= o...@yahoo.com> wrote:

From: Daymo Broo= ks <lift_daymo= @yahoo.com>
Subject: [Lift] ORM Query Newbie Question
To: liftweb@googlegro= ups.com
Date: Saturday, April 7, 2012, 5:26 PM

Hi there,

I need some help with how to query the db with lif= t. I was trying to get all terms and their summed up frequency count for al= l documents that were created since midnight with the following sql:

// gives me the ids of today since midnight
val doc =3D Document.findAll(By(Document.crea= tedAt, new org.joda.time.DateMidnight().toDate)).map(_.id)

Then I tried naively to apply the values to another query:<= /div>

DB.runQuery("select t.name, sum(frequency) from Term t " +
            "joi= n DocumentTerm dt on dt.word_id =3D t.id " +
  &nb= sp;         "join Document d on dt.document_id =3D d.id " +
           = "where d.id in (?) group by = t.name, dt.frequency order = by dt.frequency desc",
&nb= sp;           List(doc:_*))

But this gives me a "java.io.NotSerializableException: net.lift= web.util.FatLazy"... 

My Db schema looks l= ike this:

Document:
###########################################<= /div>
id | title | author | created_at = | etc ...
################= ###########################

DocumentTerm:<= /font>
##########################= ####################################
id | term_id | document_id | frequency | created_at |= etc ... 
###########= ###################################################
<= div>
Term:
#####= ############################
id | name | created_at | etc ...
#################################

Any help is appreciated.
Thanks
D.

------=_Part_196_30256096.1333900959815-- ------=_Part_195_30523615.1333900959815--