We are using Mapper with a legacy database with many columns that we
are not allowed to rename in our database.  For example CREATE_DATE
for which we created the following seemingly simple mapped field in
our model:

  object createDate extends MappedDateTime(this) {
    override def dbColumnName = "CREATE_DATE"
  }

When we added "with CRUDify" the resulting List and Edit forms all
display this fields as Jan 01, 1970 all the time.  We tried this
experiment also with other columns of different types (MappedString,
MappedInt, MappedFriendlyString, MappedDouble, MappedBoolean) and
these all seemed to always display the default value rather than the
real data value from the database column.

We weren't sure if it was CRUDify or Mapper causing the problem.  I
think we narrowed it down to the Mapper by creating our own simple
snippet to create a basic HTML table and bound this value using

class ProjType {
  def projects(xhtml: NodeSeq): NodeSeq =
     ProjectType.findAll(OrderBy(ProjectType.createDate, Ascending))
      .flatMap(aProjType => bind("projtype", xhtml,
                 "createDate" -> aProjType.createDate))
}

and our xhtml section that uses this snippet is:

  <table>
   <lift:snippet type="ProjType:projects">
    <tr>
      <td><projtype:createDate>01/01/2009</projtype:createDate></td>
    </tr>
   </lift:snippet>
  </table>

but createDate is still coming back Jan 01, 1970 in our custom
rendered table.

If we instead changed our mapped field name in our class to match the
legacy column name (CREATE_DATE) exactly:

  object CREATE_DATE extends MappedDateTime(this)

and our binding to "createDate" -> aProjType.CREATE_DATE

everything is happy (both CRUDify and our custom form).

We're not sure if this is a bug or if we're doing something wrong.

Thanks, Troy

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