[Lift] Re: JPA and Record

2008-11-26 Thread Derek Chen-Becker
Well, I don't necessarily think that's a bad idea. In fact, I was thinking
about that as well last night. I'm really not familiar at all with how
complex it would be to write a compiler plugin, or how easy that would be to
integrate with Maven. What I was thinking of, at least, was combining a
compiler plugin and somehow transposing JPA annotations that appear on a
Record field onto a generated getter/setter pair. Thus:

class MyEntry extends Record[MyEntry] {
  @Column{val name = my_name}
  object name extends StringField(this,100)
}

would become:

class MyEntry extends Record[MyEntry] {
  object name extends StringField(this,100)

  @Column{val name = my_name}
  def getName() = name.value
  def setName(newVal : String) = name.set(newVal)
}

Is there anyone here who can comment on how viable that is, or should I ask
on the Scala list?

Thanks,

Derek

On Wed, Nov 26, 2008 at 1:00 AM, Mateusz Fiołka [EMAIL PROTECTED]wrote:

 I'm not sure if my idea is good but I think that wrong ideas are better the
 none so I post it. Some time ago there was a discussion about using scala
 compiler plugins to simplify lift users experience. I'm not sure what are
 your opinions about using it in lift, however I guess it could help alot in
 this case. Class extending Record could be specially treated by compiler and
 thus record objects could be specified in a very simple way. I know there is
 added dependency to the build process but imho it's much better then using
 code generators because it is one of the compilation phases and it must be
 run for the code to compile.




 On Tue, Nov 25, 2008 at 10:29 PM, Kris Nuttycombe 
 [EMAIL PROTECTED] wrote:

 Ah, right, so if you're using property-based inference anyway, it's not an
 issue. Never mind.


 On Tue, Nov 25, 2008 at 2:26 PM, Derek Chen-Becker [EMAIL PROTECTED]
  wrote:

 On Tue, Nov 25, 2008 at 1:40 PM, Kris Nuttycombe 
 [EMAIL PROTECTED] wrote:

 Remember that additionally in JPA, a bare unannotated field on an object
 will be inferred as persistent unless annotated @Transient (or, in java,
 unless it is declared with the transient modifier)


 My reading of the JPA spec, section 2.1.1 is that persistent state is
 either field-based or property-based, and is determined by where you place
 your annotations. The @Transient is required for either method where you
 have a field or property that isn't supposed to be part of the state.

 Derek







 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Two items on Record

2008-11-26 Thread Derek Chen-Becker
I'm in the process of playing with the Record code so I have some examples
for the book. I've run into two small issues:


   1. I'm writing a custom Field type (DecimalField) and it seems like the
   valueCouldNotBeSet var should be set if I can't parse the decimal string
   that a user hands me in setFromString. That var, however, is marked
   private[record], so I can't actually access it. Could you provide an
   accessor or make that var protected so that I can set it?
   2. I'm getting a really weird type error if I try to override the
   fieldOrder def on MetaRecord:

[WARNING]
/home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
error: type mismatch;
[WARNING]  found   :
List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
type _10 : String with java.util.Calendar : java.lang.Comparable[_1]
forSome { type _1 : java.lang.String with java.util.Calendar :
java.io.Serializable } with java.io.Serializable }{def defaultValue:
java.lang.Comparable[_12] forSome { type _12 : java.lang.String with
java.util.Calendar : java.io.Serializable } with java.io.Serializable}]
[WARNING]  required:
List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
type _$3 }]
[WARNING]   override def fieldOrder = date :: description :: Nil

Here's my code:

class Entry extends Record[Entry] {
  def meta = EntryMeta

  object date extends DateTimeField(this)

  object description extends StringField(this, 100)
}

object EntryMeta extends Entry with MetaRecord[Entry] {
  override def fieldOrder = date :: description :: Nil
}

Am I making a dumb mistake here, or is there some other weirdness going on?

Thanks,

Derek

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Two items on Record

2008-11-26 Thread David Pollak
On Wed, Nov 26, 2008 at 7:34 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 I'm in the process of playing with the Record code so I have some examples
 for the book. I've run into two small issues:


