I think there is support somewhere in the MappedField hierarchy for a 
MappedField that represents to database columns. Take a look at MappedPassword.


-------------------------------------
harryh<har...@gmail.com> wrote:


Make MyMappedTimeSpan a trait:

trait MyMappedTimeSpan[T <:Mapper[T]](val owner: T) {
  object from extends MappedTime[MapperType](this.asIntanceOf
[MatterType])
  object to extends MappedTime[MapperType](this.asIntanceOf
[MatterType])
}

And then use it like so:

class DBObject extends LongKeyedMapper[Bericht] with IdPK with
MyMappedTimeSpan[DBObject] {
}

-harryh

On Oct 16, 8:08 am, hyperion <hyperion1...@googlemail.com> wrote:
> Hello,
>
> I tried this:
>
> class MyMappedTimeSpan[T <:Mapper[T]](val owner: T){
>     import net.liftweb.util._
>     import net.liftweb.http.S
>     import xml.NodeSeq
>
>     val from = new MappedTime(owner)
>     val to = new MappedTime(owner)
>  }
>
> class DBObject extends LongKeyedMapper[Bericht] with IdPK {
>
>   def getSingleton = Bericht
>   ...
>   object test extends MyMappedTimeSpan(this)
>
> }
>
> and bound this class with:
> "from" -> bt.test.from.toForm,
> "to" -> bt.test.to.toForm,
>
> In html:
>                 <tr>
>                         <td><bt:von/></td>
>                         <td><bt:nach/></td>
>                 </tr>
>
> Everything worked fine... except that my timespan is completely
> ignored in the database ;). I think the reason is you use reflection
> on class DBObject to find all values that should be stored in the
> dabase?... but I have not inspected the source code jet... I am new to
> lift and also to scala....
>
> My Question: Is it possible to build such Datatypes based on two or
> more  DB-Fields of the single table...?... I think even they are
> mapped to the "master"-DB-table, such types could be helpful...
>
> Greetz


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to