[Lift] Re: 1.1-SNAPSHOT and Snippet problems?
Anyways, I was definitely screwed up ... forcing maven to actually do what it was supposed to fixed my problem. Thanks for the pointer Marius. ~Thomas On Sat, Oct 3, 2009 at 5:39 PM, Thomas Rampelberg pyronic...@gmail.com wrote: I thought that I'd just updated all the versions . from that stack trace, how do you tell which version lift-util is? On Sat, Oct 3, 2009 at 1:39 PM, marius d. marius.dan...@gmail.com wrote: What verions of lift are you using? It appears that lift-util is a different version than lift ? Br's, Marius On Oct 3, 11:11 pm, Thomas Rampelberg pyronic...@gmail.com wrote: I just synced up to main this morning and now whenever I try and use one of my snippets, I'm getting the traceback below. Any hints on what I'm doing wrong? The snippet in question is just the basic Util.in/Util.out that the tutorial has you write. div class=column span-17 last lift:Util.in lift:bind name=content / /lift:Util.in lift:Util.out h3 class=alt You must be logged in to view this content. lift:menu.item name=LoginLogin/lift:menu.item /h3 /lift:Util.out /div class Util { def in(html: NodeSeq) = if (User.loggedIn_?) html else NodeSeq.Empty def out(html: NodeSeq) = if (!User.loggedIn_?) html else NodeSeq.Empty } Message: java.lang.AbstractMethodError: net.liftweb.util.Helpers$.tryo(Lscala/PartialFunction;Lscala/Function0;)Lnet/liftweb/util/Box; net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$instantiateOrRedirect(LiftSession.scala:862) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1$$anonfun$apply$41.apply(LiftSession.scala:911) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1$$anonfun$apply$41.apply(LiftSession.scala:911) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:911) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:911) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$findSnippetInstance(LiftSession.scala:910) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1$$anonfun$17.apply(LiftSession.scala:967) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1$$anonfun$17.apply(LiftSession.scala:967) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1.apply(LiftSession.scala:967) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1.apply(LiftSession.scala:966) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession.locateAndCacheSnippet$1(LiftSession.scala:966) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48$$anonfun$apply$50.apply(LiftSession.scala:978) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48$$anonfun$apply$50.apply(LiftSession.scala:976) net.liftweb.util.EmptyBox.openOr(Box.scala:372) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48.apply(LiftSession.scala:976) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48.apply(LiftSession.scala:976) net.liftweb.util.EmptyBox.openOr(Box.scala:372) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45.apply(LiftSession.scala:975) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45.apply(LiftSession.scala:975) net.liftweb.http.S$.doSnippet(S.scala:1586) net.liftweb.http.LiftSession$$anonfun$18.apply(LiftSession.scala:973) net.liftweb.http.LiftSession$$anonfun$18.apply(LiftSession.scala:972) net.liftweb.util.Full.map(Box.scala:330) net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$processSnippet(LiftSession.scala:972) net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing$1.apply(LiftSession.scala:1073) net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing$1.apply(LiftSession.scala:1061) net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:30) net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:76) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58$$anonfun$apply$59.apply(LiftSession.scala:1094) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58$$anonfun$apply$59.apply(LiftSession.scala:1094) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65
[Lift] Re: MappedStringForeignKey and Schemifier
I had some issues getting string foreign keys working that required changes to MetaMapper (because of how it handles autogenerated primary keys). That said, Here's some code that'll fix the issue you're currently having: class StringForeignKey[T:Mapper[T],O:KeyedMapper[String, O]]( override val fieldOwner: T, foreign: = KeyedMetaMapper[String, O], maxLen: Int) extends MappedStringForeignKey[T,O](fieldOwner, foreign, maxLen) { override def fieldCreatorString(dbType: DriverType, colName: String): String = colName + VARCHAR( + maxLen + ) } class InfoHashForeignKey[T:Mapper[T],O:KeyedMapper[String, O]]( override val fieldOwner: T, foreign: = KeyedMetaMapper[String, O]) extends StringForeignKey[T,O](fieldOwner, foreign, 20) If you'd like to take a look at my models and how everything's hooked together, I've got the source up on github at http://github.com/pyronicide/swarmstat . On Sat, Oct 3, 2009 at 3:00 AM, Peter Robinett pe...@bubblefoundry.com wrote: I have a model, Node, with a string index. I have another model, Packet, which has a MappedStringForeignKey to Node. Unfortunately, Schemifier doesn't seem to respect the MappedStringForeignKey type and creates a BIGINT column in the packets table, as you can see from its output: INFO - CREATE TABLE packets (temp DOUBLE , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , mac BIGINT UNSIGNED , dt DATETIME , mah DOUBLE , lux DOUBLE , rssi DOUBLE) ENGINE = InnoDB INFO - ALTER TABLE packets ADD CONSTRAINT packets_PK PRIMARY KEY(id) INFO - CREATE INDEX packets_mac ON packets ( mac ) Is this a bug? I can override fieldCreatorString for the foreign key but I don't think I should have to. This is with 1.1-SNAPSHOT. Peter And the relevant parts of my models: class Node extends KeyedMapper[String, Node] { def getSingleton = Node /* MAC address as primary key */ def primaryKeyField = mac object mac extends MappedStringIndex(this, 17) with IndexedField [String] { override def dbDisplay_? = true override lazy val defaultValue = randomString(maxLen) /* allow user-defined primary key */ override def writePermission_? = true override def dbAutogenerated_? = false private var myDirty = false override def dirty_? = myDirty override def dirty_?(b : Boolean) = { myDirty = b; super.dirty_?(b) } override def fieldCreatorString(dbType: DriverType, colName: String): String = colName+ CHAR(+maxLen+) NOT NULL } } class Packet extends LongKeyedMapper[Packet] with IdPK { def getSingleton = Packet object node extends MappedStringForeignKey(this, Node, 17) { // Change the default behavior to add a database index for this column. override def dbIndexed_? = true override def dbColumnName = mac } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] 1.1-SNAPSHOT and Snippet problems?
I just synced up to main this morning and now whenever I try and use one of my snippets, I'm getting the traceback below. Any hints on what I'm doing wrong? The snippet in question is just the basic Util.in/Util.out that the tutorial has you write. div class=column span-17 last lift:Util.in lift:bind name=content / /lift:Util.in lift:Util.out h3 class=alt You must be logged in to view this content. lift:menu.item name=LoginLogin/lift:menu.item /h3 /lift:Util.out /div class Util { def in(html: NodeSeq) = if (User.loggedIn_?) html else NodeSeq.Empty def out(html: NodeSeq) = if (!User.loggedIn_?) html else NodeSeq.Empty } Message: java.lang.AbstractMethodError: net.liftweb.util.Helpers$.tryo(Lscala/PartialFunction;Lscala/Function0;)Lnet/liftweb/util/Box; net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$instantiateOrRedirect(LiftSession.scala:862) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1$$anonfun$apply$41.apply(LiftSession.scala:911) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1$$anonfun$apply$41.apply(LiftSession.scala:911) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:911) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:911) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$findSnippetInstance(LiftSession.scala:910) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1$$anonfun$17.apply(LiftSession.scala:967) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1$$anonfun$17.apply(LiftSession.scala:967) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1.apply(LiftSession.scala:967) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1.apply(LiftSession.scala:966) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession.locateAndCacheSnippet$1(LiftSession.scala:966) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48$$anonfun$apply$50.apply(LiftSession.scala:978) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48$$anonfun$apply$50.apply(LiftSession.scala:976) net.liftweb.util.EmptyBox.openOr(Box.scala:372) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48.apply(LiftSession.scala:976) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48.apply(LiftSession.scala:976) net.liftweb.util.EmptyBox.openOr(Box.scala:372) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45.apply(LiftSession.scala:975) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45.apply(LiftSession.scala:975) net.liftweb.http.S$.doSnippet(S.scala:1586) net.liftweb.http.LiftSession$$anonfun$18.apply(LiftSession.scala:973) net.liftweb.http.LiftSession$$anonfun$18.apply(LiftSession.scala:972) net.liftweb.util.Full.map(Box.scala:330) net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$processSnippet(LiftSession.scala:972) net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing$1.apply(LiftSession.scala:1073) net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing$1.apply(LiftSession.scala:1061) net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:30) net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:76) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58$$anonfun$apply$59.apply(LiftSession.scala:1094) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58$$anonfun$apply$59.apply(LiftSession.scala:1094) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) net.liftweb.http.S$.setVars(S.scala:1414) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58.apply(LiftSession.scala:1093) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58.apply(LiftSession.scala:1093) net.liftweb.http.S$.withAttrs(S.scala:1433) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57.apply(LiftSession.scala:1092) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57.apply(LiftSession.scala:1092) net.liftweb.http.S$.doSnippet(S.scala:1586)
[Lift] Re: 1.1-SNAPSHOT and Snippet problems?
I thought that I'd just updated all the versions . from that stack trace, how do you tell which version lift-util is? On Sat, Oct 3, 2009 at 1:39 PM, marius d. marius.dan...@gmail.com wrote: What verions of lift are you using? It appears that lift-util is a different version than lift ? Br's, Marius On Oct 3, 11:11 pm, Thomas Rampelberg pyronic...@gmail.com wrote: I just synced up to main this morning and now whenever I try and use one of my snippets, I'm getting the traceback below. Any hints on what I'm doing wrong? The snippet in question is just the basic Util.in/Util.out that the tutorial has you write. div class=column span-17 last lift:Util.in lift:bind name=content / /lift:Util.in lift:Util.out h3 class=alt You must be logged in to view this content. lift:menu.item name=LoginLogin/lift:menu.item /h3 /lift:Util.out /div class Util { def in(html: NodeSeq) = if (User.loggedIn_?) html else NodeSeq.Empty def out(html: NodeSeq) = if (!User.loggedIn_?) html else NodeSeq.Empty } Message: java.lang.AbstractMethodError: net.liftweb.util.Helpers$.tryo(Lscala/PartialFunction;Lscala/Function0;)Lnet/liftweb/util/Box; net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$instantiateOrRedirect(LiftSession.scala:862) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1$$anonfun$apply$41.apply(LiftSession.scala:911) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1$$anonfun$apply$41.apply(LiftSession.scala:911) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:911) net.liftweb.http.LiftSession$$anonfun$net$liftweb$http$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:911) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$findSnippetInstance(LiftSession.scala:910) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1$$anonfun$17.apply(LiftSession.scala:967) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1$$anonfun$17.apply(LiftSession.scala:967) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1.apply(LiftSession.scala:967) net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet$1$1.apply(LiftSession.scala:966) net.liftweb.util.EmptyBox.or(Box.scala:374) net.liftweb.http.LiftSession.locateAndCacheSnippet$1(LiftSession.scala:966) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48$$anonfun$apply$50.apply(LiftSession.scala:978) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48$$anonfun$apply$50.apply(LiftSession.scala:976) net.liftweb.util.EmptyBox.openOr(Box.scala:372) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48.apply(LiftSession.scala:976) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45$$anonfun$apply$48.apply(LiftSession.scala:976) net.liftweb.util.EmptyBox.openOr(Box.scala:372) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45.apply(LiftSession.scala:975) net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$45.apply(LiftSession.scala:975) net.liftweb.http.S$.doSnippet(S.scala:1586) net.liftweb.http.LiftSession$$anonfun$18.apply(LiftSession.scala:973) net.liftweb.http.LiftSession$$anonfun$18.apply(LiftSession.scala:972) net.liftweb.util.Full.map(Box.scala:330) net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$processSnippet(LiftSession.scala:972) net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing$1.apply(LiftSession.scala:1073) net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing$1.apply(LiftSession.scala:1061) net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:30) net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:76) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58$$anonfun$apply$59.apply(LiftSession.scala:1094) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58$$anonfun$apply$59.apply(LiftSession.scala:1094) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) net.liftweb.http.S$.setVars(S.scala:1414) net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$$anonfun$apply$57$$anonfun$apply$58.apply(LiftSession.scala:1093) net.liftweb.http.LiftSession$$anonfun
[Lift] Re: XML - JSON converter?
This is really great, making XML as easy to generate as JSON was something I thought I'd never see. On Fri, Sep 25, 2009 at 7:27 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Sep 25, 2009 at 6:19 AM, Timothy Perrett timo...@getintheloop.eu wrote: Sorry Dave, but the brevity of your reply left me somewhat confused... yes it makes sense to do that or yes, we'll be replacing everything with lift-json ? Eventually, we'll be integrating all of lift-json into the existing Lift JavaScript infrastructure. Cheers, Tim On 25 Sep 2009, at 14:07, David Pollak wrote: On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett timo...@getintheloop.eu wrote: Are there any plans to supersede the JsObj stuff with what is in lift- json ? Seems like that would make a lot more sense, no? Yes. Cheers, Tim On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote: On 24/09/09 2:34 PM, Timothy Perrett wrote: Nice stuff Joni! Indeed. That this module gets lots of love shows. Everything nice and tidy in a neat little package. Did I mention that it's test cases serve as docs too? /Indrajit Cheers, Tim On 24 Sep 2009, at 08:24, Joni Freeman wrote: Hi, There is now improved XML support in lift master. See a short section in README: http://github.com/dpp/liftweb/tree/master/lift-json/ and some executable examples: http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala Cheers Joni On Sep 2, 9:27 pm, harryhhar...@gmail.com wrote: Is there anything built into lift that will doXML- JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Struggling with mapping a list of objects
I'd suggest a one to many relationship with a foreign key. For something off the top of my head (no guarantees this'll actually work): class Person extends LongKeyedMapper[Person] with IdPK { def getSingleton = Person object skills extends MappedOneToMany(Skills, Skills.person) with Owned[Skills] } object Person extends LongKeyedMetaMapper[Person] class Skill extends LongKeyedMapper[Skill] with IdPK { def getSingleton = Skill object definition extends MappedPoliteString(this, 128) object person extends MappedLongForeignKey(this, Person) } object Skill extends LongKeyedMetaMapper[Skill] Then, if you wanted to add something to a Person's skills: person.states += Skill.create.description() person.states.save There's actually a document on the wiki about this: http://wiki.github.com/dpp/liftweb/how-to-work-with-one-to-many-relationships On Thu, Sep 24, 2009 at 1:09 PM, ben b...@primrose.org.uk wrote: If I was in Java/Hibernate mode, I guess I'd tag it as one-to-many and have a Skill object, which maps back to the Person object via a key ... just not sure how to do that with Lift's OR mapper. I keep having mental blocks when it comes to lift scala :( I guess if I was doing it in Java, I would have something like : @Entity public class Person { �...@id �...@generatedvalue private Long id; �...@onetomany �...@joincolumn( name=id) private ListSkill skills; } @Entity public class Skill { �...@id �...@generatedvalue private Long id; private String name; } Can anyone lift'ify / scal'ify that for me ?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Struggling with mapping a list of objects
You can do this with Mapper using a ManyToMany relationship. To make sure we're talking about the same thing, let me try and explain. With ManyToMany, you can do both Person.find(By(Person.name, name)).map(_.skills) as well as Skills.find(By(Skill.description, description)).map(_.people) and get lists either way. There's no wiki article for ManyToMany alas, but it does work. If you'd like to see an example, check out: http://github.com/pyronicide/swarmstat/tree/master/src/main/scala/org/saunter/swarmstat/model/ The Torrent and Tracker models both have ManyToMany fields relating to each other. On Thu, Sep 24, 2009 at 1:46 PM, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: harryh har...@gmail.com writes: But I cannot for the life of me work out of to store a list of objects What do you expect the underlying type in the database table to be? Normally this would be done with a separate table with a foreign key (MappedLongForeignKey) back to the users table. I think what the OP wanted was to be able to follow this in the other direction. Ie have a collection skills on users that lists all the skills that map back to this particular user. Updating the collection would populate the skills table with correct foreign keys. Most Java ORMs supports this.but I guess mapper was never billed as a full ORM, more an ActiveRecord kind of thing /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Mapping a read only db view with mapper.
You can .. override def writePermission_? = false (On a per-field basis) On Thu, Sep 24, 2009 at 2:52 PM, andythedestroyer andythedestro...@gmail.com wrote: This may be obvious but I am having trouble setting this up. I need to map a database view which isn't a problem because I just set it up as I would any other table. Can I specify in the code that the class and object mapping the view is read only and cannot be modified? It doesn't seem like I can and I want to verify this is the case. Thanks, Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Mapping a read only db view with mapper.
David, just to make sure that I know what I'm talking about, if you set writePermission_? to false for each field, you could emulate the behavior? On Thu, Sep 24, 2009 at 4:41 PM, David Pollak feeder.of.the.be...@gmail.com wrote: There's no read-only support for tables in mapper at this time. Sorry. On Thu, Sep 24, 2009 at 2:52 PM, andythedestroyer andythedestro...@gmail.com wrote: This may be obvious but I am having trouble setting this up. I need to map a database view which isn't a problem because I just set it up as I would any other table. Can I specify in the code that the class and object mapping the view is read only and cannot be modified? It doesn't seem like I can and I want to verify this is the case. Thanks, Andrew -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Autogenerated PKs and MetaMapper
You'd think I could read the only sticky post without getting linked to it! Let's see if I can clearly explain my use cases. The simplest to explain is that I'd like to use UUIDs as the primary key of a table. To do this, I've done something like this: class MappedStringPrimaryKey[T:Mapper[T]] ( override val fieldOwner: T, override val maxLen: Int) extends MappedStringIndex[T](fieldOwner, maxLen) with LifecycleCallbacks { override def writePermission_? = true override def dbDisplay_? = true override def dbAutogenerated_? = false override def fieldCreatorString( dbType: DriverType, colName: String): String = colName+ CHAR(+maxLen+) NOT NULL } class UUIDPrimaryKey[T:Mapper[T]] ( override val fieldOwner: T) extends MappedStringPrimaryKey[T]( fieldOwner, 16) { override def dbDisplay_? = false override def dbIndexFieldIndicatesSaved_? = (i_is_! != defaultValue) override lazy val defaultValue = { val uuid = UUID.randomUUID.toString.replaceAll(-, ).elements (new URLCodec).decode(uuid.zip(uuid).map(x=%+x._1+x._2).mkString) } } The first problem is that while MappedStringIndex is setup as a primary key, the field is required to be NOT NULL. Secondly, the dbIndexFieldIndicatesSaved_? ends up being a little non-intuitive (I would have expected it to be part of MappedStringIndex as well). Also, with this use case, I had to make a couple modifications to MetaMapper itself. The first one: @@ -884,7 +891,7 @@ trait MetaMapper[A:Mapper[A]] extends BaseMetaMapper with Mapper[A] { mappedColumnInfo(colName) = mf mappedColumns(colName) = v } - if (mf.dbPrimaryKey_? mf.dbAutogenerated_?) { + if (mf.dbPrimaryKey_?) { indexMap = Full(MapperRules.quoteColumnName(mf.dbColumnName)) // Full(v.getName.toLowerCase) } Without indexMap being defined, if I do something along these lines: Field.save Field.save (save twice in succession) I get a duplicate key value error because the save call is trying to insert the object again. The second modification that I made to MetaMapper: @@ -600,10 +603,13 @@ trait MetaMapper[A:Mapper[A]] extends BaseMetaMapper with Mapper[A] { try { if (rs.next) { val meta = rs.getMetaData - toSave.runSafe { -findApplier(indexMap.open_!, rs.getObject(1)) match { - case Full(ap) = ap.apply(toSave, rs.getObject(1)) - case _ = + if (indexedField(toSave).map(_.dbAutogenerated_?) + getOrElse false) { +toSave.runSafe { + findApplier(indexMap.open_!, rs.getObject(1)) match { +case Full(ap) = ap.apply(toSave, rs.getObject(1)) +case _ = + } } } !rs.next If I don't do this patch, when the object is saved, the value gets reset from foobar to 1. The database stores it correctly, it's simply the object that has its attributes wrong. My other use case is documented below. I'm trying to set the value of the primary key before submitting. At this point, i_is_! is always different than the defaultValue and without using the afterSave hook, the object tries to update instead of insert itself. While this isn't a big issue, it just seems like there must be a better solution to the problem. Overall, if some general kind of solution for both of these problems (updates to MappedStringIndex perhaps) made it in, I'd be ecstatic. On Tue, Sep 22, 2009 at 8:36 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Thomas, We, as a rule, do not accept patches. For a complete discussion, please see: http://groups.google.com/group/liftweb/browse_frm/thread/0c7a97cbf60780f0?hl=en# The current state of mapper's primary key support is sub-optimal. There have been a couple of discussions of the issues on-list. I am hoping to spend some time on this issue on Thursday. If you've got specific requirements or specific tests, please post them. Thanks, David On Mon, Sep 21, 2009 at 9:33 PM, Thomas Rampelberg pyronic...@gmail.com wrote: I've been working at getting MetaMapper to work with primary keys that aren't auto-generated (or longs). Towards this end, I've got a patch for MetaMapper.scala that I'd like to get in. Who could I talk about the process for that? In addition, as part of implementing the functionality, I ran into some interesting problems. The most interesting one has to do with dbIndexFieldIndicatesSaved_?. The default (i_is_! != defaultValue) works great for cases where you're using the default value for the actual primary key. Unfortunately, if you use something like this when you're actively setting the primary key yourself there are some unfortunate side effects (nothing gets saved to the database). To get around this, I'm doing something along these lines: class
[Lift] Non-autogenerated primary keys
I'm in the process of working with an application that uses UUIDs for the primary keys of all my tables. After updating to 1.1-M5, I started getting java.lang.NullPointerException: Trying to open an empty Box excptions. After tracking down what the problem was, it seems that checkin for supporting non-autogenerated primary keys broke them. By using this patch, they appear to be working again: @@ -884,7 +884,7 @@ trait MetaMapper[A:Mapper[A]] extends BaseMetaMapper with M mappedColumnInfo(colName) = mf mappedColumns(colName) = v } - if (mf.dbPrimaryKey_? mf.dbAutogenerated_?) { + if (mf.dbPrimaryKey_?) { indexMap = Full(MapperRules.quoteColumnName (mf.dbColumnName)) // Fu } Is there something that I'm breaking here or is this a valid patch? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Mapper and Record outside of Lift
Is there a way to use Mapper or Record and the database layer without lift? I have a swing project that could benefit from this API, but I don't want to drag the entire lift framework into the project. On the same not does is work with H2? Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Dynamic Image generation / HttpServletResponse
On Mar 26, 12:14 am, David Pollak feeder.of.the.be...@gmail.com wrote: Here's some code to serve an image out of the database. ... Does this help? Yes it does. I've got it working now. Thanks, Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Dynamic Image generation / HttpServletResponse
Hi, I want to dynamically generate images (actually a graph). I could write a seperate servlet for this but I'd like easy access to the Mapper classes and the logged in User etc so would prefer to write it as a method in lift. Is there a hook for this? I suppose I essentially want direct acccess to the httpresponse. I found some discussion of this here: http://groups.google.com/group/liftweb/browse_thread/thread/9d6f61f69a20765/d98a32e89e87d317 but I don't know if it was ever implemented, and need some pointers/ documentation if it has been. thanks for any advice, Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Lists in snippets / Snippet Failure
Thank you, It is working now. I am very happy. Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Lists in snippets / Snippet Failure
I am trying to render a list of items using bind without success. I have reduced it to a clean liftweb project with the following in HelloWorld.scala def fruits(xhtml:NodeSeq) = { List(apple, orange, banana).flatMap( fruit = bind(f, xhtml, name - fruit) ) } And this in index.html lift:helloWorld.fruits f:name/ br / /lift:helloWorld.fruits The snippet is not rendered and I get this in the logs: WARN - Snippet Failure: SnippetFailure(/ - ParsePath(List (index),,true,false),Full(helloWorld.fruits),Method Not Found) What am I missing? I assume there is a problem with the fruits method signature. Do snippet methods havve to return NodeSeq? thanks for any advice. Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Design patterns for porting this application to Lift
I've been working on a project to create an application to help run my RPG games. The current version is a single user Swing application (for the referee). It helps run battles and controls all the combatants in the battle. I have been considering moving this application to a web application for several reason, among them it would allow online play and the players and referee to share the same information. The swing application is available here: http://www.exnebula.org/vcc It is currently implemented as an Tracker Actor that control the state of the battle. The UI send messages to this actor that in response updates one or more pieces of information, then notifies observer actors (currently just the UI). Lift looks like an interesting alternative, specially because of it's Ajax/Comet support. But I'm new to Lift and I'm trying to figure out the best design practices to use. My initial idea is to do the following: 1) The battle control windows would be composed of: a) a table containing a summary of the combatant status and their order in the battle; b) a div for each combatant, these will contain relevant information, and only one will be visible at a time (based on context information, or selection on the table) c) In several positions on both the div and table are link that fire actions on the tracker object (change the order of battle, use a power, reset something) and some simple forms for information like applying damage or changing text information In general all pieces of information in the page would be identified as with ID making it possible to change any small part of the page. 2) Every link or post form a form will fire a message on the tracker. The tracker changes values and send updates to the observers, the idea here is send a series of updates to individual part of the page (and not update the entire page) 3) Occasionally an action may requires a more complex input like sending a popup/overlay form I have a felling that the general design should work, but I have several questions with the Lift way of doing things: 1) Comet seems to focus on a specific region of the page. But it partialUpdate allows me to update just a part of the area. If so can I ask: a. Can I have several links/buttons use the same Comet channel? b. Can I update several parts of the page on a single partialUpdate? 2) If I use a comet actor for each part will that mean that I have several connections pooling the server, one for each comet part? 3) How do I overlay or popup without redrawing the whole page? If that is possible? 4) Is this the correct pattern? Full rendering seem to me to be overkill, but I think it's not necessary.. Thanks for any hints and ideas, Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Help on getting Eclipse/Maven/Lift working
I followed the tutorial here on this page: http://scala-blogs.org/2007/12/dynamic-web-applications-with-lift-and.html And was pleased to see the application come out so quickly. However I have a question. As I save the file on Eclipse they don't get picked up by Jetty. I need to do a mvn install on the pom.xml of the eclipse project. And clearing the project on eclipse broke mvn install, until I did a mvn clean then a mvn install. The tutorial references to incremental compiling. I've been working with Scala on Eclipse and got around most troubles myself. But the Eclipse+Maven+Jetty+Lift is confusing for me. I have a set of questions: a) How to get code compile incrementally on eclipse, picked up by jetty? b) How do I debug the application from eclipse? c) Is there a way to have it all running under eclipse? I know these question may seem dumb, but I'm not finding good information on google. Is there a Developing for Lift using Eclipse for Dummies arround? The best I found what this tutorial. Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Packaging lift application for distribution
I'm starting to look at lift as an alternative to a Scala+Swing application I have. I'll most likely embed Jetty anyway but after playing a little with Maven a question came to my mind: How to I package a Lift application to be run standalone on a desktop. My application comes with all the jars it needs (the two scala libs) and a couple of scripts to fire it off. I wonder if there is a way to build something like this for a Lift application. Something that makes easy for someone that is a regular user to get a simple one machine install done with a couple of clicks. Any hints? Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---