1. I'm writing a custom Field type (DecimalField) and it seems like the
valueCouldNotBeSet var should be set if I can't parse the decimal string
that a user hands me in setFromString. That var, however, is marked
private[record], so I can't actually access it. Could you provide an
accessor or make that var protected so that I can set it?
2. I'm getting a really weird type error if I try to override the
fieldOrder def on MetaRecord:


Try this:

object EntryMeta extends Entry with MetaRecord[Entry] {
  override def fieldOrder = List(date, description)
}



1.

 [WARNING]
 /home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
 error: type mismatch;
 [WARNING]  found   :
 List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
 type _10 : String with java.util.Calendar : java.lang.Comparable[_1]
 forSome { type _1 : java.lang.String with java.util.Calendar :
 java.io.Serializable } with java.io.Serializable }{def defaultValue:
 java.lang.Comparable[_12] forSome { type _12 : java.lang.String with
 java.util.Calendar : java.io.Serializable } with java.io.Serializable}]
 [WARNING]  required:
 List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
 type _$3 }]
 [WARNING]   override def fieldOrder = date :: description :: Nil

 Here's my code:

 class Entry extends Record[Entry] {
   def meta = EntryMeta

   object date extends DateTimeField(this)

   object description extends StringField(this, 100)
 }

 object EntryMeta extends Entry with MetaRecord[Entry] {
   override def fieldOrder = date :: description :: Nil
 }

 Am I making a dumb mistake here, or is there some other weirdness going on?

 Thanks,

 Derek

 



-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Two items on Record

2008-11-26 Thread Marius



On Nov 26, 5:34 pm, Derek Chen-Becker [EMAIL PROTECTED] wrote:
 I'm in the process of playing with the Record code so I have some examples
 for the book. I've run into two small issues:

    1. I'm writing a custom Field type (DecimalField) and it seems like the
    valueCouldNotBeSet var should be set if I can't parse the decimal string
    that a user hands me in setFromString. That var, however, is marked
    private[record], so I can't actually access it. Could you provide an
    accessor or make that var protected so that I can set it?

valueCouldNoBeSet is used in the validation. I mean in order to
validate a field that field needs to have first a value of that type.
Since we can not always convert from a String to a Number we have this
cases where we can not set the value. Validation will generate an
error messag rturned by Field.errorMessage (probably needs renaming).

I'm aware that you may already know that, just wanted to express this
again.

The bottom line, you are right :) ... I'll provide access to this.



    2. I'm getting a really weird type error if I try to override the
    fieldOrder def on MetaRecord:

 [WARNING]
 /home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
 error: type mismatch;
 [WARNING]  found   :
 List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
 type _10 : String with java.util.Calendar : java.lang.Comparable[_1]
 forSome { type _1 : java.lang.String with java.util.Calendar :
 java.io.Serializable } with java.io.Serializable }{def defaultValue:
 java.lang.Comparable[_12] forSome { type _12 : java.lang.String with
 java.util.Calendar : java.io.Serializable } with java.io.Serializable}]
 [WARNING]  required:
 List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
 type _$3 }]
 [WARNING]   override def fieldOrder = date :: description :: Nil

 Here's my code:

 class Entry extends Record[Entry] {
   def meta = EntryMeta

   object date extends DateTimeField(this)

   object description extends StringField(this, 100)

 }

 object EntryMeta extends Entry with MetaRecord[Entry] {
   override def fieldOrder = date :: description :: Nil

 }

 Am I making a dumb mistake here, or is there some other weirdness going on?

 Thanks,

 Derek
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift Record and Object Oriented DB

2008-11-26 Thread Marius

I believe so. Record/Field currently provide necessary abstraction and
server side validation structure. JDBC implementation for Record stuff
it's on its way ... and of course one could write a DB4O
implementation for it.

I think it would be sweet to have such integration in the future but I
don't think it would be part of lift core (... but I've been wrong
before :) ...).

Br's,
Marius

On Nov 26, 3:48 am, Erick Fleming [EMAIL PROTECTED] wrote:
 I'm real interested in using Lift with OODBs (currently using DB4O and
 looking and Berkeley).

 Is the new Record/Field stuff (I'm ignorant about Rails) concussive for this
 type of data access or if it more for relational structures?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift Record and Object Oriented DB

2008-11-26 Thread David Pollak
On Wed, Nov 26, 2008 at 10:28 AM, Marius [EMAIL PROTECTED] wrote:


 I believe so. Record/Field currently provide necessary abstraction and
 server side validation structure. JDBC implementation for Record stuff
 it's on its way ... and of course one could write a DB4O
 implementation for it.

 I think it would be sweet to have such integration in the future but I
 don't think it would be part of lift core (... but I've been wrong
 before :) ...).


We will not be providing support for DB4O or BDB in the core Lift packages
because of licensing issues.  I'd be very interested in someone else
providing external support for both.





 Br's,
 Marius

 On Nov 26, 3:48 am, Erick Fleming [EMAIL PROTECTED] wrote:
  I'm real interested in using Lift with OODBs (currently using DB4O and
  looking and Berkeley).
 
  Is the new Record/Field stuff (I'm ignorant about Rails) concussive for
 this
  type of data access or if it more for relational structures?
 



-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift Record and Object Oriented DB

2008-11-26 Thread Tim Perrett

IMO, there is a wider issue here at large:

Should we be providing a way / central repo for lift plugins (read:  
modules) that are part of lift proper? Kind of like a lift-extras  
repo? Possibly host it on scala-tools?

Cheers

Tim

On 26 Nov 2008, at 18:32, David Pollak wrote:

 We will not be providing support for DB4O or BDB in the core Lift  
 packages because of licensing issues.  I'd be very interested in  
 someone else providing external support for both.

Tim Perrett
print application architect

t: +44 (0) 78144 34 791
e: [EMAIL PROTECTED]
w: timperrett.com






--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Two items on Record

2008-11-26 Thread Marius

please do a git pull

On Nov 26, 7:56 pm, Marius [EMAIL PROTECTED] wrote:
 On Nov 26, 5:34 pm, Derek Chen-Becker [EMAIL PROTECTED] wrote:

  I'm in the process of playing with the Record code so I have some examples
  for the book. I've run into two small issues:

     1. I'm writing a custom Field type (DecimalField) and it seems like the
     valueCouldNotBeSet var should be set if I can't parse the decimal string
     that a user hands me in setFromString. That var, however, is marked
     private[record], so I can't actually access it. Could you provide an
     accessor or make that var protected so that I can set it?

 valueCouldNoBeSet is used in the validation. I mean in order to
 validate a field that field needs to have first a value of that type.
 Since we can not always convert from a String to a Number we have this
 cases where we can not set the value. Validation will generate an
 error messag rturned by Field.errorMessage (probably needs renaming).

 I'm aware that you may already know that, just wanted to express this
 again.

 The bottom line, you are right :) ... I'll provide access to this.

     2. I'm getting a really weird type error if I try to override the
     fieldOrder def on MetaRecord:

  [WARNING]
  /home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
  error: type mismatch;
  [WARNING]  found   :
  List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
  type _10 : String with java.util.Calendar : java.lang.Comparable[_1]
  forSome { type _1 : java.lang.String with java.util.Calendar :
  java.io.Serializable } with java.io.Serializable }{def defaultValue:
  java.lang.Comparable[_12] forSome { type _12 : java.lang.String with
  java.util.Calendar : java.io.Serializable } with java.io.Serializable}]
  [WARNING]  required:
  List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
  type _$3 }]
  [WARNING]   override def fieldOrder = date :: description :: Nil

  Here's my code:

  class Entry extends Record[Entry] {
    def meta = EntryMeta

    object date extends DateTimeField(this)

    object description extends StringField(this, 100)

  }

  object EntryMeta extends Entry with MetaRecord[Entry] {
    override def fieldOrder = date :: description :: Nil

  }

  Am I making a dumb mistake here, or is there some other weirdness going on?

  Thanks,

  Derek
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift Record and Object Oriented DB

2008-11-26 Thread David Pollak
On Wed, Nov 26, 2008 at 10:36 AM, Tim Perrett [EMAIL PROTECTED] wrote:


 IMO, there is a wider issue here at large:

 Should we be providing a way / central repo for lift plugins (read:
 modules) that are part of lift proper? Kind of like a lift-extras
 repo? Possibly host it on scala-tools?


I think this can be accomplished with the Maven infrastructure.  We're
hosting a fair and growing number of Maven repositorie at scala-tools.org  I
would love to see lots of project hosted at GitHub and built and served via
ScalaTools.




 Cheers

 Tim

 On 26 Nov 2008, at 18:32, David Pollak wrote:

  We will not be providing support for DB4O or BDB in the core Lift
  packages because of licensing issues.  I'd be very interested in
  someone else providing external support for both.

 Tim Perrett
 print application architect

 t: +44 (0) 78144 34 791
 e: [EMAIL PROTECTED]
 w: timperrett.com






 



-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Two items on Record

2008-11-26 Thread Derek Chen-Becker
Still getting the type error using an explicit List(...):

[WARNING]
/home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
error: type mismatch;
[WARNING]  found   :
List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
type _10 : String with java.util.Calendar : java.lang.Comparable[_1]
forSome { type _1 : java.lang.String with java.util.Calendar :
java.io.Serializable } with java.io.Serializable }{def defaultValue:
java.lang.Comparable[_12] forSome { type _12 : java.lang.String with
java.util.Calendar : java.io.Serializable } with java.io.Serializable}]
[WARNING]  required:
List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
type _$3 }]
[WARNING]   override def fieldOrder = List(date, description)

Marius, I checked the commit and that looks reasonable. I'm using the
snapshot repo right now so I'll modify my code to call
Field.couldNotSetValue and test in the morning. Thanks!

Derek

On Wed, Nov 26, 2008 at 10:35 AM, David Pollak 
[EMAIL PROTECTED] wrote:



 On Wed, Nov 26, 2008 at 7:34 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 I'm in the process of playing with the Record code so I have some examples
 for the book. I've run into two small issues:


1. I'm writing a custom Field type (DecimalField) and it seems like
the valueCouldNotBeSet var should be set if I can't parse the decimal 
 string
that a user hands me in setFromString. That var, however, is marked
private[record], so I can't actually access it. Could you provide an
accessor or make that var protected so that I can set it?
2. I'm getting a really weird type error if I try to override the
fieldOrder def on MetaRecord:


 Try this:

 object EntryMeta extends Entry with MetaRecord[Entry] {
   override def fieldOrder = List(date, description)
 }



1.

 [WARNING]
 /home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
 error: type mismatch;
 [WARNING]  found   :
 List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
 type _10 : String with java.util.Calendar : java.lang.Comparable[_1]
 forSome { type _1 : java.lang.String with java.util.Calendar :
 java.io.Serializable } with java.io.Serializable }{def defaultValue:
 java.lang.Comparable[_12] forSome { type _12 : java.lang.String with
 java.util.Calendar : java.io.Serializable } with java.io.Serializable}]
 [WARNING]  required:
 List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
 type _$3 }]
 [WARNING]   override def fieldOrder = date :: description :: Nil

 Here's my code:

 class Entry extends Record[Entry] {
   def meta = EntryMeta

   object date extends DateTimeField(this)

   object description extends StringField(this, 100)
 }

 object EntryMeta extends Entry with MetaRecord[Entry] {
   override def fieldOrder = date :: description :: Nil
 }

 Am I making a dumb mistake here, or is there some other weirdness going
 on?

 Thanks,

 Derek





 --
 Lift, the simply functional web framework http://liftweb.net
 Collaborative Task Management http://much4.us
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp

 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] a plea for documentation

2008-11-26 Thread David Stein

After digging into some sample Lift apps, I can smell the awesomeness
and really want to jump in right away.  Now that the Scala book has
been printed, I feel that Scala in general and Lift in particular will
both attract many more curious people.  I don't mean this as a
criticism of Lift (which is impressive), but the documentation is
severely lacking.  Needing to troll through undocumented APIs will
certainly turn people off and could perhaps squander some natural
momentum that seems to be building around Scala.  I know there are two
books in the works, but I don't think the community can afford to
wait.

I'd like to challenge each committer to take responsibility for a
portion of the API and fully document it in Scaladocs by year's end.
I think there are 6-12 of you and 14 packages, so I don't see it as
being a lot of work.  Once there are glimpses of better documentation,
I'm certain people who aren't Scala/Lift experts will begin writing
tutorials and contributing documentation and sample projects of their
own.  Right now, it's like walking into an Egyptian tomb and trying to
decipher hieroglyphics without a Rosetta stone.  We all know writing
documentation is a chore, but perhaps you can find inspiration in
thinking that once your APIs are documented, thousands of people will
use your creation and sing your praises at conferences around the
world.

I'm sure we all can think of similarly awesome technologies which
weren't widely adopted, perhaps because they were just too advanced
for the current state of the market.  Smalltalk comes to mind, as do
early versions of WebObjects.  BeOS anyone?  I'd hate for Lift to not
enjoy its moment in the sun simply for lack of documentation.

Tally-ho!

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: One-to-Many mappings with Lift ORM

2008-11-26 Thread Juha L

Ok, thanks for the information.

Is the idea to phase out mapper in favour of the Record/Field as soon
as it reaches mature stage? It seems from the list that there is lot
of active development on that area, so that isn't probably far in the
future.

// Juha

On Nov 24, 7:08 pm, David Pollak [EMAIL PROTECTED]
wrote:
 Juha,

 Yep... Lift doesn't do a lot of automagic stuff with One to Many relations.
 Maybe we'll look into doing more with this once we move to the Record/Field
 code.

 Thanks,

 David



 On Sun, Nov 23, 2008 at 1:47 PM, Juha L [EMAIL PROTECTED] wrote:

  Hi,

  I'm trying to learn some Scala and Lift, and I'm currently playing
  with the Lift mapper. I have however stumbled upon a problem for which
  I don't seem to be able to find answer from the examples or by using
  Google. How do you create one-to-many mapping with lift mapper?

  I have something like

  class Parent extends KeyedMapper[Long, Parent] {
   def getSingleton = Parent
   def primaryKeyField = id

   object id extends MappedLongIndex(this)
  }

  class Child extends KeyedMapper[Long, Child] {
   def getSingleton = Child
   def primaryKeyField = id

   object id extends MappedLongIndex(this)

   object parent extends MappedLongForeignKey(this, Parent)
  }

  What do I need to do so that I could do something like

  parent.children.map(...)

  Only way I have figured out is to create function like one below in
  the Parent class. That will only solve problem of finding and updating
  them, not adding, deleting or so.

   def children = Child.findAll(By(Child.parent, this.id))

  There probably is a correct way to do this, but at least I couldn't
  find it. Any help appreciated.

  Thanks beforehand,
   Juha

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Collaborative Task Managementhttp://much4.us
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: One-to-Many mappings with Lift ORM

2008-11-26 Thread David Pollak
On Wed, Nov 26, 2008 at 11:12 AM, Juha L [EMAIL PROTECTED] wrote:


 Ok, thanks for the information.

 Is the idea to phase out mapper in favour of the Record/Field as soon
 as it reaches mature stage? It seems from the list that there is lot
 of active development on that area, so that isn't probably far in the
 future.


It's likely that Mapper will be the official ORM tool for Lift 1.0 and the
Record stuff will mature and be the recommended ORM tool for Lift 1.1+




 // Juha

 On Nov 24, 7:08 pm, David Pollak [EMAIL PROTECTED]
 wrote:
  Juha,
 
  Yep... Lift doesn't do a lot of automagic stuff with One to Many
 relations.
  Maybe we'll look into doing more with this once we move to the
 Record/Field
  code.
 
  Thanks,
 
  David
 
 
 
  On Sun, Nov 23, 2008 at 1:47 PM, Juha L [EMAIL PROTECTED] wrote:
 
   Hi,
 
   I'm trying to learn some Scala and Lift, and I'm currently playing
   with the Lift mapper. I have however stumbled upon a problem for which
   I don't seem to be able to find answer from the examples or by using
   Google. How do you create one-to-many mapping with lift mapper?
 
   I have something like
 
   class Parent extends KeyedMapper[Long, Parent] {
def getSingleton = Parent
def primaryKeyField = id
 
object id extends MappedLongIndex(this)
   }
 
   class Child extends KeyedMapper[Long, Child] {
def getSingleton = Child
def primaryKeyField = id
 
object id extends MappedLongIndex(this)
 
object parent extends MappedLongForeignKey(this, Parent)
   }
 
   What do I need to do so that I could do something like
 
   parent.children.map(...)
 
   Only way I have figured out is to create function like one below in
   the Parent class. That will only solve problem of finding and updating
   them, not adding, deleting or so.
 
def children = Child.findAll(By(Child.parent, this.id))
 
   There probably is a correct way to do this, but at least I couldn't
   find it. Any help appreciated.
 
   Thanks beforehand,
Juha
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Collaborative Task Managementhttp://much4.us
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp

 



-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Date and Time Pickers in Lift

2008-11-26 Thread Dano

Hello Fellow Lifters,

I am coding up a form which has separate date and time fields and was
wondering if there are any picker widgets which can be yoked to the
fields to allow the user to pick the date/time rather than type it in.

I looked in the lift-widgets directory, but did not find one.

Is there one available?

Thanks in advance.


Dan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Named Partial Functions

2008-11-26 Thread David Pollak
Folks,

One of the things that came out of the Lift Workshop was the need for
tracing of rewrites, sitemaps, etc.

Most of the rewrite, etc. logic is buried in PartialFunctions that are
composed together.

In order to accommodate the need to trace what code is changing requests,
matching stuff for sitemaps, etc., I need to add a name to the
PartialFunction... a trait I'm calling NamedPartialFunction

I'm going to create a helper object that will vend NamedPartialFunctions and
do other things (like tracing their execution).  I'd like to have a name
that's shorter than NamedPartialFunction, but longer than NPF.  Any ideas?

Thanks,

David

-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Named Partial Functions

2008-11-26 Thread Marius

TrackPf ?

On Nov 26, 10:21 pm, David Pollak [EMAIL PROTECTED]
wrote:
 Folks,

 One of the things that came out of the Lift Workshop was the need for
 tracing of rewrites, sitemaps, etc.

 Most of the rewrite, etc. logic is buried in PartialFunctions that are
 composed together.

 In order to accommodate the need to trace what code is changing requests,
 matching stuff for sitemaps, etc., I need to add a name to the
 PartialFunction... a trait I'm calling NamedPartialFunction

 I'm going to create a helper object that will vend NamedPartialFunctions and
 do other things (like tracing their execution).  I'd like to have a name
 that's shorter than NamedPartialFunction, but longer than NPF.  Any ideas?

 Thanks,

 David

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Collaborative Task Managementhttp://much4.us
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: a plea for documentation

2008-11-26 Thread David Stein

On Wed, Nov 26, 2008 at 11:22 AM, David Pollak
[EMAIL PROTECTED] wrote:
 David,

 We are actively working on documentation.  Please see a number of recent
 posts on the subject.

 David

Yes, I've been following those posts.  Having a couple of books out
will be great.  Books take time to write though, certainly much more
time than it takes to update the Scaladocs.  What do you guys, the
committers, think about putting your book efforts on hold until the
API is documented?  At the very least, I'd encourage you guys to not
submit code from now on which isn't documented.  It's just too much
work to go back later and add it, as we all know from our own
experiences no doubt.

DS

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Date and Time Pickers in Lift

2008-11-26 Thread Dano

Tyler,

This one is really good if you want a single chooser for both date and
time.

Thanks for the tip.


Dan

On Nov 26, 1:52 pm, TylerWeir [EMAIL PROTECTED] wrote:
 Something like this:http://razum.si/jQuery-calendar/TimeCalendar.html
 ?

 On Nov 26, 4:38 pm, Marius [EMAIL PROTECTED] wrote:

  I think JQuery has one. Should be quite easy to use.

  On Nov 26, 9:59 pm, Dano [EMAIL PROTECTED] wrote:

   Hello Fellow Lifters,

   I am coding up a form which has separate date and time fields and was
   wondering if there are any picker widgets which can be yoked to the
   fields to allow the user to pick the date/time rather than type it in.

   I looked in the lift-widgets directory, but did not find one.

   Is there one available?

   Thanks in advance.

   Dan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Testing for well-formed XML

2008-11-26 Thread Jorge Ortiz
Folks,

One of the concerns raised at the Lift Workshop on Saturday was that
ill-formed XML files in your templates will fail at run time instead of
compile time, often with cryptic errors.

To correct for this, I've added a simple test to lift-archetype-basic and
lift-archetype-blank that will test all *.html and *.xml files in your
src/main/webapp directory (and its subdirectories) to make sure they can all
be loaded by Scala's XML parser. If they can't be loaded the test will fail
and notify you which files couldn't be loaded and why.

These tests run during Maven's 'test' phase. This phase is required before
the 'package', 'install', or 'deploy' phases can run. Unfortunately, the
'jetty:run' phase only requires 'test-compile', not 'test'. If you want the
test to run before starting Jetty, you'll have to specify it manually: 'mvn
test jetty:run' (or 'mvn install jetty:run', etc).

The test is available on any new projects created with Lift's archetypes. To
add the test to your own project, the code is included below. It's a simple
JUnit test. If you used a previous version of the archetypes to start your
project, you can throw it into AppTest.scala

Enjoy,

--j


  /**
   * Tests to make sure the project's XML files are well-formed.
   *
   * Finds every *.html and *.xml file in src/main/webapp (and its
   * subdirectories) and tests to make sure they are well-formed.
   */
  def testXml() = {
var failed: List[java.io.File] = Nil

def wellFormed(file: java.io.File) {
  if (file.isDirectory)
for (f - file.listFiles) wellFormed(f)

  if (file.isFile  (file.getName.endsWith(.html) ||
file.getName.endsWith(.xml))) {
try {
  scala.xml.XML.loadFile(file)
} catch {
  case e: org.xml.sax.SAXParseException = failed = file :: failed
}
  }
}

wellFormed(new java.io.File(src/main/webapp))

val numFails = failed.size
if (numFails  0) {
  val fileStr = if (numFails == 1) file else files
  val msg = Malformed XML in  + numFails +   + fileStr + :  +
failed.mkString(, )
  println(msg)
  fail(msg)
}
  }

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Testing for well-formed XML

2008-11-26 Thread Jorge Ortiz
Oops, it just test *.htm and *.xhtml files as well. Updated code below.

--j

  /**
   * Tests to make sure the project's XML files are well-formed.
   *
   * Finds every *.html and *.xml file in src/main/webapp (and its
   * subdirectories) and tests to make sure they are well-formed.
   */
  def testXml() = {
var failed: List[java.io.File] = Nil

def handled(file: String) =
  file.endsWith(.html) || file.endsWith(.xml) ||
  file.endsWith(.htm)  || file.endsWith(.xhtml)

def wellFormed(file: java.io.File) {
  if (file.isDirectory)
for (f - file.listFiles) wellFormed(f)

  if (file.isFile  handled(file.getName)) {
try {
  scala.xml.XML.loadFile(file)
} catch {
  case e: org.xml.sax.SAXParseException = failed = file :: failed
}
  }
}

wellFormed(new java.io.File(src/main/webapp))

val numFails = failed.size
if (numFails  0) {
  val fileStr = if (numFails == 1) file else files
  val msg = Malformed XML in  + numFails +   + fileStr + :  +
failed.mkString(, )
  println(msg)
  fail(msg)
}
  }


On Wed, Nov 26, 2008 at 4:58 PM, Jorge Ortiz [EMAIL PROTECTED] wrote:

 Folks,

 One of the concerns raised at the Lift Workshop on Saturday was that
 ill-formed XML files in your templates will fail at run time instead of
 compile time, often with cryptic errors.

 To correct for this, I've added a simple test to lift-archetype-basic and
 lift-archetype-blank that will test all *.html and *.xml files in your
 src/main/webapp directory (and its subdirectories) to make sure they can all
 be loaded by Scala's XML parser. If they can't be loaded the test will fail
 and notify you which files couldn't be loaded and why.

 These tests run during Maven's 'test' phase. This phase is required before
 the 'package', 'install', or 'deploy' phases can run. Unfortunately, the
 'jetty:run' phase only requires 'test-compile', not 'test'. If you want the
 test to run before starting Jetty, you'll have to specify it manually: 'mvn
 test jetty:run' (or 'mvn install jetty:run', etc).

 The test is available on any new projects created with Lift's archetypes.
 To add the test to your own project, the code is included below. It's a
 simple JUnit test. If you used a previous version of the archetypes to start
 your project, you can throw it into AppTest.scala

 Enjoy,

 --j


   /**
* Tests to make sure the project's XML files are well-formed.
*
* Finds every *.html and *.xml file in src/main/webapp (and its
* subdirectories) and tests to make sure they are well-formed.
*/
   def testXml() = {
 var failed: List[java.io.File] = Nil

 def wellFormed(file: java.io.File) {
   if (file.isDirectory)
 for (f - file.listFiles) wellFormed(f)

   if (file.isFile  (file.getName.endsWith(.html) ||
 file.getName.endsWith(.xml))) {
 try {
   scala.xml.XML.loadFile(file)
 } catch {
   case e: org.xml.sax.SAXParseException = failed = file :: failed
 }
   }
 }

 wellFormed(new java.io.File(src/main/webapp))

 val numFails = failed.size
 if (numFails  0) {
   val fileStr = if (numFails == 1) file else files
   val msg = Malformed XML in  + numFails +   + fileStr + :  +
 failed.mkString(, )
   println(msg)
   fail(msg)
 }
   }



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Testing for well-formed XML

2008-11-26 Thread TylerWeir

Awesome stuff Jorge!

On Nov 26, 8:07 pm, Jorge Ortiz [EMAIL PROTECTED] wrote:
 Oops, it just test *.htm and *.xhtml files as well. Updated code below.

 --j

   /**
    * Tests to make sure the project's XML files are well-formed.
    *
    * Finds every *.html and *.xml file in src/main/webapp (and its
    * subdirectories) and tests to make sure they are well-formed.
    */
   def testXml() = {
     var failed: List[java.io.File] = Nil

     def handled(file: String) =
       file.endsWith(.html) || file.endsWith(.xml) ||
       file.endsWith(.htm)  || file.endsWith(.xhtml)

     def wellFormed(file: java.io.File) {
       if (file.isDirectory)
         for (f - file.listFiles) wellFormed(f)

       if (file.isFile  handled(file.getName)) {
         try {
           scala.xml.XML.loadFile(file)
         } catch {
           case e: org.xml.sax.SAXParseException = failed = file :: failed
         }
       }
     }

     wellFormed(new java.io.File(src/main/webapp))

     val numFails = failed.size
     if (numFails  0) {
       val fileStr = if (numFails == 1) file else files
       val msg = Malformed XML in  + numFails +   + fileStr + :  +
 failed.mkString(, )
       println(msg)
       fail(msg)
     }
   }

 On Wed, Nov 26, 2008 at 4:58 PM, Jorge Ortiz [EMAIL PROTECTED] wrote:
  Folks,

  One of the concerns raised at the Lift Workshop on Saturday was that
  ill-formed XML files in your templates will fail at run time instead of
  compile time, often with cryptic errors.

  To correct for this, I've added a simple test to lift-archetype-basic and
  lift-archetype-blank that will test all *.html and *.xml files in your
  src/main/webapp directory (and its subdirectories) to make sure they can all
  be loaded by Scala's XML parser. If they can't be loaded the test will fail
  and notify you which files couldn't be loaded and why.

  These tests run during Maven's 'test' phase. This phase is required before
  the 'package', 'install', or 'deploy' phases can run. Unfortunately, the
  'jetty:run' phase only requires 'test-compile', not 'test'. If you want the
  test to run before starting Jetty, you'll have to specify it manually: 'mvn
  test jetty:run' (or 'mvn install jetty:run', etc).

  The test is available on any new projects created with Lift's archetypes.
  To add the test to your own project, the code is included below. It's a
  simple JUnit test. If you used a previous version of the archetypes to start
  your project, you can throw it into AppTest.scala

  Enjoy,

  --j

    /**
     * Tests to make sure the project's XML files are well-formed.
     *
     * Finds every *.html and *.xml file in src/main/webapp (and its
     * subdirectories) and tests to make sure they are well-formed.
     */
    def testXml() = {
      var failed: List[java.io.File] = Nil

      def wellFormed(file: java.io.File) {
        if (file.isDirectory)
          for (f - file.listFiles) wellFormed(f)

        if (file.isFile  (file.getName.endsWith(.html) ||
  file.getName.endsWith(.xml))) {
          try {
            scala.xml.XML.loadFile(file)
          } catch {
            case e: org.xml.sax.SAXParseException = failed = file :: failed
          }
        }
      }

      wellFormed(new java.io.File(src/main/webapp))

      val numFails = failed.size
      if (numFails  0) {
        val fileStr = if (numFails == 1) file else files
        val msg = Malformed XML in  + numFails +   + fileStr + :  +
  failed.mkString(, )
        println(msg)
        fail(msg)
      }
    }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---